|
Post by joreveur on May 8, 2015 17:49:18 GMT 1
Hi
INCLUDE "/usr/share/BaCon/hug.bac" REM INCLUDE "/usr/share/BaCon/hug.bac",WINDOW,MARK,BUTTON;ATTACH;CALLBACK,DISPLAY,MOUSE REM INIT Form1 = WINDOW("Hello with Bacon", 640, 480 ) REM Form1 = backcolor("green") Label1 = MARK( "Hello World from joreveur",200, 30 ) Button1 = BUTTON( "Say Hello", 80, 25) Button2 = BUTTON( "Quit", 80, 25)
ATTACH( Form1,Label1, 40, 20 ) ATTACH( Form1, Button1, 40, 60 ) ATTACH( Form1, Button2, 40, 90 )
REM CALLBACK( Button1,MSGBOX("Hello Word !")) CALLBACK( Button2,QUIT )
DISPLAY
3 Questions please
I try to buid my fisrt graphic program...
1) What the INIT instruction ?
2) How to paint my form in green ?
3) When I clik on Button1 how to show "Hello" in a window ? (MsgBox ? ShowMessage, Alert ? )
Best regards
|
|
|
Post by alexfish on May 8, 2015 18:31:56 GMT 1
Hi joreveur & Welcome to the Forum. One possible place to start is HEREhope U find it useful. Have also Bumped Same Thread. BR Alex
|
|
|
Post by Pjot on May 9, 2015 8:18:25 GMT 1
Hi Joreveur, Please check out the link from Alex, it contains a lot of information. Below a small demonstration to help you on your way. Note that INIT is only needed in case you selectively include functions from the HUG context, or when you import functions from the shared object. It initializes the graphical environment based on GTK. BR Peter INCLUDE "hug.bac", INIT, WINDOW, MARK, ATTACH, DISPLAY, SHOW, HIDE, MSGDIALOG, CALLBACK, BUTTON
INIT
SUB Show_dlg
SHOW(mydlg)
END SUB
SUB Hide_dlg
HIDE(mydlg)
END SUB
win = WINDOW("Small demo", 400, 200)
mydlg = MSGDIALOG("Hello world", 300, 100, 0, 2) CALLBACK(mydlg, Hide_dlg)
btn = BUTTON("Click here", 100, 100) ATTACH(win, btn, 50, 50) CALLBACK(btn, Show_dlg)
DISPLAY
|
|
|
Post by joreveur on May 13, 2015 7:36:01 GMT 1
Thanks you very much. I begin to understand how works Bacon. My first tries are good when I use forms, buttons and other objects.
How to mark "solved"? for the ticket?
Best regards
|
|