Computer Science Canada

How To Do Buttons??

Author:  KLT_27 [ Tue Jan 20, 2004 11:56 am ]
Post subject:  How To Do Buttons??

Hey everyone I'm obviously a newbe but I was wondering if i could get help on GUI button making. I'm not sure how to do them and I really need help. If anyone could help that would be so so great Very Happy

Author:  Dan [ Tue Jan 20, 2004 8:34 pm ]
Post subject: 

if you have the new turing update (4.0.5) they added a tutorial on the turing GUI in the docmuamtaion. also i bivle there is info in some of the older turing 4 verson on the GUI with examples.

the basicks are you need a loop like this to run while you whont the buttions to work

code:

loop
    exit when GUI.ProcessEvent
end loop


and each buttion needs a procedure to go to when cliked.


ex code from turing doc:
code:

% The "Hello" program.
import GUI

View.Set ("graphics:200;200") % Shrink the run window

% The procedure called when the button is pushed.
procedure PutHello
    put "Hello"
end PutHello

% Create the button. The number returned is the ID number of the button.
var b : int := GUI.CreateButton (100, 100, 0, "Say Hello", PutHello)

% Now process events until the user aborts the program.
loop
    exit when GUI.ProcessEvent
end loop


you need to import the GUI b/c it is not inculed in the ruing coamnds by deufalt.

the comand to make a buttion gose like this:

GUI.CreateButton (x, y, width : int, text : string, actionProc : procedure x ()) : int


: