Harbour Error 0030

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
CalScot
Posts: 303
Joined: Thu Mar 21, 2013 12:22 am
Location: California

Harbour Error 0030

Post by CalScot »

I have a compiling error that I just can’t seem to get to go away!

My window, CSOptnFrq.fmg, has a frame, a label and:
RadioGroup_1 (“RG1”, with 3 options)
Text_1 and Text_2 (associated with RG1 options 2 & 3 respectively)
Button_1 (“Save”)

If RG1 option 1 is chosen, both text boxes should be disabled.
If RG1 option 2 is chosen, Text_2 should be disabled and Text_1 enabled for input.
If RG1 option 3 is chosen, Text_1 should be disabled and Text_2 enabled for input.

Each option could be chosen more than once before the user hits the "Save" button.

RG1 has: OnChange CSFrqChg()

Code: Select all

Function CSFrqChg()
If CSOptnFrq.RadioGroup_1.Value = 1
   CSOptnFrq.Text_1.Enabled := .F.
   CSOptnFrq.Text_2.Enabled := .F.
ElseIf CSOptnFrq.RadioGroup_1.Value = 2
   CSOptnFrq.Text_1.Enabled := .T.
   CSOptnFrq.Text_2.Enabled := .F.
ElseIf CSOptnFrq.RadioGroup_1.Value = 3
   CSOptnFrq.Text_1.Enabled := .F.
   CSOptnFrq.Text_2.Enabled := .T.
EndIf
Return Nil
Every line (except the function name) produces a compiling error, with the message:
Harbour: … Error 0030 Syntax error “syntax error at… (Usually at '.')

I’ve tried everything I can think of, without success. Any help would be appreciated!

Thanks,
CalScot
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Harbour Error 0030

Post by andyglezl »

Hello CalScot

I think you have to define your control RadioGroup after the "TextBox".
------------------------------------------------------------------------------
Hola CalScot

Creo que tienes que definir tu control RadioGroup despues de los "TextBox".
------------------------------------------------------------------------------
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
CalScot
Posts: 303
Joined: Thu Mar 21, 2013 12:22 am
Location: California

Re: Harbour Error 0030

Post by CalScot »

Hi, Andy.
The window definitions are all in the CSOptnFrq.Fmg file, loaded and activated from Main.prg.
I will, however, try bypassing the .fmg and define it in a function, to test your theory.
(I'm ready to try anything at this point!!)
Thanks for the suggestion!
Regards,
CalScot
User avatar
CalScot
Posts: 303
Joined: Thu Mar 21, 2013 12:22 am
Location: California

Re: Harbour Error 0030

Post by CalScot »

Success, finally!

I tried a lot of different things, such as moving the RadioGroup_1 definition to be the last item in the .Fmg file, and redefining it between Load and Activate, neither if which changed the problem.

What finally did fix it (much to my surprise, and which was tried in desperation) was to put "Declare Window CSOptnFrq" right after the Function name and before the "If..." code. With that, the code compiles and the function works as designed.

What mystifies me is that the function call was coming from within the same window - already open and activated - so why should the window need to be declared to make it recognize itself? If anyone can explain why, I'd appreciate it!

Tks.
CalScot
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Harbour Error 0030

Post by esgici »

CalScot wrote: What mystifies me is that the function call was coming from within the same window - already open and activated - so why should the window need to be declared to make it recognize itself? If anyone can explain why, I'd appreciate it!
HMG Doc 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.
Happy HMG'ing :D
Viva INTERNATIONAL HMG :D
User avatar
CalScot
Posts: 303
Joined: Thu Mar 21, 2013 12:22 am
Location: California

Re: Harbour Error 0030

Post by CalScot »

Thanks, esgici.
A window must be declared using [ DECLARE WINDOW <WindowName> ], 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.
That's what mystifies me: It was already loaded and activated -- the function call was made from a process initiated within it! -- and it was in the same .prg file (Main.prg). I still don't see why I had to effectively re-declare it to get it to compile.

Regards,
CalScot
User avatar
salamandra
Posts: 311
Joined: Thu Jul 31, 2008 8:33 pm
DBs Used: DBF, MySQL, SQL
Location: Brazil

Re: Harbour Error 0030

Post by salamandra »

Hi CalScot 8-) ,
Please, try this sample.
test.rar
(821.39 KiB) Downloaded 418 times

[]´s Salamandra
There is one time in which is crucial awakening. That time is now. ( Buddha )
User avatar
CalScot
Posts: 303
Joined: Thu Mar 21, 2013 12:22 am
Location: California

Re: Harbour Error 0030

Post by CalScot »

Hi, Salamandra.

Thank you for your sample - a good way to do it! I like it and I appreciate it your help!!

Just adding "Declare Window..." (line 2 below) to my original code made it work (though I'm still not sure why!), as follows:

Code: Select all

Function CSFrqChg()
Declare Window CSOptnFrq
If CSOptnFrq.RadioGroup_1.Value = 1
   CSOptnFrq.Text_1.Enabled := .F.
   CSOptnFrq.Text_2.Enabled := .F.
ElseIf CSOptnFrq.RadioGroup_1.Value = 2
   CSOptnFrq.Text_1.Enabled := .T.
   CSOptnFrq.Text_2.Enabled := .F.
ElseIf CSOptnFrq.RadioGroup_1.Value = 3
   CSOptnFrq.Text_1.Enabled := .F.
   CSOptnFrq.Text_2.Enabled := .T.
EndIf
Return Nil
Thanks again.
CalScot
Post Reply