5E Product Walkthrough Playlist
  1. #1

    Combining a two values for display

    Hello,

    I have been scratching my head trying to figure this out all afternoon, so I figured I would drop a line here for some assistance. I am working on a library module and a custom ruleset, and I am trying to figure out how to resolve a display issue.

    A simple example of the problem can be illustrated using the traits associated with each race. If you look at the core rule books, you will see that in most entries the traits for each race are displayed in a format like the following:

    Trait Name: A description of the trait, how it works, etc.

    Now, I realize that using the formattedtextcontrol it is possible to replicate this format with little problem at all, but I am planning to include a lot of interactivity in my ruleset that will look at the loaded modules to see what is available. What I really want to be able to do is separate the "Trait Name" part out into its own field so that I can later add some interactivity to the ruleset, such as displaying the list of loaded races that have a specified trait. I am putting together a custom windowclass to display the reference race data, and in the library module the data is being entered in a new format that stores the various bits of information in separated fields instead of being a single formattedtext field.

    When it comes to displaying this data back to the user, what I want to be able to do is take the value of the trait name, concatenate that into a string such as "<b>" .. trait_name_value .. "</b> ", and then append this new string which includes the bold formatting tag to the beginning of the formattedtext value that is stored for the description. I have not been able to figure out how to programmatically set the value for a formattedtextfield or a formattedtextcontrol, though I have had no trouble so far working with them for bound text. Any help would be greatly appreciated, and a huge round of thanks in advance. The community around here has been extremely helpful so far as I have begun diving headlong into ruleset development, and I thank everyone a ton!

  2. #2
    The functions getValue/setValue for formatted text database nodes is primarily for pure copying of data. You can edit/build the data to use for setValue, but it requires decoding how FG expects the data to be received.

    Make sure to review this page for details on how tags are stored in the database for formattedtext fields.
    https://www.fantasygrounds.com/refdo...extcontrol.xcp

    Your best bet is to fill out a few Story entries in a blank campaign, exit FG then review the db.xml file for that campaign. You will see examples of how the formatted text data is expected. You will definitely need to at least wrap the first part in a "p" (paragraph) tag for FG to decode it.

    Regards,
    JPG

  3. #3
    I cannot seem to access setValue and getValue, and neither function is listed in the ref docs for formattedtextcontrol or formattedtextfield. Am I missing something?

  4. #4
    You have to get the getDatabaseNode( ) function to get the underlying databasenode object to use setValue/getValue on.

    Originally, the formattedtext controls were read-only, and we've been chipping away at adding new capabilities to these controls in addition to other stuff we're working on.

    Cheers,
    JPG

  5. #5
    Thank you, I will tinker around with this later.

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
  •  
FG Spreadshirt Swag

Log in

Log in