Page 1 of 1

Error code not making sense...

Posted: Fri Sep 21, 2012 4:01 am
by metron9
Three program files
Main.prg
Wipmainwindow.prg
Wiptran2012.prg

I have a main program MAIN.PRG that starts like this:
#include "hmg.ch"

Function Main
#include "pubvars.ch"
startup()
#include "wipmainwindow.prg"
Main_win.Center
Main_win.Activate
Return

< ... lots of functions...>

The wipmainwindow.prg defines a window

DEFINE WINDOW Main_win AT 176 , 969 WIDTH 1000 HEIGHT 480 <...morecode>

and defines a label

DEFINE LABEL mymsgbox
ROW 420
COL 260
WIDTH 520
HEIGHT 30
VALUE "Message Area"
...<more code>

I can access VALUE in a function defined in MAIN.PRG

function tryit2()
main_win.mymsgbox.value := 'Indexing'
return nil

When I call another function from an action in a button from the wipmainwindow.prg
i can not change the value from within that function using the same code
main_win.mymsgbox.value := 'Indexing'

i have to call tryit2() above to allow that function to change the VALUE contents of the label.
i get a syntax error '.' if I try and do this: (attached error screen)

tryit2()
main_win.mymsgbox.value := 'DONE'

It is not a syntax error as it works in the tryit2() function
What is the real error?

I put programs in zip file, dbf files in another zip file attached
the code in question is in wiptran2012 called function mergefiles()
This is not the real code to merge files I am just testing things in this function for now.

If you compile it and run it change the drive paths in drivedat to the location of addwip and jobtick
or just change the code of course.

I deleted all the fields and data not necessary for testing this code.

Re: Error code not making sense...

Posted: Fri Sep 21, 2012 4:35 am
by esgici
You need add

Code: Select all

DECLARE WINDOW Main_win
to top of wiptran2012.prg
HMG Reference wrote:DECLARE WINDOW
Declares a Window Name

DECLARE WINDOW <WindowName>

A window must be declared using this command, if you need to refer to it prior
its definition in code, or when you refer to it in a different .prg file from
the one it was defined using semi-oop syntax.


Regards

Re: Error code not making sense...

Posted: Fri Sep 21, 2012 9:47 pm
by metron9
Another stumbling block removed from my path to a new interface to my old clipper programs.
There just is no substitute for how well a forum like this can help teach others to learn new concepts.
My thanks to you as well as the folks that maintain this fine establishment. :D

Re: Error code not making sense...

Posted: Fri Sep 21, 2012 9:54 pm
by esgici
You are welcome dear Mark :)

You are right, here everything is under friendship umbrella ;)

And our slogan is :

Viva Roberto, Viva HMG, Viva friendship !

Regards :D

Re: Error code not making sense...

Posted: Sat Sep 22, 2012 12:11 am
by Rathinagiri
:)

Thanks for your timely help Esgici.

Re: Error code not making sense...

Posted: Sat Sep 22, 2012 12:28 am
by esgici
Hi Rathi,

welcome back :D

I hope your brother is better :arrow:

Best regards