FG Spreadshirt Swag
  1. #1

    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

  2. #2
    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

  3. #3
    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...

  4. #4
    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

  5. #5
    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

  6. #6
    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

  7. #7
    Hi, How can I set the states from script?

  8. #8
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,413
    Quote Originally Posted by meathome View Post
    Hi, How can I set the states from script?
    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!

  9. #9
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in