Computer Science Canada

textfields within a procedure

Author:  Naveg [ Wed Feb 23, 2005 9:47 pm ]
Post subject:  textfields within a procedure

How come textfields don't work in a procedure without an added processEvent inside? is there a way around this? example:

code:
procedure addItem
    cls
    counter := counter + 1
    new itemNames, (upper (itemNames) + 1)
    new itemPrices, (upper (itemPrices) + 1)
    ok := GUI.CreateButton (50, 200, 50, "OK", addItemScreen)
    nameField := GUI.CreateTextField (50, 350, 100, "", doNothing)
    nameLabel := GUI.CreateLabel (10, 350, "Name")
    priceField := GUI.CreateTextField (50, 300, 100, "", doNothing)
    priceLabel := GUI.CreateLabel (10, 300, "Price")
    priceReal := strreal (GUI.GetText (priceField))
    itemNames (upper (itemNames)) := GUI.GetText (nameField)
    itemPrices (upper (itemPrices)) := priceReal
end addItem


i need to be able to input text into the fields

Author:  Tony [ Thu Feb 24, 2005 11:04 am ]
Post subject: 

the way GUI class works is that processEvent() needs to be called to check if any of user actions interact with any of GUI elements.

in theory, you build up your GUI and then let the program run in an infinate loop

Turing:

loop
exit when GUI.processEvent()
end loop


: