|
From: Alain A. <ala...@wa...> - 2014-09-26 09:53:40
|
Le 21/09/2014 23:28, Alain Aupeix a écrit :
> After having tried and success to modify dbfview, just for the fun, to
> see if I was able to use hwgui, I tried to make my first program.
>
> I have use as base a.prg, and, if the beginning seems ok, I have some
> troubles about some points.
> I first must say that I was a clipper porgrammer, there is a very long
> time, and since, I ever have serious problem with object oriented
> programation, so be cool with me :)
>
> 1) I tried to put an image in background of my window like this:
>
> INIT WINDOW oMainWindow MAIN TITLE "Utilitaires de généalogie" ;
> AT ox,oy SIZE 844,381 //;
> BACKGROUND BITMAP cImageDir+"acte.png"
>
> No error, but no image (I tried also with a bmp file, and it doesn't
> work too
> I success using another way which isn't made for:
>
> @ 0,0 PANEL oBack SIZE 1250,381
> @ -30,0 OWNERBUTTON OF oBack ;
> SIZE 1250,381 ;
> BITMAP cImageDir+"acte.png" COORDINATES 0,0,0,0
ok, I use now
@xx,yy bitmap
and it's better
> 2) I haven't found how to create a status bar
>
> I have used this way, but nothing can be written from menu or buttons.
> So, is there a way to do it, and are menus or toolbars able to display
> something in the status bar ?
>
> // Status Bar
> @ 0,361 PANEL oStatus SIZE 0,20
>
> 3) is there a way not to allow to change window size ?
I reformulate:
Is there a way to block a window size change ?
> 4) I tried to use editbox, but I failed to keep the edited value.
>
> @ 20,10 SAY cText01 SIZE 510, 22
> @ 20,25 EDITBOX oEdit01 CAPTION orpath ;
> STYLE WS_DLGFRAME ;
> SIZE 510, 26 COLOR hwg_VColor("FF0000")
>
> 5) In this box (a few similar to the one in a.prg), I have two buttons:
> ok and cancel.
> How to know the clicked button ?
on click ?
> 6) My prog loaded an ini file (parameters) from within main function by
> calling a function called readinit()
> if the inifile is present where I test, no problem, values are talken in
> the inifile.
> If the inifile isn't present, I have an error. Here is how I done:
> --------------------------------------------------------------------------------------
> function main
>
> readinit()
> ...
> return nil
> ---------------------------------------------------------------------------------------
> function readinit
> if file(ini)
> read values, and set variables (which are declared memvar and public
> in main() )
> else
> set variables to default values
> // call of a function to edit values and create the inifile
> IniEdit()
> endif
>
> return nil
> ------------------------------------------------------------------------------------
> function IniEdit
>
> if file(GETENV("HOME")+"/harbour/ini/genetools.ini")
> inicontent=memoread(GETENV("HOME")+"/harbour/ini/genetools.ini")
> else
> qout(orpath)
> inicontent="[genetools]"+chr(10)+;
> "regpath="+orpath+chr(10)+;
> "gedpath="+ogpath+chr(10)+;
> "srcpath="+ospath+chr(10)+;
> "viewer="+oview+chr(10)+;
> "downloader="+oget+chr(10)+;
> "userstring="+ostring+chr(10)+;
> "pdftool="+optool+chr(10)+;
> "opentool="+oopen+chr(10)+;
> "gedtool="+ogtool+chr(10)+;
> "ad24="+oad24+chr(10)+;
> "ad27="+oad27+chr(10)+;
> "dec24="+odec24+chr(10)+;
> "dec27="+odec27+chr(10)
> endif
>
> @ 20,10 SAY cText01 SIZE 510, 22
> @ 20,25 EDITBOX oEdit01 CAPTION orpath ;
> STYLE WS_DLGFRAME ;
> SIZE 510, 26 COLOR hwg_VColor("FF0000")
> ......
> @ 200,660 LINE LENGTH 100
> @ 120,680 BUTTON "Ok" OF oModDlg ID IDOK ON CLICK {||UpdateIni()} ;
> SIZE 100, 32 COLOR hwg_VColor("FF0000")
> @ 280,680 BUTTON "Annuler" OF oModDlg ID IDCANCEL ;
> SIZE 100, 32
>
> ACTIVATE DIALOG oModDlg
> oFont:Release()
>
> // create the inifile
> memowrit(GETENV("HOME")+"/harbour/ini/genetools.ini",inicontent,.f.)
> // Call again Readinit to set the variables with new values after edition
> Readinit()
>
> return nil
> ---------------------------------------------------------------------------------------
> When the program returns in readinit() it crashes with a segmentation error
> When launching again, it's ok, so the error is when entering again in
> readinit()
> Is-it normal ?
> I think I can avoid it, by just giving a message to launch manually
> readinit() after
> returning in main(), and it won't crashes, but I thought it was better
> to do it automatically.
>
> 7) As a few variables are used in a few functions, I declare it as
> memvar and then public in main()
> It works, bet when building, I have warnings when using it.
>
> GeneTools.prg(513) Warning W0001 Ambiguous reference 'OGET'
> GeneTools.prg(514) Warning W0001 Ambiguous reference 'OSTRING'
> GeneTools.prg(515) Warning W0001 Ambiguous reference 'OPTOOL'
> GeneTools.prg(516) Warning W0001 Ambiguous reference 'OGTOOL'
> GeneTools.prg(517) Warning W0001 Ambiguous reference 'OAD24'
> ....
>
> Is-it normal or do I fail somewhere ?
> I noticed that in samples, there a also such warnings.
>
> Thanks for reading my complains, and to help me to progress in hwgui,
> which is really nice, and adapted to gnome desktops.
I guess it ought to be better to read documentation, but I haven' t
found one except a very old one which outdated
I need to use hwgui, as hbqt is really a pain
I also want to know how to use the debugger, and how to call it (I
suppose with altd(1) and altd() )
Thanks for your answer.
A+
--
------------------------------------------------------------------------
Alain Aupeix
http://jujuland.pagesperso-orange.fr/
http://pissobi-lacassagne.pagesperso-orange.fr/
------------------------------------------------------------------------
U.buntu 12.04 | G.ramps 3.4.8-1 | H.arbour 3.2.0dev (2014-09-09 22;51) |
HbIDE (Rev.316) | Five.Linux (r138) | Hw.Gui (2285)
------------------------------------------------------------------------
|