Jump to content

How to call other procedure from MainModule


hendrang

Recommended Posts

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

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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  Abaksoft, Thanks

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...