Forum > FV/Textmode IDE

Dialog Dispose, Done result in AV

(1/1)

paule32:
Hello,
I have to following Code Snippet of the FreeVision Port for the Windows 10 Command Console...
how can I check, if cmStopAndSave is pressed ?
I tried:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---dummy := desktop^.ExecView(PrimeDialog);if dummy = cmStopAndSave then begin// close the dialog - but this would not working:// Dispose(PrimeDialog, Done);//// when I call without dummy, also: desktop^.insert(PrimeDialog); the result is a AV - Access Violation.end;
So, how can I close/remove the dialog ?


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TPrimeApp.doPrimeDialog;var  R: Objects.TRect;  dummy: Word;  line_start, line_end, cindex, cforce: PView;begin  R.Assign(0,0,72,16);  R.Move(4,3);    PrimeDialog := New(PDialog, Init(R, 'Prime finder Dialog'));  with PrimeDialog^ do begin    // text 1    R.Assign(2,1, 43,2);    Insert(New(PStaticText, Init(R, 'Start Prime:')));        // text 2    R.Assign(2,4, 43,5);    Insert(New(PStaticText, Init(R, 'End Prime:')));        // input line: prime start    R.Assign(2,2, 64,3);    line_start := New(PInputLine,Init(R, 250));    insert(line_start);        // input line: prime end    R.Assign(2,5, 64,6);    line_end := New(PInputLine,Init(R, 250));    insert(line_end);     // checkbox: parameter    R.Assign( 2,7, 23, 8); Insert(New(PStaticText, Init(R, 'Parameter 1:')));    R.Assign(26,7, 47, 8); Insert(New(PStaticText, Init(R, 'Parameter 2:')));        R.Assign( 2,8, 23, 9); cindex := New(PCheckBoxes, Init(R, NewSItem('~o~nly one check', nil)));    R.Assign(26,8, 47, 9); cforce := New(PCheckBoxes, Init(R, NewSItem('~f~orce start'   , nil)));    Insert(cindex);    Insert(cforce);        // text: index    R.Assign(2,10, 42,11); Insert(New(PStaticText, Init(R, 'Index:')));    R.Assign(2,11, 42,12); Insert(New(PStaticText, Init(R, 'Prime:')));        // text: prime    R.Assign(10,10, 42,11); Insert(New(PStaticText, Init(R, '1')));    R.Assign(10,11, 42,12); Insert(New(PStaticText, Init(R, '2')));        // button: cancel    R.Assign(2,13, 24,15);    Insert(New(PButton, Init(R, '~C~ancel Search', cmCancelSearch, bfDefault)));        // button: load data    R.Assign(26,13, 46,15);    Insert(New(PButton, Init(R, '~L~oad Data', cmStopAndLoad, bfNormal)));        // button: save data    R.Assign(48,13, 69,15);    Insert(New(PButton, Init(R, '~S~top and saves', cmStopAndSave, bfNormal)));  end;    if ValidView(PrimeDialog) <> nil then begin    desktop^.insert(PrimeDialog);  end;end;

paule32:
okay, I have it done.

I had to do subclass the TDialog class.
Then, in HandleEvent, I could create the dialog by dialogobj.Init;

In the Event handler of the dialogobj, I don't add code ClearEvent, so the memory points to nirvana...

Navigation

[0] Message Index

Go to full version