On Fri Nov 10, Chipp Walters chipp at chipp.com wrote:


OK Wilhelm.

How about this then,

on mouseUp
put the short name of the topStack into tStack
go inv stack "answer Dialog"
set the loc of stack "answer Dialog" to 200,200
show stack "Answer Dialog"
answer "Choose a color" with "red" or "green" or "blue"
set the defaultStack to tStack
set the backcolor of fld  1 to it
end mouseUp


That should solve your problem. Still quick and dirty. Oh, what if your
topStack is a palette, or even modal/non-modal??? Then don't use it, or hack
it further to accomodate.

I agree, the preferred way is to use one's own answer/ask dialogs, but
sometimes (as in when you are creating plugins for others to use inside
THEIR versions of Rev), you can't always count on your hacked versions being
'in play.'



Hi Chipp,

This works fine, of course. Playing around with a number of different solutions I had added "of stack "answertest"" to the line where the backcolor is set.

The situation will be slightly more complicated (but not much) when you have to use "globalloc" to place the "answer dialog" relative to a control of your stack, which is what I use the NewLoc property for most of the time. Using "set the loc of stack "answer dialog" to globalloc(tloc) would place the "answer dialog" relative to itself, not to the "calling" stack. You have here to compute globalloc *before* you set the loc of the dialog.

Let's compare two kinds of scripts, the first based on your solution above

"on mouseUp
put the short name of the topStack into tStack
put the loc of fld 1 into tloc
add 100 to item 2 of tloc # to place the dialog near to the field
put globalloc(tloc) into tloc
go inv stack "answer Dialog"
set the loc of stack "answer Dialog" to tloc
show stack "Answer Dialog"
answer "Choose a color" with "red" or "green" or "blue"
set the defaultStack to tStack
set the backcolor of fld  1 to it
end mouseUp"

Solution 2 using "NewLoc":

"on mouseUp
put the loc of fld 1 into tloc
add 100 to item 2 of tloc # to place the dialog near to the field
set the NewLoc of stack "answer Dialog" to globalloc(tloc)
answer "Choose a color" with "red" or "green" or "blue"
set the backcolor of fld  1 to it
end mouseUp"

That makes 10 script lines vs. 5, and you have to pay attention to more implications in the first script, which could therefore rather named a "slow" solution.

Of course, with the "NewLoc" variant, you need to add the two extra script lines before "end preopenstack" of the answer dialog script. But you do this only once for your Rev version, and once these two scriptlines are in place, you have the best of two worlds, being able to set the loc of the dialog with "NewLoc" any time you wish the short way, and at the same time - if you do not specify a NewLoc - having the answer dialog behave like it normally does.

Adding the two scriptlines is not too difficult, maybe my description of the process is rather detailed and needs some attention to be understood, but actually adding those lines should not take longer than 40 seconds - making it easy to quickly patch each new version of Revolution (in case the Rev team does not come up with a solution of their own).

Best regards,

Wilhelm

<http://www.sanke.org/MetaMedia>


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to