Error code not making sense...

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
metron9
Posts: 45
Joined: Sat Sep 08, 2012 7:18 am
Location: Minnesota U.S.A.

Error code not making sense...

Post 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.
Attachments
New folder (2).zip
(214.22 KiB) Downloaded 178 times
New folder.zip
(4.35 KiB) Downloaded 144 times
syntax.png
syntax.png (41.61 KiB) Viewed 2511 times
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Error code not making sense...

Post 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
Viva INTERNATIONAL HMG :D
User avatar
metron9
Posts: 45
Joined: Sat Sep 08, 2012 7:18 am
Location: Minnesota U.S.A.

Re: Error code not making sense...

Post 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
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Error code not making sense...

Post 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
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Error code not making sense...

Post by Rathinagiri »

:)

Thanks for your timely help Esgici.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Error code not making sense...

Post by esgici »

Hi Rathi,

welcome back :D

I hope your brother is better :arrow:

Best regards
Viva INTERNATIONAL HMG :D
Post Reply