Modules in HMG 3.1.1

HMG Unicode versions 3.1.x related

Moderator: Rathinagiri

Post Reply
User avatar
zolysoftsolutions
Posts: 139
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Contact:

Modules in HMG 3.1.1

Post by zolysoftsolutions »

Hello everybody,

I have a simple question. I wish to make more modules for my functions and procedures, but I have the folowing problem:
I made a module "buttonactions.prg" for functions evaluating the click event on the commandbuttons.

The content of buttonactions.prg:

#include <hmg.ch>
function clickintrari
main.image_1.picture:="butoane\intrariactiv.bmp"
return

This function is called by an action event by clicking on an image (used as commandbutton).
The form is named "MAIN" (main.fmg)
In action event of an image I just typed: "clickintrari()"

If I put this funtion in "main.prg" everything runs well, but if I place it in "buttonactions.prg", on compile, I have an error message, error on line 4, Error E0030 Sintax error at '.'

In "buttonaction" module I can't refer to the object "main"
By example is also not working: main.title:="Test"

Why this happens? What I have to do to can manage my functions in modules? Why I cannot refer from a module to an object if I specify the parent name?

Best regards,
Zoli B.
_______________________________
Open eyes for you!
User avatar
zolysoftsolutions
Posts: 139
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Contact:

Re: Modules in HMG 3.1.1

Post by zolysoftsolutions »

SOLVED!

My functions and procedures in new module are declared before the object I refer in procedure (in this case: main form).
Before the funtions, is neccessary the objects to be declared.

I just typed in first line os buttonactions.prg: Declare window MAIN

Regards,
Zoli B.
_______________________________
Open eyes for you!
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Modules in HMG 3.1.1

Post by esgici »

Hi Zoli
zolysoftsolutions wrote:SOLVED!

My functions and procedures in new module are declared before the object I refer in procedure (in this case: main form).
Before the funtions, is neccessary the objects to be declared.

I just typed in first line os buttonactions.prg: Declare window MAIN
Thanks to you share your experience with us :)

Viva HMG :D
Viva INTERNATIONAL HMG :D
Post Reply