Page 1 of 1

Clickable buttons and stuff.

Posted: Mon Jul 21, 2014 8:03 pm
by Aquifn
So, I want to set up an alias that gives me a list of possible defenses. I want the defenses, to have two states. Active, and unactive. And I want to be able to click the name I give the defense, to activate them.

I'm pretty sure I can do most of it, what I've never been able to successfully do is the clickable button. And maybe showing active vs unactive in quick easy code rather then long drawn out.


So basically, hit alias command and see [Deathslight] as either faded (not active) or bold (active). And clickable to send commands.

Re: Clickable buttons and stuff.

Posted: Mon Jul 21, 2014 11:33 pm
by xabre
I use Geyser labels for that, label stylesheet (mostly background image) changing based on state of the button, and action set with setClickCallback. Mabye someone knows more sophisticated way, but heck, it works.

Re: Clickable buttons and stuff.

Posted: Wed Jul 23, 2014 3:33 pm
by SlySven
Do you mean "Alias" or "Button" - I've been looking over the current "Buttons" code and there are one or two things that I think could work better but if you set a button created in the editor (probably has to be in a "group"/"folder" which become a dockable widget Toolbar) to be a "push down" Button you can retrieve the button state IN THE SCRIPT AREA FOR THAT BUTTON ONLY with the getButtonState() lua call which will return 2 if the button is ON and 1 otherwise. :geek:

At present there does not appear to be a way to query the button state otherwise, to change the button state or enable or disable it with Lua code and there is not currently a way to put an icon (picture) on the button, though there are code remnants that suggest it was once possible. Enabling/Disabling a button in the editor shows/hides the button in the toolbar and if you set there to be more than one row or column (toolbar orientation dependent as to which that folder/group property applies) the layout is not stable or easy to plan out as it get redrawn every time something changes in the editor and includes at least one dummy button-sized space before the first button lines them up weirdly particularly if the toolbar is not docked. :ugeek:

I have played around with this and got something that meant I could, say (using the Oxygen "Emotes" 48px Icons) have a smiling face icon if the button was down or a sad one if it was up or a greyed out plain one if it was disabled and I think it would have been possible to do C++/Lua interface code to both query and control the state from a general lua script but I realise - like xabre has already pointed out - that the same things can already be done (somehow) with Geyser (and presumable Vyzor) labels... {and multiple state related icons would be incompatible with the current file format - and extending that in a "compatible" manner would cause all but one to be lost from the profile if an "extended" was loaded and then saved from an older Mudlet instance that did not understand the extra icons.} :(