So I'm reading though the manual and I find myself a great piece of code, in the form of a function that is called each time the window is manually resized; one that you simply have to polymorph into usable code for your system.
Highly excited, I rush to my system and write a small function that updates my map position on the handleWindowResizeEvent(), as per the manual... to high disappointment when nothing happens.
Is this not implemented yet? Has it been made obsolete with a true event?
using linux pre1.0.6.
Windows Resizing Event.
Re: Windows Resizing Event.
If you have multiple windows that you want to resize automatically, you'll write your own copy of this function and raise an event. The default function does nothing. Then you'll write a resize event handler for all the windows that you want to resize.
Note that the next version of Mudlet will raise a system event called "sysWindowResize". The custom event handlers will be left untouched for backward compatibility.
Currently you can do:
Note that the next version of Mudlet will raise a system event called "sysWindowResize". The custom event handlers will be left untouched for backward compatibility.
Currently you can do:
Code: Select all
handleWindowResizeEvent()
raiseEvent("onWindowResize")
end
myCoolWindowAHandleResize()
resizeWindow( ... )
moveWindow( ... )
end
myCoolWindowBHandleResize()
resizeWindow( ... )
moveWindow( ... )
end
myCoolWindowCHandleResize()
resizeWindow( ... )
moveWindow( ... )
end
Re: Windows Resizing Event.
Right, the problem I'm having is that the function is never being called (which I've tested with debugging echos). When I resize the main window, I get no activity from handleWindowResizeEvent()
Re: Windows Resizing Event.
This is some working code from Demonnic's upcoming Stygian combat system:
function windowresize() [located in a script called "windowresize" that defines an event handler for the event "windowresize" - note that the event handler function of a script *must* have the same name as the script. Otherwise it will not be called]
If your function doesnt get called you'll either have 2 copies of that function or made a spelling error. Use the search function and search for handleWindowResizeEvent(). In case of 2 copies: Lua will use the instance that was compiled last.
Code: Select all
function handleWindowResizeEvent()
raiseEvent("windowresize")
end
Code: Select all
function windowresize()
Stygian_resizeCalendar()
Stygian_resize_prompt()
mk_map_resize()
chatStartup()
createSystemWindow()
createInventoryWindow()
createAfflictionWindow()
end
Re: Windows Resizing Event.
Well, I double checked that I only have one copy of the function override, and that the spelling is correct. It simply doesn't get the call.
Re: Windows Resizing Event.
Odd. I deleted the script, rewrote it and tried it again, to no avail.
Restarting Mudlet afterwards, however, caused it to start working perfectly.
Problem solved?
Restarting Mudlet afterwards, however, caused it to start working perfectly.
Problem solved?
Re: Windows Resizing Event.
Lua is case sensitive.
Re: Windows Resizing Event.
Aye, I'm aware of that. I'm new to mudlet, but certainly not to Lua. It wasn't a spelling or duplication or caps error. The function simply wasn't getting called until I restarted.