Page 1 of 1
stack as button
Posted: Fri Dec 21, 2012 10:05 pm
by RobertC
I want to make a standalone stack such that it runs a handler when the mouse is clicked in a button, even when the stack is NOT the currently active application.
Normally, to make a button do something the first click will activate the application and only the second will push the button.
Can I circumvent the activation click?
Robert.
Re: stack as button
Posted: Fri Dec 21, 2012 10:18 pm
by Simon
Instead of a button could you use resumeStack?
Simon
Re: stack as button
Posted: Sat Dec 22, 2012 4:46 am
by doc
Hey RobertC...
I can test only on Windows currently, but if I understand your question correctly and both O/S's function the same in this regard, then adding a card script like this seems to work:
Code: Select all
on mouseDown
if the clickLoc is within the rect of btn "NamedWhatever" then
send mouseUp to btn "NamedWhatever"
else
--- do something else, nothing at all or pass the message
end if
end mouseDown
HTH,
-Doc-
Re: stack as button
Posted: Sat Dec 22, 2012 5:12 am
by Mark
Hi Robert,
You could set the systemWindow of your stack to true.
Kind regards,
Mark
Re: stack as button
Posted: Sat Dec 22, 2012 5:38 am
by doc
Mark,
Out of curiosity, on a Mac isn't the z-order of a systemWindow always at the top level, blocking all other windows and dialogs from the same stack, just as it does with a Windows based app?
Regards,
-Doc-
Re: stack as button
Posted: Sat Dec 22, 2012 5:59 am
by dunbarx
The dictionary says that setting the systemWindow to "true" has no effect in OSX. This is not correct, and a note by WWaldman makes the point.
If you make a stack with a button that, say, puts a random number into msg, and set the systemwindow to "true", then that stack will float above all others, and even though the message box is hidden when another app is in front, clicking on the button will reveal a new number in msg when you return to LC.
So it seems that Mark's idea is the cleanest.
Craig Newman
Re: stack as button
Posted: Sat Dec 22, 2012 9:11 am
by RobertC
Thanks everyone for your most helpful replies. I'll try to give some comments:
First a little more background: with the advent of Lion the PPC emulator went and I lost Golive. I have for over a year now tried to get its functionality back, with little result. I now have to use a simple editor like BBEdit to write html, and have to do so in code!
Typing in markup is a real pain, but BBEdit is scriptable so I wrote a set of Applescripts to help. What I want now is a "palette" of buttons that sits next to the BBEdit window. Clicking a button on the palette should then result in the insertion of html markup into the BBEdit window, but (a) I don't want to click twice, and (b) after the click I want to be back in the BBEdit window.
(1) Simon's proposal to use resumestack works and solves the problem. Though it means that all I have at my disposal is the mouselock, so I then have to find out which button, but that is easy as Doc points out.
(2) Doc's proposal does not work at the first click however.
(3) Mark's proposal does not work. It is however useful as a tip because it floats the window, which I may or may not want, I have not decided yet.
(4) Dunbarx remark is correct: systemWindow does have an effect on OSX.
Using Simon's simple proposal the stack now works as follows:
-- the click runs the resumestack handler, since it activates the stack.
-- that handler then finds out where the click occurred and sends a message to the corresponding button.
-- the button then executes an applescript that makes BBEdit insert the relevant html markup using "tell application BBEdit...".
-- it is crucial that the applescript ends with the statement "activate" before the "end tell", so that BBEdit takes the focus again (and the stack goes into suspension. I could therefore also do something at suspendStack).
So I have what I want, thank you all again.
But I keep regretting the demise of Golive. I have tried Dreamweaver of course, but it is simply not up to the task.

Re: stack as button
Posted: Sat Dec 22, 2012 11:43 am
by shaosean
You can always try out SheepSaver to see if GoLive works for ya..
http://www.emaculation.com/forum/viewto ... d5e08b4861
Re: stack as button
Posted: Sat Dec 22, 2012 12:49 pm
by Mark
Hi,
Why doesn't my solution work? It does exactly what you want.
Kind regards,
Mark
Re: stack as button
Posted: Sat Dec 22, 2012 2:10 pm
by doc
So I have what I want, thank you all again.
...and since I've never used
resumeStack before, I have learned something new in your process.
Always a good thing.
Regards,
-Doc-
Re: stack as button
Posted: Sat Dec 22, 2012 4:31 pm
by dunbarx
Hi.
As Mark said, why not? The simple example I gave, where a message was sent to LC while one was in another app, ought to be expandable to any degree. It is as if LC was placing a universal palette over the entire desktop, the app in front not having any influence at all.
How did you test? How did it not work?
This property of LC seems FULL of possibilities, as one could be in excel, for example, and use a LC stack as access to functionality that uses that spreadsheet directly, perhaps by reading the excel data on the fly, but never leaving excel at all. It is as if LC is present at all times in any other application.
Craig Newman