Scripting a Minimize button

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Scripting a Minimize button

Post by gyroscope » Thu Jun 26, 2008 7:23 pm

Hi, could anyone tell me please: is it relatively straightforward to script for my own Minimize button on a Mac?

Also (excusing my ignorance here... :wink:) what is the Windows alternative to Minimize and could that be scripted from a custom button as well?

:)

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Jun 26, 2008 7:26 pm

Hi gyroscope,

that's pretty easy:

Code: Select all

...
set the iconic of stack "xyz" to true
...
Crossplatform solution, of course :-)


Best

Klaus

New "bass" department:
http://www.major-k.de/bass

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Thu Jun 26, 2008 11:41 pm

Thank you Klaus, that seems straightforward enough! :)

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Sun Jun 29, 2008 9:32 pm

This works a treat when the Mac control/name/window bar (what is it's official name?!) is there, but as soon as I make the controls empty (i.e gone), the emulating minimize button doesn't work....

So I'm guessing the control bar has to be hidden for it to work; after trying different seaches in the dictionary, I couldn't find any answer to how to do this. Any help here please!

:)

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Mon Jun 30, 2008 11:13 pm

Hope its OK to bump this thread...
control/name/window bar (what is it's official name?!)
Title bar...tut!

Seriously, if anyone has an answer I'd appreciate this. I'm getting close, I think (but not close enough...)

Code: Select all

on preOpenStack
  set the decorations of this stack to "minimize"
  hide title
end preOpenStack
That doesn't work but I'm certain it can work as I've seen plugins with custom minimize, etc and no title bar showing...

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Sat Nov 22, 2008 3:51 pm

Hi, I've bumped this thread again....

In the five months that's passed, in my occasional Rev script trawlings, I still haven't discovered a way to script a minimize button without the title bar showing....

There's gotta be a way (to block buster... :wink:)

Seriously, if anyone could tell me this quite straightforward scripting, I'm certain, I'd be reeeelly grateful....

:)

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Sat Nov 22, 2008 4:35 pm

You must be about my generation there gyro!

I don't have a Mac so I can't guarantee this works in that environment (and I know there are some quirks about iconic display generally).

On Windows XP this seems to work for me:

Given a stack with the decorations set to empty, and a custom "title" bar or "controls area" you can:

Code: Select all

--in the stack script

on uniconifyStack
  set the decorations of this stack to empty
end uniconifyStack

Code: Select all

--in the minimise button script

on mouseUp
  lock screen --I still see a momentary animation of the window frame shrinking to the taskbar even so
  set the decorations of this stack to Title --or default
  set the iconic of this stack to true
end mouseUp

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Sat Nov 22, 2008 5:31 pm

Hi SparkOut
You must be about my generation there gyro!
They were the days! (Or not, depending how you look at it... :wink: )

Thanks for your info but unfortunately it's not quite what I'm after: the iconic of the stack only seems to works if the title bar is showing but I don't want the title bar to show at all; but still want to iconify/collapse the window...

:?

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Sat Nov 22, 2008 5:51 pm

so maybe you're after this?

Code: Select all

on mouseUp
  set the iconic of this stack to true
end mouseUp
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Sat Nov 22, 2008 6:16 pm

Still no joy there, BvG but thanks still.

Perhaps I've confused people; I'll explain a bit better:

Make a new stack. This stack has a title bar as default. Put a button on it with the script you and Klaus suggested. Click the button and it works just fine. So far so good...

I go to the Controls on the stack inspector and make the title bar empty (or make it empty via script). The title bar disappears, as I want.

Click the button again....and nothing happens. It seems that the prerequisite of the "set the iconic" script to work is that the title bar is showing. But I don't want the title bar showing!!

But there must be a way, because I've seen Rev plugins with no title bar but the minimize button works (I can't inspect the script of any of these because they are locked somehow...)

Aayeee!! (As they say in Batman comics....er, perhaps)

:?

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Sat Nov 22, 2008 7:00 pm

SparkOut, apologies here....I was getting so flustered about this I didn't read your script properly; it works pretty much as I need; (I put in unlock screen as well into your code); on the Mac there seems to be the same flashing before it goes to the Dock and after it's opened from the dock though but it's the closest yet...

Thank you!

:)

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Sat Nov 22, 2008 8:16 pm

Judge: Did you, or did you not, try the stack with a custom window shape so that the title bar would be still active but not showing and so that the custom button to minimize should work?

Me: Yes, I tried this about 5 months ago, your honor blackman, but the custom button didn't work.

Judge: I see. And have you repeated this process?

Me: Yes, about ten minutes ago, real time.

Judge: Don't get funny with me, gyroscope or whatever you're called...did it work this time?

Me: Yes, it did.

Judge: Case dismissed!

:lol:

Post Reply