The included pkg provides a framework for handling window resize events in mudlet. Explanation will be forthcoming... I'm sleep deprived and don't wanna muddle it up. =)
How to handle adjusting gui elements with window resizing
Re: How to handle adjusting gui elements with window resizing
Ok, I am going to take a stab at explaining this now.
This pkg adds a single script item, windowresize. It is setup in such a way that it calls the event windowresize whenever you resize your window. This is significant, because it allows you to call functions to move/resize your miniconsoles, labels, etc. when you resize your window.
For each gui element you have, you will want to write a function which handles the logic for where and how big to draw the element. For example, in the tabbed chat package I added to that thread, I created the following function
Which recalculates the window and tab widths, etc, based on the new main window dimensions. You then place it within the function definition for windowresize() in this package, and it will be called whenever you resize the window. This would look like so:
You can then add a function for each gui element in your setup, so that they are all called whenever the window is resized.
This pkg adds a single script item, windowresize. It is setup in such a way that it calls the event windowresize whenever you resize your window. This is significant, because it allows you to call functions to move/resize your miniconsoles, labels, etc. when you resize your window.
For each gui element you have, you will want to write a function which handles the logic for where and how big to draw the element. For example, in the tabbed chat package I added to that thread, I created the following function
Code: Select all
function resize_chat_tabs()
local global_width, global_height = getMainWindowSize()
global_chatWidth = global_width
global_chatTabWidth = 0.20 * global_chatWidth
global_chatPosX = 0
global_chatPosY = 0
resizeWindow("buttonall", global_chatTabWidth, global_chatTabHeight)
resizeWindow("buttonguild", global_chatTabWidth, global_chatTabHeight)
resizeWindow("buttoncity", global_chatTabWidth, global_chatTabHeight)
resizeWindow("buttonmarket", global_chatTabWidth, global_chatTabHeight)
resizeWindow("buttonweb", global_chatTabWidth, global_chatTabHeight)
moveWindow("buttonall", global_chatPosX, global_chatPosY)
moveWindow("buttonguild", global_chatPosX + global_chatTabWidth, global_chatPosY)
moveWindow("buttoncity", global_chatPosX + global_chatTabWidth * 2, global_chatPosY)
moveWindow("buttonmarket", global_chatPosX + global_chatTabWidth * 3, global_chatPosY)
moveWindow(buttonweb", global_chatPosX + global_chatTabWidth * 4, global_chatPosY)
resizeWindow("chatall", global_chatWidth, global_chatHeight)
resizeWindow("chatguild", global_chatWidth, global_chatHeight)
resizeWindow("chatcity", global_chatWidth, global_chatHeight)
resizeWindow("chatmarket", global_chatWidth, global_chatHeight)
resizeWindow("chatweb", global_chatWidth, global_chatHeight)
end
Code: Select all
function windowsresize()
resize_chat_tabs()
end
You can then add a function for each gui element in your setup, so that they are all called whenever the window is resized.
Re: How to handle adjusting gui elements with window resizing
testing new forum functionality
Re: How to handle adjusting gui elements with window resizing
How is this different than overwriting handleWindowResizeEvent() as described in the manual?
Re: How to handle adjusting gui elements with window resizing
Functionally, it's quite similar. However, if you overwrite that function multiple times with multiple packages, only the one which is rewritten last will take effect.
The upcoming release will, I believe, make this obsolete in any case.
The upcoming release will, I believe, make this obsolete in any case.
Re: How to handle adjusting gui elements with window resizing
Ah ok. Has there been any work towards a general purpose layout manager? I've got some ideas for one, but if there's already a work in progress I'd rather hack on it.
Re: How to handle adjusting gui elements with window resizing
Nay. I've got some ideas as well, PM me on forums or IRC
Re: How to handle adjusting gui elements with window resizing
Wrote you a PM but it's just sitting in the outbox and doesn't show up in sent. Problem or expected?
Re: How to handle adjusting gui elements with window resizing
Well, I did receive it.