Jump to content

Recommended Posts

Posted

I have a main forn and another one called by  a button . After clicking I open the 2nd form

Then I try to return to the MainForm . Sometimes ir return burt sometimes not

The codes are in the figure and are basic. Can I improve this to avoid the non-return which arise sometimes ?Sometimesdonotreturn.thumb.png.82ac8e6592ef56e45cba3c73e936ae1b.png

Posted
6 hours ago, SergioFeitoza said:

Then I try to return to the MainForm . Sometimes ir return burt sometimes not

Hello,

Are there any errors in the browser console? Can you check?

Posted

That is the point there are no errors at all . Sometimes it works properly and sometimes just stay stopped in the results screen  (as I had not clicked the button)

Plase check the figure 3 attached (formResults). The figure 1 is the mainForm

NothingHappens.png

MainForm.png

Posted

About call subform, I create it dynamically and show it with callback procedure 

mainform openbutton event

fsubform:=Tsubform.create(uniapplication);

fsubform.show(callback); // or showmodal(callback)  

you need  a callback procedure in mainform like

procedure mainform.callback(sender:Tcomponent;aResult:integer);

begin

if aResult=mrYes then {do something};

//if sender is TSubform then TSubform(sender).something;

end;

in subform ,you can close subform with code modalresult:=mrYes; {or mrNo,mrCancel ..}

the execute process is:

 mainform.buttonclick--->subform.create----->subform.show(callback)---->subform.someevent------>subform.modalresult(maybe write in buttonclick)----->mainform.callback

And no need to enable or disable mainform buttons in subform,do this with callback. 

I hope this will help you.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...