Auto show/hide palette when app gains/loses focus
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Auto show/hide palette when app gains/loses focus
After a bit of searching, reading and even digging into the built-in rev stacks for a solution, I'm still at a loss.
I have my main stack and a few sub-stacks that get called as certain functions are processed. Above and beyond all else, I have 1 sub-stack, a search bar, that is currently a floating palette that moves with the main stack. It use to be a drawer .. but, well, I'm sure you know how that tends to turn out.
The problem I have is.. Since the palette floats above all else, it stays in front even when the app has lost focus or even minimized. I need a way to have the palette either hide itself automatically or change to another type that will not hinder the view when the app either has or has lost focus appropriately.
Does anyone know of a way to do this by chance? Any insight would be greatly appreciated.
I was also looking for a way to have the palette change to a different window type when it is in the dev environment so that it does not obscure the view while developing.
Regards!
I have my main stack and a few sub-stacks that get called as certain functions are processed. Above and beyond all else, I have 1 sub-stack, a search bar, that is currently a floating palette that moves with the main stack. It use to be a drawer .. but, well, I'm sure you know how that tends to turn out.
The problem I have is.. Since the palette floats above all else, it stays in front even when the app has lost focus or even minimized. I need a way to have the palette either hide itself automatically or change to another type that will not hinder the view when the app either has or has lost focus appropriately.
Does anyone know of a way to do this by chance? Any insight would be greatly appreciated.
I was also looking for a way to have the palette change to a different window type when it is in the dev environment so that it does not obscure the view while developing.
Regards!
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
A couple of things to check:
- is the stack really opened as a palette (sorry, had to ask) ?
- is the 'systemWindow' stack property by any chance set to 'true'?
- what is the 'style' property and the 'mode' property of the stack?
- what is the content of the 'hidePalettes' global property?
Don't worry, you've come to the right place - we'll get there
Jan Schenkel.
- is the stack really opened as a palette (sorry, had to ask) ?
- is the 'systemWindow' stack property by any chance set to 'true'?
- what is the 'style' property and the 'mode' property of the stack?
- what is the content of the 'hidePalettes' global property?
Don't worry, you've come to the right place - we'll get there

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
Dear Xeir,
You might want to read about the hidePalettes property, the iconyfyStack and the uniconifyStack messages in the docs.
Best,
Mark
You might want to read about the hidePalettes property, the iconyfyStack and the uniconifyStack messages in the docs.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Jan / Mark -
Both of you got me pointed in the right direction, thank you.
I had previously set the 'systemwindow' to true in one of my earlier attempts of trying to get the layout the way I wanted, and never set it back to false.
And I just found one of the other message I was looking for, 'environment' so that I can set the stack to change behavior appropriately.
The (un)iconifyStack stack messages I had been looking for to do some extra handling, so that answered one of my next questions.
Ah, just found the 'lock moves' command, I knew there was a way to get rid of the springiness in the window when I moved the stacks.
If you haven't guessed, multitasking is habit. Correcting one issue while still looking for answers to another, grin.
Have to say, I don't think I've ever felt like the proverbial 'kid in a candy store' when programming before. Well except when I first started perhaps.
Here's another question if I may as I've looked yet still not been able to find the bugger ...
Is there by chance a message for telling when an application has lost focus, no longer the active or frontmost app?
Appreciate the help, I knew there was a way to get the layout closer to the way I wanted.
Now to try and figure out why some data intermittently hides itself in 2 of my tables.
Thanks again!
Fred
Both of you got me pointed in the right direction, thank you.
I had previously set the 'systemwindow' to true in one of my earlier attempts of trying to get the layout the way I wanted, and never set it back to false.
And I just found one of the other message I was looking for, 'environment' so that I can set the stack to change behavior appropriately.
The (un)iconifyStack stack messages I had been looking for to do some extra handling, so that answered one of my next questions.
Ah, just found the 'lock moves' command, I knew there was a way to get rid of the springiness in the window when I moved the stacks.
If you haven't guessed, multitasking is habit. Correcting one issue while still looking for answers to another, grin.
Have to say, I don't think I've ever felt like the proverbial 'kid in a candy store' when programming before. Well except when I first started perhaps.
Here's another question if I may as I've looked yet still not been able to find the bugger ...
Is there by chance a message for telling when an application has lost focus, no longer the active or frontmost app?
Appreciate the help, I knew there was a way to get the layout closer to the way I wanted.
Now to try and figure out why some data intermittently hides itself in 2 of my tables.
Thanks again!
Fred
Hi Fred,
Usually, I set a custom property when the suspend or resume message is sent:
This way, I can always use the suspended custom property to determine whether the programme is the frontmost application.
(Normally, I start the name of a custom property with "c", but in some cases I prefer to mimic a native Revolution property, that's why I call it suspended instead of cSuspended)
Best,
Mark
Usually, I set a custom property when the suspend or resume message is sent:
Code: Select all
on suspend
set the suspended of this stack to true
pass suspend
end suspend
on resume
set the suspended of this stack to false
pass resume
end resume
(Normally, I start the name of a custom property with "c", but in some cases I prefer to mimic a native Revolution property, that's why I call it suspended instead of cSuspended)
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Here's what I used some time ago
This code is in my main stack script, and it works just fine for me, no custom properties or anything.
Code: Select all
on suspend
if field "LabelToolsStatus" of card "cardmgdmain" of stack "mgdmain" is 1 then
hide stack "mgdtools"
end if
if field "LabelPropsStatus" of card "cardmgdmain" of stack "mgdmain" is 1 then
hide stack "mgdprops"
end if
if field "LabelDesignStatus" of card "cardmgdmain" of stack "mgdmain" is 1 then
hide stack "designwindow"
end if
end suspend
on resume
if field "LabelToolsStatus" of card "cardmgdmain" of stack "mgdmain" is 1 then
show stack "mgdtools"
end if
if field "LabelPropsStatus" of card "cardmgdmain" of stack "mgdmain" is 1 then
show stack "mgdprops"
end if
if field "LabelDesignStatus" of card "cardmgdmain" of stack "mgdmain" is 1 then
show stack "designwindow"
end if
end resume
on iconifyStack
if field "LabelToolsStatus" of card "cardmgdmain" of stack "mgdmain" is 1 then
hide stack "mgdtools"
end if
if field "LabelPropsStatus" of card "cardmgdmain" of stack "mgdmain" is 1 then
hide stack "mgdprops"
end if
if field "LabelDesignStatus" of card "cardmgdmain" of stack "mgdmain" is 1 then
hide stack "designwindow"
end if
end iconifyStack
on unIconifyStack
if field "LabelToolsStatus" of card "cardmgdmain" of stack "mgdmain" is 1 then
show stack "mgdtools"
end if
if field "LabelPropsStatus" of card "cardmgdmain" of stack "mgdmain" is 1 then
show stack "mgdprops"
end if
if field "LabelDesignStatus" of card "cardmgdmain" of stack "mgdmain" is 1 then
show stack "designwindow"
end if
end unIconifyStack