Alternate syntax

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

Alternate syntax

Post 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.
Kind regards,
Gilbert.
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: Alternate syntax

Post 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
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

Re: Alternate syntax

Post by karweru »

Waoh!! It Works!!!

I have no words to thank you Rathi!

God bless you.
Kind regards,
Gilbert.
Post Reply