Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 GUI checkbox labels
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
guttface




PostPosted: Fri Feb 20, 2004 5:20 pm   Post subject: GUI checkbox labels

I'm making a program using GUIs and I was wondering if there was a way to detect the id of a checkbox which has been checked, as well as get the label associated with that checkbox. Thanks.
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Fri Feb 20, 2004 5:35 pm   Post subject: (No subject)

I don't even know GUI but I found this easily enough in the help file..... Rolling Eyes

code:

% The "GUI.CreateCheckBoxFull" program.
import GUI

procedure DoNothing (status : boolean)
end DoNothing

View.Set ("graphics:300;100,nobuttonbar")
var cb1 : int := GUI.CreateCheckBox (10, 10, "Check Box 1",
    DoNothing)
var cb2 : int := GUI.CreateCheckBoxFull (200, 10, "Check Box 2",
    DoNothing, GUI.RIGHT, '2')
GUI.SetCheckBox (cb2, true)
var quitBtn : int := GUI.CreateButton (230, 10, 0, "Quit", GUI.Quit)
loop
    exit when GUI.ProcessEvent
end loop
var cb1Status : boolean := GUI.GetCheckBox (cb1)
var cb2Status : boolean := GUI.GetCheckBox (cb2)
if cb1Status then
    put "Check box 1: filled"
else
    put "Check box 1: empty"
end if
if cb2Status then
    put "Check box 2: filled"
else
    put "Check box 2: empty"
end if
guttface




PostPosted: Fri Feb 20, 2004 5:50 pm   Post subject: (No subject)

i wasnt specific enough. this is my code. what i want to happen is when one of the checkboxes is checked, the label of that checkbox is added to the textbox on a new line. how do you do it?
code:
import GUI in "%oot/lib/GUI"
setscreen("graphics:600;600")

var item:array 1..5 of string:=init("Milk","Gum","Cheese","Butter","Eggs")
var box:array 1..5 of int
var textbox:int

procedure write(status:boolean)
%Here's where i'm trying to find the id of the checkbox that was checked %and write its label to the textbox using: GUI.AddLine(textbox,text:string)
end noth

for i1:1..5
box(i1):=GUI.CreateCheckBox(1,maxy-20*i1,item(i1),write)
end for

textbox:=GUI.CreateTextBox(0,0,500,200)

loop
exit when GUI.ProcessEvent
end loop
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: