FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

question dialog nested in a messagebox?

 
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac
View previous topic :: View next topic  
Author Message
Wooden Brain
Junior Member


Joined: 19 Jun 2005
Posts: 59

PostPosted: Thu Nov 03, 2005 8:00 am    Post subject: question dialog nested in a messagebox? Reply with quote

I remain a bit confused by all these pushing widgets in Salling 3.0.

Here's a specific thing I'm stuck on. I want to display some text as a message box, and then after the user hits ok show a yes / no dialog. i can do either of those things individually, but the responses to both are handled by a "process dialog ok" handler.

I assume that there can be only one "process dialog ok" in the script. But the yes/no dialog would have to be called within that, and there would need to be a way to know WHICH widget/dialog resulted in that handler being called. The process dialog ok handler takes an argument, but does that refer to the widget being pushed, or to the terminal, or .... doh i'm confused.

edit: off topic here, but suggestion -- allow use of 5 way nav on palm to scroll messagebox text fields up and down. problem -- if messagebox left too long without pressing OK, seems to get stuck, any keys then just beep. timeout option might also help.
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Nov 03, 2005 11:14 am    Post subject: Reply with quote

You're on the right track.

The widget passed into the "process dialog ok" handler is the widget being dismissed. All you need is an if/elseif construct to determine which widget sent the event. You can use the "name" property of the widget base class to identify widgets.

As for the other problem, are you connecting over Wifi by any chance?

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Wooden Brain
Junior Member


Joined: 19 Jun 2005
Posts: 59

PostPosted: Thu Nov 03, 2005 5:53 pm    Post subject: no luck Reply with quote

edit:

I got it to work. instead of using "tell a_terminal" with a_terminal defined as a global variable, withing the process ok handler, I use "tell terminal of a_dialog". It works, but the other way should work too. all of these widgets and terminals and such should be able to be global variables, not just their names or IDs. I'm not sure frankly how much of an improvement this new method is -- I think I liked the "mode" of 2.x better. But maybe I'm just not used to it yet. It seems to be a lot more advanced, though.

--WBC

original msg:

thx, jonas. no luck so far. first of all, i apparently can't use the name property of a widget to identify it, at least not without setting a name first. id seems better. but this still doesn't work. i get the first message ok, but not the follow up question. first of all, i apparently need to define global variables. second of all, what am i telling? if i tell a_terminal for the question dialog (assuming you have to tell the SAME terminal, defined globally), then I get a variable a_terminal is not defined error. If I leave out that tell block, surrounding the make question, then I get an NS ArgumentsWrong error.

global messid, questionid, a_terminal

using terms from application "SEC Helper"

on process invoke a_terminal
tell a_terminal
set the_widget to make new messagebox dialog
set messid to id of the_widget
set textual content of the_widget to messid
push the_widget
end tell

end process invoke

on process dialog ok the_dialog
set wi to id of the_dialog
if wi = messid then
show screen message ("ok to message")
tell a_terminal
set the_question to make new question dialog
set textual content of the_question to "Test yes no"
set questionid to id of the_question
push the_question
end tell
else if wi = questionid then
show screen message ("ok to question")
end if
end process dialog ok

on process dialog cancel the_dialog
show screen message "No/Cancelled"
end process dialog cancel

end using terms from

as for the other question, yes i'm using wifi.
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Nov 03, 2005 6:33 pm    Post subject: Reply with quote

Hi,

Global variables are potentially very bad if multiple terminals are connected to the same script. The way you describe doing it (the way that works) is exactly how it's to be done.

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group