Simple Window Manager

Share your scripts and packages with other Mudlet users.
icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: Simple Window Manager

Post by icesteruk »

Jor'Mox wrote:The parameters are all strings. They can be passed literally (with quotes around them) or as variables (which would not have quotes around them).

So you could do this:

name = "myLabel"
win_type = "label"
x = "10%"
y = "10%"
width = "20%"
height = "20%"
origin = "topleft"

windowManager.add(name,win_type,x,y,width,height,origin)
I been messing around with the above code and for the life in me, I cant seem to get it to work.. I guess I'm doing something wrong, I've put it both in a 'script' and Alias and nothing for either :/ ...

Jor'Mox
Posts: 1101
Joined: Wed Apr 03, 2013 2:19 am

Re: Simple Window Manager

Post by Jor'Mox »

Two things. First make sure you add the window manager script in somewhere. Second, window manager doesn't create objects (labels and the like), so you have to create the label before you add it to window manager.

icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: Simple Window Manager

Post by icesteruk »

I first did
Code: [show] | [select all] lua
createLabel("myLabel",0,0,0,0)
windowManager.add("myLabel","label", "10%", "10%", "20%", "20%", "topleft")
but that came back with errors..:/

Jor'Mox
Posts: 1101
Joined: Wed Apr 03, 2013 2:19 am

Re: Simple Window Manager

Post by Jor'Mox »

It shouldn't have. What errors did you get? I use it exactly like that all the time with no difficulty.

icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: Simple Window Manager

Post by icesteruk »

something about createLabel ...

<createLabel: wrong argument type>


(got it working now, I stole it from my other script heh)

Jor'Mox
Posts: 1101
Joined: Wed Apr 03, 2013 2:19 am

Re: Simple Window Manager

Post by Jor'Mox »

Ah, glad you got it working. Though I suppose I should throw in a create option in my script so it will make the object for you, so as to avoid complications, if someone prefers to do it that way.

icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: Simple Window Manager

Post by icesteruk »

(deleted this as I accidently clicked quote and not edit)
Last edited by icesteruk on Tue Sep 24, 2013 2:51 pm, edited 1 time in total.

icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: Simple Window Manager

Post by icesteruk »

Jor'Mox wrote:Ah, glad you got it working. Though I suppose I should throw in a create option in my script so it will make the object for you, so as to avoid complications, if someone prefers to do it that way.

I do have A question on the graphic side of it, Does it do rounded buttons and not 'square'? if that makes sense?

Also, when you click said button (with the setLabelClickCallback) is they a way to change the color of the button, just so you know you've clicked it so to speak?

One last question, You made the 'drop down menus' any way to convert that so, when you click it, it opens up a console? so you can say, have 2/3 buttons and each button does something different like button1 opens up your stats/affs button2 opens up chat window and button 3, does something else.

But I will make my system out of this as seems SOO easy plus does everything I would want as im not a fan of pictures in a system..

((DAMMIT I clicked quote and not edit, my bad))

Jor'Mox
Posts: 1101
Joined: Wed Apr 03, 2013 2:19 am

Re: Simple Window Manager

Post by Jor'Mox »

It can do anything that can be done in Mudlet. The window manager takes care of placement and sizing, but otherwise just stays out of the way. So if you want to make a label have rounded edges, just use the setLabelStyleSheet function, as you would normally. The same goes for literally any other functionality you can think of.

As for the menus, they are a collection of labels, organized in a handy manner to mimic a menu. I'm not sure if you are asking if you can make the already created menu buttons to open other objects (which is absolutely doable, just set a clickCallback for that button that calls a function doing whatever you want it to do), or if you want to have other things open instead of a regular menu, in which case it would be simpler to just create a label for each thing you want to do, and use setLabelClickCallback to call a function opening whatever you need to open.

Either way, yes. You can do all of those things.

icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: Simple Window Manager

Post by icesteruk »

Jor'Mox wrote:It can do anything that can be done in Mudlet. The window manager takes care of placement and sizing, but otherwise just stays out of the way. So if you want to make a label have rounded edges, just use the setLabelStyleSheet function, as you would normally. The same goes for literally any other functionality you can think of.

As for the menus, they are a collection of labels, organized in a handy manner to mimic a menu. I'm not sure if you are asking if you can make the already created menu buttons to open other objects (which is absolutely doable, just set a clickCallback for that button that calls a function doing whatever you want it to do), or if you want to have other things open instead of a regular menu, in which case it would be simpler to just create a label for each thing you want to do, and use setLabelClickCallback to call a function opening whatever you need to open.

Either way, yes. You can do all of those things.

I made buttons and I don't want to use a 'menu' I want it to call a console or something where my affs will be going/being sent too

I dont want to break the code heh its why I thought to ask as whenever I seem to try make it call forth a console I keep getting a error on line 76 where its defining the buttons.
Code: [show] | [select all] lua
                for k2, v2 in ipairs(v.button_names) do
Attachments
When you click on one of the buttons I want it to call forth a console..
When you click on one of the buttons I want it to call forth a console..
tester.png (2.8 KiB) Viewed 6107 times
Last edited by icesteruk on Tue Sep 24, 2013 3:19 pm, edited 2 times in total.

Post Reply