Page 1 of 1
placeholder for import snaphot
Posted: Mon Aug 17, 2009 1:25 pm
by emmefisch
I make an app where the user can make a snaphot from a screen region. With a transparent window, that only shows for corners, the user can place e. g. word on the right place, or the transparent window over the word-app. Then I want take the snaphot on this place. Any help? Thank you. (a newbie....

Fredi
Posted: Mon Aug 17, 2009 3:37 pm
by Klaus
Grüezi emmefisch
do you know that you do not necessarily need a "template" or "placeholder" for this?
If you just fire a:
...
import snapshot
## Without any parameter like above!
...
Then the cursor changes to "crosshair" and the user can drag a rect for the snapshot which will be imported then, or the user can hit "ESCAPE" and no snapshot is imported.
I do this in my projects:
...
hide stack "Mainstack"
hide stack "Substack
## etc... You can loop through all "visible" stacks if necessary...
import snapshot
### Now show all open stacks again:
show stack "Mainstack"
show stack "Substack"
...
So no stack is in the way for the user.
Maybed this is an option for you?
Best
Klaus
Klaus
Posted: Mon Aug 17, 2009 8:18 pm
by emmefisch
Hallo Klaus
Thanks for your help.
I know that "crosshair" cursor, but I want that the user always takes the snaphots in the same size e. g 800 x 600. So it would be nice to give him a placeholder region, where he can place the word-window.
Best regards, Fredi
Posted: Tue Aug 18, 2009 8:54 am
by Klaus
Grüezi Fredi,
aha, I see.
Hm, in that case you could:
1. Create a resizable stack "tUserRect". I colored it lightly red, looks nice

2. Set its blendlevel to 50 or whatever so it is partly transparent.
3. Put a button on it "Drag and resize this window and then click me"
4. Put this into the script of this button:
Code: Select all
on mouseup
set the dialogdata to the rect of this stack
close this stack
end mouseup
5. Call this stack whenever you want the user to define a rect on screen
...
modal stack "tUserRect"
put the dialogdata into the_users_rect_4_screenshot
## do whatever you wnat with the_users_rect_4_screenshot
...
6. Store this value for later use in a custom property or global variable or field or wherever
Get the picture? I do this in some of my projects and the users love it
Best
Klaus
Posted: Tue Aug 18, 2009 11:13 am
by SparkOut
Hi Klausimausi,
That's a good technique - I use something similar. Just a caution for Windows (I'm not sure how it works on Mac

) but if you hide the mainstack and the user switches another app to the front, then there is no taskbar icon to bring the focus back to the tUserRect stack.
So you might want to
Code: Select all
set the systemWindow of stack "tUserRect" to true
before calling it as a modal stack - that way it will stay floating above all windows even if the user switches focus to another app.
(Yes... they all want to do it, to get their programs into the right view/size/position before they take the snapshot)
Posted: Tue Aug 18, 2009 8:53 pm
by emmefisch
Hi
It's so wonderful in this forum. You have just wrote your question and one moment later you get the answers. Thank you guys, i think it was a good idea to change to revolution
After a while searching I know now what the dialogdata is

... and it funzt.
Posted: Wed Aug 19, 2009 3:27 am
by shadowslash
Welcome to the forum then...
