Re: /IUP/ Help needed with examples

new topic     » goto parent     » topic index » view thread      » older message » newer message
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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu