Using registerAnonymousEventHandler to redraw UI

Post Reply
Posts: 30
Joined: Thu Feb 07, 2013 7:33 am

Using registerAnonymousEventHandler to redraw UI

Post by tarkenton » Thu Nov 05, 2015 7:28 am

Hey all, been playing a good bit with trying to gracefully handle redrawing the UI I've created when the Mudlet window gets resized (which still happens a ton on macs) since it starts to just look like trash without it.

From what I've read and searched around for, pretty much the only way to redraw is to call resetProfile(). This is fine, a bit of lag is involved when you next get a line from the MUD, but hey, can live with lag. However, it seems like GMCP is knocked off when that happens. Case in point, channel capture using GMCP stops working, the mapper stops getting its position updated, and other portions of my UI stop working.

Is there a better way to handle getting the UI to completely redraw itself that I'm missing?

User avatar
Posts: 930
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Using registerAnonymousEventHandler to redraw UI

Post by SlySven » Sat Nov 07, 2015 2:33 am

Not sure if this will achieve what you want but it seems that any of the setBorder###((int) number) where ### is "Top", "Bottom", "Left" or "Right" commands will set a value - even if it is the same as the previous value - for the corresponding border and then cause the relevant widget to send a resize event out to the application which causes a redraw.

Maybe these are being used repeatedly by the Geyser/Vyzor Lau UI systems - so it could be why there are so many of the resize events happening.

Looking through the source I see that when a console gets a resizeEvent it tries to call a lua function called "handleWindowResizeEvent" with a single argument "WindowResizeEvent" but that lua function is now assigned to the lua_noop command so does nothing, THEN a lua "sysWindowResizeEvent" is raised with three additional arguments: width, height & console name and sent out to any user's handler for that profile that is set-up to process it.

I don't fully grasp this but I think the user's script or the Geyser/Vyzor system is supposed to make use of this, but in such a manner that it doesn't create further resize events... :?

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

Re: Using registerAnonymousEventHandler to redraw UI

Post by Oneymus » Mon Jan 04, 2016 5:01 am

When Vyzor resizes (which it does when Mudlet is resized), it sets a flag to specifically prevent endless resizing. See GitHub for details.

@tarkenton: The best way to resize a UI is to move and resize the labels/miniconsoles, not resetProfile(). It's more work, but doesn't remove everything else in your profile. The functions you want are resizeWindow() and moveWindow().

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests