-
August 16th, 2013, 11:05 #1
- Join Date
- Dec 2010
- Posts
- 35
New V3 buttonfield (buttoncontrol)
Hello,
Is it already possible to have some details informations (as we can found in the Ruleset Reference section) about the new buttonfield/buttoncontrol ?
I tried to add some text in and out the <state> tag but without any success.
I know the version 3 is still in alpha... but I will really appreciate some help about this request.
JC
-
August 17th, 2013, 05:45 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,570
There's actually a fair bit of information, and I need to organize it better for sharing.
Here is a rough overview.
All buttons can have a single "state" that can be customized using the "frame", "font", "text" and "icon" tags.
To define multiple states or customize states, you define one or more state tags that represent the visual state of the button when the button has each state value. The numeric values assigned to a buttoncontrol/buttonfield are a number data type, and are numbered from 0 for the first state tag defined, 1 for the second state tag defined, and so on. The state tag supports frame, frameoffset, icon, text, font, and offset tags.
Also, you can define "pressed" and "hover" tags to match the "state" tags to customize the "pressed" and "hover" states of each button number value.
Regards,
JPG
-
August 19th, 2013, 12:06 #3
- Join Date
- Dec 2010
- Posts
- 35
Thank you for you answer moon_wizard.
I did some script test on the buttoncontrol, and the result is strange.
1° I tried to use the setText() function in the onInit() event function, but the text never appeared.
And I also tried to add a bitmapwidget to this control (don't ask why ) inside the onInit() function of the control itself but even if the widget is created (I can display its property in the debug console) it is not displayed. If I do the same (addbitmapwidget) on other control at the onInit() level, it works fine...
-
August 29th, 2013, 17:01 #4
- Join Date
- Dec 2010
- Posts
- 35
Hi,
I found another bug/limitation with the buttonfield control, as the state tags are not named (just a list of tags), when you try to merge your own control with a template built with the buttonfield control, the result of the join merging process is: only the last occurence of the <state> tag of the template is applied for all tags in your control button.
Is it a way to identify each <state> tags or a "name" attribute so we can merge template correctly?
Bz
-
September 1st, 2013, 06:04 #5
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,570
It's one of the limitations of the merging process to make it easier in the more general cases.
Try adding the merge="add" attribute to each of the state tags to append all the states. Also, you can use a single merge="resetandadd" on the first instance to override any existing states.
Regards,
JPG
-
December 31st, 2013, 11:32 #6
- Join Date
- Dec 2010
- Posts
- 35
Hooo! I finally tried with succes the merge="add" and it it worked fine... sorry I forgot the "add" merge rule for template.
Thanks for your help Moon_wizzard.
Bz
-
February 19th, 2014, 09:36 #7
- Join Date
- Jan 2007
- Location
- Austria
- Posts
- 116
Hi, How can I set the states from script?
-
February 19th, 2014, 11:18 #8
Are you looking to dynamically add/remove states via LUA or just change the text of an existing state?
I don't think you can specifically remove/add states at run time.
However, you could have a buttonfieldcontrol template with a lot of blank states and use the setStateText command at runtime to make a state "visible": https://www.fantasygrounds.com/refdo...p#setStateText
Then, using the onButtonPress event https://www.fantasygrounds.com/refdo...#onButtonPress you could monitor the current state (via getValue) and recycle back to 0 (with setValue) if the button value was greater than the number of states you wanted to use (even though your template may have more, blank, states).Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
February 19th, 2014, 18:23 #9
- Join Date
- Jan 2007
- Location
- Austria
- Posts
- 116
I did want to add and remove states via lua, but managed to work around it. Actually I did something a lot like what you suggested. thank you!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks