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

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...