Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
37
Task/User-input-Graphical/Phix/user-input-graphical.phix
Normal file
37
Task/User-input-Graphical/Phix/user-input-graphical.phix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
include pGUI.e
|
||||
|
||||
Ihandle dlg, label1, input1, label2, input2, OK, Cancel
|
||||
|
||||
function ok_cb(Ihandle self)
|
||||
if self=OK then
|
||||
string in1 = IupGetAttribute(input1,"VALUE")
|
||||
integer in2 = IupGetInt(input2,"VALUE")
|
||||
string msg = sprintf("\"%s\" and %d",{in1,in2})
|
||||
IupMessage("You entered",msg)
|
||||
-- (return IUP_CONTINUE if unhappy with input)
|
||||
end if
|
||||
return IUP_CLOSE
|
||||
end function
|
||||
|
||||
function esc_close(Ihandle /*ih*/, atom c)
|
||||
return iff(c=K_ESC?IUP_CLOSE:IUP_CONTINUE)
|
||||
end function
|
||||
|
||||
IupOpen("demo/pGUI/")
|
||||
label1 = IupLabel("Please enter a string")
|
||||
input1 = IupText("VALUE=\"a string\", EXPAND=HORIZONTAL")
|
||||
label2 = IupLabel("and the number 75000")
|
||||
input2 = IupText("VALUE=75000, EXPAND=HORIZONTAL")
|
||||
IupSetAttribute(input2,"MASK",IUP_MASK_INT)
|
||||
OK = IupButton("OK", "ACTION", Icallback("ok_cb"))
|
||||
Cancel = IupButton("Cancel", "ACTION", Icallback("ok_cb"))
|
||||
dlg = IupDialog(IupVbox({IupHbox({label1,input1},"ALIGNMENT=ACENTER, PADDING=5"),
|
||||
IupHbox({label2,input2},"ALIGNMENT=ACENTER, PADDING=5"),
|
||||
IupHbox({IupFill(),OK,Cancel,IupFill()},"PADDING=15")},
|
||||
"GAP=5,MARGIN=5x5"))
|
||||
IupSetAttribute(dlg,"TITLE","User Input/Graphical")
|
||||
IupSetCallback(dlg, "K_ANY", Icallback("esc_close"))
|
||||
IupDestroy(IupNormalizer({OK,Cancel},"NORMALIZE=BOTH"))
|
||||
IupShow(dlg)
|
||||
IupMainLoop()
|
||||
IupClose()
|
||||
Loading…
Add table
Add a link
Reference in a new issue