Hi Friends,
I'm trying the following code and is returning syntax errors when compiled.
#include "minigui.ch"
FUNCTION main()
local cWindow:="win_1"
local nRow:=0
local nCol:=0
local nWidth:=400
local nHeight:=200
local cTitle:="Hello world"
local cWinType:="MAIN"
DEFINE WINDOW &cWindow
ROW &nRow
COL &nCol
WIDTH &nWidth
HEIGHT &nHeight
TITLE &cTitle
WINDOWTYPE &cWinType
END WINDOW
ACTIVATE WINDOW &cWindow
Return
Is there any way around this?
Thanks in advance.
Memory variables and alternate syntax
Moderator: Rathinagiri
- karweru
- Posts: 220
- Joined: Fri Aug 01, 2008 1:51 pm
- DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
- Contact:
Memory variables and alternate syntax
Kind regards,
Gilbert.
Gilbert.
- Roberto Lopez
- HMG Founder
- Posts: 4023
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Memory variables and alternate syntax
WIndow type is 'hard-coded' in the command definition, but for all other thing you can use variables (there is no need for macro).karweru wrote:Hi Friends,
I'm trying the following code and is returning syntax errors when compiled.
#include "minigui.ch"
FUNCTION main()
local cWindow:="win_1"
local nRow:=0
local nCol:=0
local nWidth:=400
local nHeight:=200
local cTitle:="Hello world"
local cWinType:="MAIN"
DEFINE WINDOW &cWindow
ROW &nRow
COL &nCol
WIDTH &nWidth
HEIGHT &nHeight
TITLE &cTitle
WINDOWTYPE &cWinType
END WINDOW
ACTIVATE WINDOW &cWindow
Return
Is there any way around this?
Thanks in advance.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- Alex Gustow
- Posts: 290
- Joined: Thu Dec 04, 2008 1:05 pm
- Location: Yekaterinburg, Russia
- Contact:
Re: Memory variables and alternate syntax
Hi Karweru!
And (in additional to Roberto's advice) - you must have MAIN window into your program (if you need any window(s) - except MsgInfo(), MsgStop()... etc.) (correct me, friends, if I'm wrong).
So add "MAIN" into DEFINE WINDOW (if this window really must be "main") and (if you want to define window's parameters programmatically) write something like this (again: if I'm wrong - correct me, friends):I think - it must work.
And (in additional to Roberto's advice) - you must have MAIN window into your program (if you need any window(s) - except MsgInfo(), MsgStop()... etc.) (correct me, friends, if I'm wrong).
So add "MAIN" into DEFINE WINDOW (if this window really must be "main") and (if you want to define window's parameters programmatically) write something like this (again: if I'm wrong - correct me, friends):
Code: Select all
function Main()
local nRow, nCol, nWidth, nHeight
nRow:=0
nCol:=0
nWidth:=600
nHeight:=400
Fun_1( nRow, nCol, nWidth, nHeight )
Return Nil
//---------
function Fun_1 ( nRow0, nCol0, nWidth0, nHeight0 )
define window Win_1 ;
at nRow0, nCol0 ;
width nWidth0 ;
height nHeight0 ;
MAIN ;
on init { || Fun_2(), Win_1.Release }
// ... here - other controls definition (if needed just here)
end window
Win_1.Center
Win_1.Activate
Return Nil
//---------
function Fun_2 ( )
// ...when main window activates - other work will starts from here...
// for example: you'll can define other conrols of this window here -
// depending on _actual_ sizes of window
// (you already know them at this moment!)
Return Nil
- karweru
- Posts: 220
- Joined: Fri Aug 01, 2008 1:51 pm
- DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
- Contact:
Re: Memory variables and alternate syntax
Thanks so much Roberto for the info. Alex, thanks too. I appreciate the details. Actually I started the experiment after stumbling onto ooHg, which is basically an object oriented minigui offshoot. I was of the opinion it is possible to create classes for the various controls around the alternate syntax, without calling _define* functions directly and without needing to use any other tool other than hmg.
As it now, anybody wanting to program in an oop way, would have to call _define* functions directly due to the 'hard coding' of some arguments.
All the same, thanks.
Warm regards.
As it now, anybody wanting to program in an oop way, would have to call _define* functions directly due to the 'hard coding' of some arguments.
All the same, thanks.
Warm regards.
Kind regards,
Gilbert.
Gilbert.
- Alex Gustow
- Posts: 290
- Joined: Thu Dec 04, 2008 1:05 pm
- Location: Yekaterinburg, Russia
- Contact:
Re: Memory variables and alternate syntax
Hi Karweru!
Try HWGUI too - it's OOP-library (MiniGUI is "Semi-OOP", as Roberto wrote).
Look at wiki about it - http://hwgui.altervista.org/doku.php
Try HWGUI too - it's OOP-library (MiniGUI is "Semi-OOP", as Roberto wrote).
Look at wiki about it - http://hwgui.altervista.org/doku.php
- karweru
- Posts: 220
- Joined: Fri Aug 01, 2008 1:51 pm
- DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
- Contact:
Re: Memory variables and alternate syntax
Hi Alex,
Thanks for the info but i'm in Hmg - for life! Hmg does not in any impede use of oop if one wanted to despite its' semi-oop implementation, which is also brilliant. I have actually been using it for more than an year but by calling _define* funtions directly. Maybe one day the master might enable calling the alternate syntax fully without the 'hard codings', but i believe this is not critical.
Thanks and cheers.
Thanks for the info but i'm in Hmg - for life! Hmg does not in any impede use of oop if one wanted to despite its' semi-oop implementation, which is also brilliant. I have actually been using it for more than an year but by calling _define* funtions directly. Maybe one day the master might enable calling the alternate syntax fully without the 'hard codings', but i believe this is not critical.
Thanks and cheers.
Kind regards,
Gilbert.
Gilbert.
- Alex Gustow
- Posts: 290
- Joined: Thu Dec 04, 2008 1:05 pm
- Location: Yekaterinburg, Russia
- Contact:
Re: Memory variables and alternate syntax
Hi Karweru,
I use HMG only too! I tried to use HWGUI in the beginning of my "Harbour life"
- 2 or 3 years ago - and found that MiniGUI is much better, friendly etc. But many people (in "comp.lang.xharbour" newsgroup and in other places) has different opinion (they want "full OOP" - but I'm not need it).
I use HMG only too! I tried to use HWGUI in the beginning of my "Harbour life"