Page 1 of 1

Modules in HMG 3.1.1

Posted: Sun Jul 21, 2013 6:27 am
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.

Re: Modules in HMG 3.1.1

Posted: Sun Jul 21, 2013 8:17 am
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.

Re: Modules in HMG 3.1.1

Posted: Sun Jul 21, 2013 12:07 pm
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