hendrang Posted April 10, 2015 Share Posted April 10, 2015 Hi All, In MainModule call other procedure or set variable in other form like these : TMainForm(MainForm).Counter:= 1000; TMainForm(MainForm).InitVariable; // Call Procedure InitVariable raise error : An Exception has occured in application: Access violation at address 006AC43D in module 'Project1.exe'. Read of address 00000068 Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted April 11, 2015 Administrators Share Posted April 11, 2015 Where in MainModule do you run above code? Quote Link to comment Share on other sites More sharing options...
hendrang Posted April 11, 2015 Author Share Posted April 11, 2015 Where in MainModule do you run above code? I am using Firedac and the above code run in Adconnection Afterconnect event. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted April 11, 2015 Administrators Share Posted April 11, 2015 It is not possible because MainForm is created after MainModule. As a general rule MainModule should not directly refer to any other Form. 1 Quote Link to comment Share on other sites More sharing options...
hendrang Posted April 11, 2015 Author Share Posted April 11, 2015 It is not possible because MainForm is created after MainModule. As a general rule MainModule should not directly refer to any other Form. Ok. Thanks Mr. Farshad. I have another question. Sometimes a procedure / function is to be called from another form but calling a procedure/function in another form always raise warning message warning : Form must be shown after is created : <formaname> then the form is shown. is it possible to call the procedure / function without showing the form ? Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted April 11, 2015 Administrators Share Posted April 11, 2015 Unlike Delphi in uniGUI forms has a limited lifetime to save system resources. That's why Forms must be shown right after they're created. If you want manage shared code and data between forms it is better to put them in MainModule object. Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted April 12, 2015 Share Posted April 12, 2015 Hello Hendra, See http://forums.unigui.com/index.php?/topic/5116-is-a-standard-delphi-unit-thead-safe/ Quote Link to comment Share on other sites More sharing options...
hendrang Posted April 12, 2015 Author Share Posted April 12, 2015 Unlike Delphi in uniGUI forms has a limited lifetime to save system resources. That's why Forms must be shown right after they're created. If you want manage shared code and data between forms it is better to put them in MainModule object. Thanks Farshad for your help Hello Hendra, See http://forums.unigui.com/index.php?/topic/5116-is-a-standard-delphi-unit-thead-safe/ Hello Abaksoft, Thanks Quote Link to comment Share on other sites More sharing options...
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.