[Feature Request] Element layering controls

Post Reply
Sanaki
Posts: 110
Joined: Wed Mar 09, 2011 1:30 am

[Feature Request] Element layering controls

Post by Sanaki »

Primarily for use with labels and miniconsoles, even something as simple as a function to move a window to the top would be extremely useful. While normally this can be accomplished through careful ordering of the window creation, some of the more complex scripts I've been working with lately have brought me to understand that this isn't always as feasible as I'd initially hoped.

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: [Feature Request] Element layering controls

Post by chris »

Couldn't you accomplish this by keeping track of your widgets and using show/hide?

User avatar
Omit
Posts: 190
Joined: Sun Aug 01, 2010 10:54 pm
Location: Middle Earth
Contact:

Re: [Feature Request] Element layering controls

Post by Omit »

Showing and Hiding a label does NOT change where/what layer it is redered on. It is very usefull to be able to change what layer a label/image is displayed. There are always other ways of dealing with an issue but without the ability to move an object to the top/bottom duplicate labels may be needed. (a lot of this depends on what you are trying to accomplish but it IS a good idea to add this functionality as long as it can be done without breaking anything.)

Just my 2 cents.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: [Feature Request] Element layering controls

Post by Vadi »

Being able to change the z-index of things would help a lot, especially if you could move the main display above other things.

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: [Feature Request] Element layering controls

Post by chris »

This is what I mean:
make a table, call it labelOrder, indexed by priority. Store your labels inside here and make functions that will hide/show until a given index, show only a given index, etc. Qt doesn't have a priority system in place for QLabels, so I don't see this being something added when there is a way to do it in lua.

Sanaki
Posts: 110
Joined: Wed Mar 09, 2011 1:30 am

Re: [Feature Request] Element layering controls

Post by Sanaki »

So far the way I'm handling it is having multipurpose labels, miniconsoles, etc. Rather than having designated ones for each script, I have my scripts tell the handler function what it wants, and that function keeps track of the order in which the various elements were created and repurposes them or creates new ones as need be to accomplish what I'm going for. Does it work? Certainly. Being able to change the order somehow would still make it a hell of a lot easier and help reduce some bloat. Granted though, if it's not possible, it's not possible, and that's that.

EDIT: While I don't personally tend to need to change the main window's position, that is one thing I can't do the way I've been handling it.

User avatar
Oneymus
Posts: 321
Joined: Thu Sep 17, 2009 5:24 am

Re: [Feature Request] Element layering controls

Post by Oneymus »

Vyzor (shameless plug) handles z-ordering through a hierarchy of parent->child relationships. Essentially, Vyzor draws in the right order to ensure later labels are on top.

I have an earlier version of Vyzor in which z-layering was handled explicitly (here); you would set this value on the Element object much like x, y, width, and height. The most relevant bit is at the top, but I left the rest of the function in case someone found it useful. Keep in mind, that's an old, not very good version of Vyzor.

Unfortunately, the only interface Mudlet provides for Labels post-creation is a string for things like moving and resizing. So even with either version of Vyzor, you are locked into z-layering once you've drawn the labels.

Sanaki
Posts: 110
Joined: Wed Mar 09, 2011 1:30 am

Re: [Feature Request] Element layering controls

Post by Sanaki »

I'll admit up front I know absolutely nothing about QT. I've never worked with it, I've only used programs and scripts that make use of it. Having said that...

From what you said I'm assuming Mudlet's labels are QLabels. From what I can tell, those appear to be child elements of QWidgets, with which you can make use of the raise(), lower(), and stackUnder() functions to pull off what we're talking about. I'm entirely confident I'm missing some important detail here, but if not, can this be used somehow to give us z-axis control?

Thanks in advance for accepting the blithering of a man who's never dabbled in the things he speaks of.

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: [Feature Request] Element layering controls

Post by chris »

I'll check it out. Routing lua to the c++ function is pretty simple and I only looked at QLabel, not what it inherits. Also, you can edit luaglobal and the Geyser files in lua to add abstract features such as collision detection and priority support.

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: [Feature Request] Element layering controls

Post by chris »

The raise,lower, etc events only work for widgets which are siblings of eachother. The createLabel method doesn't give any notion of a sibling between labels within a given container either. I'm going to say the fastest way to get this feature in is to put it inside luaglobal in lua with something similar to what I described above. You could have generic functions such as:
registerLabel(labelname, container, z)
renderZ(container, z)
and so on
which can then layer labels appropriately.

Post Reply