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

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

ThatOneGuy
Posts: 77
Joined: Fri Jan 04, 2013 9:57 am

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

Post by ThatOneGuy » Sat Feb 09, 2013 7:58 pm

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.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

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

Post by sturgis » Sat Feb 09, 2013 8:11 pm

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"

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

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

Post by shaosean » Sun Feb 10, 2013 2:26 pm

You can easily write an external to control the Z-level..

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

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

Post by Klaus » Sun Feb 10, 2013 3:07 pm

No, I can't :D

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

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

Post by shaosean » Mon Feb 11, 2013 5:57 am

Then you aren't trying ;-)

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

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

Post by Klaus » Mon Feb 11, 2013 1:28 pm

Did you try to hold your breath for 60 minutes? 8)

ThatOneGuy
Posts: 77
Joined: Fri Jan 04, 2013 9:57 am

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

Post by ThatOneGuy » Mon Feb 11, 2013 5:20 pm

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.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

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

Post by mwieder » Mon Feb 11, 2013 9:46 pm

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.

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

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

Post by shaosean » Wed Feb 13, 2013 3:05 am

I will write you one tonight..

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

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

Post by shaosean » Wed Feb 13, 2013 11:19 pm

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..

ThatOneGuy
Posts: 77
Joined: Fri Jan 04, 2013 9:57 am

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

Post by ThatOneGuy » Thu Feb 14, 2013 11:13 pm

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.

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

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

Post by shaosean » Sat Feb 16, 2013 10:58 am

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..

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10058
Joined: Sat Apr 08, 2006 7:05 am
Contact:

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

Post by FourthWorld » Sat Feb 16, 2013 3:05 pm

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?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

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

Post by shaosean » Sun Feb 17, 2013 8:22 am

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

ThatOneGuy
Posts: 77
Joined: Fri Jan 04, 2013 9:57 am

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

Post by ThatOneGuy » Sun Apr 07, 2013 9:52 pm

Thanks for the replies. I will try to use this external.

Post Reply