So, just so I can be clear about what you are trying to do here:
You created a label, and you want to click on the label, and have it open a console, or something else, which will be used by other stuff. Yes? Do you want it positioned in the same way that the menu buttons are positioned, or just made visible when you click the button?
Simple Window Manager
Re: Simple Window Manager
made visable but use the scripts positioning...
basically I posted a pic on the other post, I want a console to open below the botton(s) .... which I can edit..
With the script it keeps asking about v.button stuff so I'm a little confused
basically I posted a pic on the other post, I want a console to open below the botton(s) .... which I can edit..
With the script it keeps asking about v.button stuff so I'm a little confused
Re: Simple Window Manager
The positioning logic for just one object is really easy. It is only moderately complicated for a whole menu, but enough so that I made something to do the math for you.
Your best strategy is to must make a normal label. Position and style it as you prefer. Then add a clickCallback to that label to display the console you want to display. Since you can retrieve the position and size info for a GUI object from windowManager, you can have it grab the info for the label you are clicking when it is clicked, so that your console can use those values to determine what position it should be in.
Your best strategy is to must make a normal label. Position and style it as you prefer. Then add a clickCallback to that label to display the console you want to display. Since you can retrieve the position and size info for a GUI object from windowManager, you can have it grab the info for the label you are clicking when it is clicked, so that your console can use those values to determine what position it should be in.
Re: Simple Window Manager
By the way, I just updated the front script to include a windowManager.create function. So you can use that instead of the windowManager.add function, and it will create the object for you, if you prefer.
Re: Simple Window Manager
This should do something like what you are talking about.
Re: Simple Window Manager
So, the code I put up before had a bit of an error with it... I just changed it to fix it (I forgot you can't pass a function directly to setLabelClickCallback).
Re: Simple Window Manager
I have added "autowrap" windows to the Simple Window Manager, which are miniConsole windows that automatically rewrap the text in them when they are resized. When they are created (preferably via windowManager.create), just use "autowrap" as the type, and pass the font size (optional) as the last argument, or as font_size in a table.
This effect is created via the use of a buffer, created as follows:
Note that you do not have to create or otherwise manipulate such a buffer, it is created automatically when you use windowManager.create. It can optionally be created with windowManager.makeBuffer(name) if you need to create a miniConsole first, and then add it to windowManager after it is created.
If you have any suggestions, I would love to hear them.
This effect is created via the use of a buffer, created as follows:
The original text is stored, unwrapped (so long as it isn't over 1000 characters long) in the buffer, and then rewritten to the window as it is resized.
Note that you do not have to create or otherwise manipulate such a buffer, it is created automatically when you use windowManager.create. It can optionally be created with windowManager.makeBuffer(name) if you need to create a miniConsole first, and then add it to windowManager after it is created.
If you have any suggestions, I would love to hear them.
Re: Simple Window Manager
I fixed a math bug that was causing occasional issues for window resizing (doing subtraction of percent and pixel values from percent and pixel values would compute incorrect results). If anyone actually uses this and runs into any other problems, please let me know.
Re: Simple Window Manager
Soon as I get another PC (people keep breaking my puters ) I'm going to try this out!
Re: Simple Window Manager
I'm just glad that someone is interested. Admittedly, I created this for my own purposes, but it is nice when people use things that I have created.