hendrang Posted April 10, 2015 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
Administrators Farshad Mohajeri Posted April 11, 2015 Administrators Posted April 11, 2015 Where in MainModule do you run above code? Quote
hendrang Posted April 11, 2015 Author 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
Administrators Farshad Mohajeri Posted April 11, 2015 Administrators 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
hendrang Posted April 11, 2015 Author 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
Administrators Farshad Mohajeri Posted April 11, 2015 Administrators 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
Abaksoft Posted April 12, 2015 Posted April 12, 2015 Hello Hendra, See http://forums.unigui.com/index.php?/topic/5116-is-a-standard-delphi-unit-thead-safe/ Quote
hendrang Posted April 12, 2015 Author 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
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.