Page 1 of 2

Z Level question. You'd think LC would have this built in...

Posted: Sat Feb 09, 2013 7:58 pm
by ThatOneGuy
I need one of my stacks to stay on bottom-most z level (right on the desktop). Right now I am using the default, which puts it at top whenever focused and allows it to wander through levels when not focused. I don't mind it wandering down levels; it's when it goes to the top that I have problems. It's a little annoying when this stack covers other windows and makes it impossible to get to them without needing to use the window switcher every time (yes, I am using Windows). There is no options for this in the window settings in LiveCode and I can't find any code that would do this for me, only an option to put at topmost z level, which is the opposite of what I am looking for. You'd think they would have included an option to keep the window at the bottom instead of the top, but I guess they overlooked that half of the settings. Maybe they just assumed that nobody would have a reason to use it.

I have already looked most everywhere for a solution, but nobody has one that works.

If anyone has anything that would prevent a stack from going up in z level when focused, it would be much appreciated.

Re: Z Level question. You'd think LC would have this built i

Posted: Sat Feb 09, 2013 8:11 pm
by sturgis
Set all your stacks to palette except the one you always want to be behind. Can't work on them in that mode.

to change a stack to palette mode
palette stack "stackname"

to change back to a mode where you can edit and change the controls and scripts

toplevel stack "stackname"

Re: Z Level question. You'd think LC would have this built i

Posted: Sun Feb 10, 2013 2:26 pm
by shaosean
You can easily write an external to control the Z-level..

Re: Z Level question. You'd think LC would have this built i

Posted: Sun Feb 10, 2013 3:07 pm
by Klaus
No, I can't :D

Re: Z Level question. You'd think LC would have this built i

Posted: Mon Feb 11, 2013 5:57 am
by shaosean
Then you aren't trying ;-)

Re: Z Level question. You'd think LC would have this built i

Posted: Mon Feb 11, 2013 1:28 pm
by Klaus
Did you try to hold your breath for 60 minutes? 8)

Re: Z Level question. You'd think LC would have this built i

Posted: Mon Feb 11, 2013 5:20 pm
by ThatOneGuy
shaosean wrote:You can easily write an external to control the Z-level..
I've already looked through some options for externals, but I couldn't find anything that works with my current program. Do you have any suggestions of some external option to force z leveling of my window? I think there's some small scripts that could do it, but I can't find them.

Of course, it would be best if it was automatic so that I don't need to wait for the external to cycle each time. It would take only a fraction of a second, but it would cause a noticeable window flash every time I change windows.

Since I can't force the z level of non internal windows, forcing every other stack to top will not help very much. Other programs will still disappear behind mine.

Re: Z Level question. You'd think LC would have this built i

Posted: Mon Feb 11, 2013 9:46 pm
by mwieder

Code: Select all

Since I can't force the z level of non internal windows, forcing every other stack to top will not help very much. Other programs will still disappear behind mine.
Er... that's the way Windows is supposed to work.
Try iconizing the stack. That will get it out of your way.

Re: Z Level question. You'd think LC would have this built i

Posted: Wed Feb 13, 2013 3:05 am
by shaosean
I will write you one tonight..

Re: Z Level question. You'd think LC would have this built i

Posted: Wed Feb 13, 2013 11:19 pm
by shaosean
Sorry for the delay, just having a heck of time with Windows and Visual Studio but everything looks like it should be sorted out now, so will write it tonight for you..

Re: Z Level question. You'd think LC would have this built i

Posted: Thu Feb 14, 2013 11:13 pm
by ThatOneGuy
mwieder wrote: Er... that's the way Windows is supposed to work.
Try iconizing the stack. That will get it out of your way.
Iconizing the stack would only minimize it. I never said I wanted it minimized, just behind everything.
I'm trying to get this one particular window to ignore focusing when selected. That's all.

Re: Z Level question. You'd think LC would have this built i

Posted: Sat Feb 16, 2013 10:58 am
by shaosean
k.. either something is broken in windows or in rev, but i am over it.. if anyone here can actually build windows externals, the code to do the z-ordering is simple as MS has a command SetWindowPos which allows you to set the z-order.. i had written an external a couple decades back that gave Windows Rev the "always on top" feature, so i know the code works..

Re: Z Level question. You'd think LC would have this built i

Posted: Sat Feb 16, 2013 3:05 pm
by FourthWorld
Is this for a kiosk? If so, this can easily be done from LiveCode on Linux with wmctrl installed. If not, why do you want that window to ignore the user's selection of it?

Re: Z Level question. You'd think LC would have this built i

Posted: Sun Feb 17, 2013 8:22 am
by shaosean
This is the code that I was trying to get to compile (this is a quick rewrite as I am on my Mac again)..

Code: Select all

#include <stdlib.h>
#include <math.h>
#include <Windows.h>
#include <revolution/external.h>



void ssAlwaysOnBottom(char *p_arguments[], int p_argument_count, char **r_result, Bool *r_pass, Bool *r_err) {
	*r_err = True;
	*r_pass = False;

	// check the parameter count
	if (p_argument_count != 1) {
		*r_result = strdup("err: incorrect number of parameters.");
		goto Done;
	}

	// check the parameter to see if it is a valid windowID
	HWND tWindowID = (HWND)atoi(p_arguments[0]);
	if (!IsWindow(tWindowID)) {
		*r_result = strdup("err: invalid window");
		goto Done;
	}

	// try to move the window to the back
	if (SetWindowPos(tWindowID, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING | SWP_NOSIZE)) {
		*r_err = False;
		goto Done;
	} else {
		*r_result = strdup("err: unable to set the window to always be on the bottom");
		goto Done;
	}

Done:
	return;
}  // end ssAlwaysOnBottom


EXTERNAL_BEGIN_DECLARATIONS("sszorder")
	EXTERNAL_DECLARE_COMMAND("ssAlwaysOnBottom", ssAlwaysOnBottom)
EXTERNAL_END_DECLARATIONS

Re: Z Level question. You'd think LC would have this built i

Posted: Sun Apr 07, 2013 9:52 pm
by ThatOneGuy
Thanks for the replies. I will try to use this external.