% The "GUI.CreateTextFieldFull" program
import GUI
View.Set ("graphics:200;100,nobuttonbar")
var TextField : int % The Text Field IDs.
var answer,answer3,answer5 : string
var answer2,answer4,answer6 : int
var addressLabel := GUI.CreateLabelFull (45, 40, "Base_?:", 0, 0,
GUI.RIGHT, 0)
procedure AddressEntered (text : string)
GUI.SetSelection (TextField, 0, 0)
GUI.Quit
end AddressEntered
proc base10
cls
GUI.SetBackgroundColor (gray)
GUI.Refresh
var convert := GUI.CreateButton (52, 5, 100, "Convert", GUI.Quit)
TextField := GUI.CreateTextFieldFull (50, 40, 100, "",
AddressEntered, GUI.INDENT, 0, 0)
GUI.SetLabel (addressLabel, "Base_10")
loop
exit when GUI.ProcessEvent
end loop
GUI.Dispose (convert)
answer := GUI.GetText (TextField)
colorback (gray)
Text.Locate (maxrow - 1, 1)
put "Base_2: ", intstr (strint (answer), 0, 2)
put "Base_16: ", intstr (strint (answer), 0, 16)
end base10
proc base16
GUI.SetBackgroundColor (gray)
GUI.Refresh
var convert := GUI.CreateButton (52, 5, 100, "Convert", GUI.Quit)
TextField := GUI.CreateTextFieldFull (50, 40, 100, "",
AddressEntered, GUI.INDENT, 0, 0)
GUI.SetLabel (addressLabel, "Base_16")
loop
exit when GUI.ProcessEvent
end loop
GUI.Dispose (addressLabel)
answer3 := GUI.GetText (TextField)
colorback (gray)
Text.Locate (maxrow - 1, 1)
answer4 := strint (answer3, 16)
put "Base_10: ", answer4
put "Base_2: ", intstr (answer4, 0, 2)
end base16
proc base2
cls
GUI.SetBackgroundColor (gray)
GUI.Refresh
var convert := GUI.CreateButton (52, 5, 100, "Convert", GUI.Quit)
TextField := GUI.CreateTextFieldFull (50, 40, 100, "",
AddressEntered, GUI.INDENT, 0, 0)
GUI.SetLabel (addressLabel, "Base_2")
loop
exit when GUI.ProcessEvent
end loop
answer5 := GUI.GetText (TextField)
colorback (gray)
Text.Locate (maxrow - 1, 1)
answer6 := strint (answer5,2)
put "Base_10: ", answer6
put "Base_16: ", intstr (answer6,0,16)
end base2
GUI.Refresh
var binary : int := GUI.CreateButtonFull (1, 75, 0, "Binary",
base2, 0, '^D', true)
var decimal : int := GUI.CreateButtonFull (72, 75, 0, "Decimal",
base10, 0, '^D', true)
var hex : int := GUI.CreateButtonFull (150, 75, 0, "Hex",
base16, 0, '^D', true)
loop
exit when GUI.ProcessEvent
end loop
|