SergioFeitoza Posted June 1, 2020 Posted June 1, 2020 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 ? Quote
Sherzod Posted June 2, 2020 Posted June 2, 2020 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? Quote
SergioFeitoza Posted June 2, 2020 Author Posted June 2, 2020 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 Quote
zhyhero Posted June 2, 2020 Posted June 2, 2020 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. Quote
SergioFeitoza Posted June 2, 2020 Author Posted June 2, 2020 Thank you zhyhero I understood your approach and will implement it now . Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.