Re: /IUP/ Help needed with examples
- Posted by _tom (admin) Jan 07, 2016
- 2092 views
dr_can said...
I am trying a version of the Alert example:
-- Example 2 -- Alarm include gui/iup/iup.e constant reply = {"File saved sucessfully - leaving program", "File not saved - leaving program anyway", "Operation cancelled"} procedure main( sequence cmd = command_line() ) IupOpen( 0, {} ) integer b = IupAlarm("IupAlarm Example", "File not saved! Save it now?" ,"Yes" ,"No" ,"Cancel") -- Shows a message for each selected button printf(1, "The response is: %s", {reply[b]}) if getc(0) then end if IupMessage("Save File", reply[b]) IupClose() end procedure main()
Lines 14 & 15 are added to prove that b is correctly returned; why doesn't the IupMessage get invoked?
Try this:
include iup/iup.e constant reply = { "File saved sucessfully - leaving program", -- 1 "File not saved - leaving program anyway", -- 2 "Operation cancelled" -- 3 } IupOpen(NULL) integer b = IupAlarm( "IupAlarm Example", "File not saved! Save it now?", "Yes", "No", "Cancel" ) ? b -- 1 | 2 | 3 IupMessage( "Hello Message", reply[b] ) IupClose()
I can't explain, but I always remove lines of code until a program works.
_tom