38 lines
1.0 KiB
Plaintext
38 lines
1.0 KiB
Plaintext
include pGUI.e
|
|
|
|
Ihandle txt, increment, random, hbx, vbx, dlg
|
|
|
|
function action_cb(Ihandle /*ih*/, integer ch)
|
|
if not find(ch,"0123456789-") then return IUP_IGNORE end if
|
|
return IUP_CONTINUE
|
|
end function
|
|
|
|
function increment_cb(Ihandle /*ih*/)
|
|
integer v = IupGetInt(txt,"VALUE")+1
|
|
IupSetInt(txt,"VALUE",v)
|
|
return IUP_CONTINUE
|
|
end function
|
|
|
|
function random_cb(Ihandle /*ih*/)
|
|
if IupAlarm("Confirm","Replace wth random value?","Yes","No")=1 then
|
|
IupSetInt(txt,"VALUE",rand(1000))
|
|
end if
|
|
return IUP_CONTINUE
|
|
end function
|
|
|
|
function esc_close(Ihandle /*ih*/, atom c)
|
|
return iff(c=K_ESC?IUP_CLOSE:IUP_CONTINUE)
|
|
end function
|
|
|
|
IupOpen()
|
|
txt = IupText(Icallback("action_cb"),"EXPAND=YES")
|
|
increment = IupButton("increment",Icallback("increment_cb"))
|
|
random = IupButton("random",Icallback("random_cb"))
|
|
hbx = IupHbox({increment,random},"MARGIN=0x10, GAP=20")
|
|
vbx = IupVbox({txt,hbx},"MARGIN=40x20")
|
|
dlg = IupDialog(vbx)
|
|
IupSetCallback(dlg, "K_ANY", Icallback("esc_close"))
|
|
IupShow(dlg)
|
|
IupMainLoop()
|
|
IupClose()
|