News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
Response from Message Box
Author Message
ceeuu
Junior Member
**


Posts: 9
Group: Registered
Joined: Jul 2008
Status: Offline
Reputation: 0
Post: #1
RE: Response from Message Box

Here is a little example to see what I am trying to do.. The code doesn't run without the return at the bottom of the function (or similar).. what I would want is to somehow block on the call to the function until a button is pressed, or a return statement is encountered...


function displayMsg( msg )
do
local object = fltk:Fl_Double_Window( 200, 110, "Message" );
msg_window = object;
msg_window:box( fltk.Fl_UP_BOX );
do msg_box = fltk:Fl_Box( 15, 15, 170, 40, msg );
msg_box:box( fltk.FL_DOWN_BOX );
end
do continue_button = fltk:Fl_Button( 15, 70, 70, 24, "Continue" );
continue_button:callback(
function( button_cb )
print( "Continue button Selected" );
msg_window:hide();
return 1;
end )
end
do cancel_button = fltk:Fl_Button( 130, 70, 55, 24, "Cancel" );
cancel_button:callback(
function( button_cb )
print( "Cancel button Selected" );
msg_window:hide();
return 2;
end )
end
end
msg_window:show();
-- execution falls through and returns to calling code,
-- how to remain in function until button is pressed ???
-- adding a return here to allow sample code to work...
return 3;
end

do
local object = fltk:Fl_Double_Window( 220, 200, "Msg Test" );
main_window = object;
main_window:box( fltk.Fl_UP_BOX );
do my_button = fltk:Fl_Button( 160, 160, 50, 25, "Push" );
my_button:callback(
function( button_cb )
print( "button press.." );
print( "calling displayMsg.." );
rc = displayMsg( "Continue or Not?" );
print( "return from displayMsg.." );
print( "return code: "..rc );
end )
end
end

main_window:show();
Fl:run();

07-30-2011 03:04 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
Response from Message Box - ceeuu - 07-29-2011, 06:24 AM
RE: Response from Message Box - mikshaw - 07-30-2011, 12:15 AM
RE: Response from Message Box - ceeuu - 07-30-2011 03:04 AM
RE: Response from Message Box - mikshaw - 07-31-2011, 01:11 AM
RE: Response from Message Box - ceeuu - 07-31-2011, 11:09 AM
RE: Response from Message Box - roydobbins - 08-05-2011, 11:37 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: