Page 1 of 1

Alternate syntax

Posted: Tue Jan 26, 2010 2:24 pm
by karweru
Hi Friends,

Please pardon me, for I'm sure I've sought help on this before.

When I compile the following,
#include "minigui.ch"
#include "hbclass.ch"

FUNCTION main()
local cWindowName:="win_1"
local nRow:=0
local nCol:=0
local nWidth:=400
local nHeight:=200
local cTitle:="Hello world"

DEFINE WINDOW (cWindowName)

ROW (nRow)

COL (nCol)

WIDTH (nWindth)

HEIGHT (nHeight)

WINDOWTYPE MAIN

TITLE (cTitle)

END WINDOW

ACTIVATE WINDOW (cWindowName)
Return
...I get the following compile error.
Harbour 2.0.0beta3 (Rev. 12765)
Copyright (c) 1999-2009, http://www.harbour-project.org/
C:/classy/demo.prg(12) Error E0030 Syntax error "syntax error at 'WINDOW'"
C:/classy/demo.prg(22) Error E0030 Syntax error "syntax error at 'MAIN'"
2 errors

No code generated.
hbmk2: Error: Running Harbour compiler (embedded). 1
(C:\hmg\harbour\bin\harbour.exe) -n2 C:/classy/demo.prg /q -o.hbmk\win\mingw\ -iC:/hmg/harbour/include -iC:/hmg//include -iC:/classy -iC:/classy/
Please assist me to resolve the problem. If the parenthesis around cTitle are removed, the line also returns a "syntax error at 'CTITLE'"

Kindly assist.

Re: Alternate syntax

Posted: Tue Jan 26, 2010 2:39 pm
by Rathinagiri
Hi Gilbert,

In alternate syntax, a line can be broken to multiple lines only in the case of controls. Not in the case of windows, toolbar, tab and status bar.

So, you have to write,

Code: Select all

#include "minigui.ch"
#include "hbclass.ch"

FUNCTION main()
local cWindowName:="win_1"
local nRow:=0
local nCol:=0
local nWidth:=400
local nHeight:=200
local cTitle:="Hello world"

DEFINE WINDOW &cWindowName ROW nRow COL nCol WIDTH nWidth HEIGHT nHeight WINDOWTYPE MAIN TITLE cTitle
END WINDOW

ACTIVATE WINDOW &cWindowName
Return

Re: Alternate syntax

Posted: Tue Jan 26, 2010 2:43 pm
by karweru
Waoh!! It Works!!!

I have no words to thank you Rathi!

God bless you.