5E Product Walkthrough Playlist
Page 1 of 2 12 Last
  1. #1

    setEditMode and isEditMode in FormattedTextControl

    By looking at the API Documentation the FormattedTextControl have two methods setEditMode and isEditMode. https://www.fantasygrounds.com/refdo...extcontrol.xcp

    I'm creating a control from code. I'm using a template which is a FormattedTextControl and I'm trying to call these two methods but none of those are valid functions.

    I'm not sure if I'm doing all the things correctly.

    Template

    Code:
    	<template name="wizzy_trait_description_left_column">
    		<formattedtextcontrol>
    			<anchored height="60">
    				<top parent="columnanchor" anchor="bottom" relation="relative" offset="20" />
    				<left offset="50"/>
    				<right anchor="center" offset="-15"/>
    			</anchored>
    			<invisible/>
    		</formattedtextcontrol>
    	</template>
    Script

    Code:
    	descriptionControl = createControl("wizzy_trait_description_left_column", k.."_trait_description");
    	descriptionControl.setEditMode(false);
    My twitch channel


    Currently DMing:
    D&D 5e - "Waterdeep: Dragon Heist"

    Language: Italian

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Quote Originally Posted by st4lk3r87 View Post
    Code:
    	descriptionControl = createControl("wizzy_trait_description_left_column", k.."_trait_description");
    	descriptionControl.setEditMode(false);
    window.createcontrol doesn't return a control. Access the created control with the control name created from k.."_trait_description"
    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!

  3. #3
    Quote Originally Posted by Trenloe View Post
    window.createcontrol doesn't return a control. Access the created control with the control name created from k.."_trait_description"
    I'm not sure that's true unless I missing some aspect of what's going on here. I've done this and it works.

    Code:
          local controlInit = createControl("initiative_weapon_ct", sControlInit);
          controlInit.setValue(aWeapon.nSpeedFactor);
          controlInit.setReadOnly(true);
          controlInit.setTooltipText("INITIATIVE");
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  4. #4
    Quote Originally Posted by st4lk3r87 View Post
    By looking at the API Documentation the FormattedTextControl have two methods setEditMode and isEditMode. https://www.fantasygrounds.com/refdo...extcontrol.xcp

    I'm creating a control from code. I'm using a template which is a FormattedTextControl and I'm trying to call these two methods but none of those are valid functions.

    I'm not sure if I'm doing all the things correctly.

    Template

    Code:
    	<template name="wizzy_trait_description_left_column">
    		<formattedtextcontrol>
    			<anchored height="60">
    				<top parent="columnanchor" anchor="bottom" relation="relative" offset="20" />
    				<left offset="50"/>
    				<right anchor="center" offset="-15"/>
    			</anchored>
    			<invisible/>
    		</formattedtextcontrol>
    	</template>
    Script

    Code:
    	descriptionControl = createControl("wizzy_trait_description_left_column", k.."_trait_description");
    	descriptionControl.setEditMode(false);

    What part is failing? the setEditMode()? You mention 2 but I only see the one.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  5. #5
    Quote Originally Posted by celestian View Post
    What part is failing? the setEditMode()? You mention 2 but I only see the one.
    I simplified the code a bit and that doesn't work too.
    My twitch channel


    Currently DMing:
    D&D 5e - "Waterdeep: Dragon Heist"

    Language: Italian

  6. #6
    Quote Originally Posted by celestian View Post
    I'm not sure that's true unless I missing some aspect of what's going on here. I've done this and it works.

    Code:
          local controlInit = createControl("initiative_weapon_ct", sControlInit);
          controlInit.setValue(aWeapon.nSpeedFactor);
          controlInit.setReadOnly(true);
          controlInit.setTooltipText("INITIATIVE");
    Yes. That's what happens to me. if I call setValue it works but if I call isEditMode or setEditMode it doesn't. I also noticed that these two methods are not used at all in coreRPG and 5E
    My twitch channel


    Currently DMing:
    D&D 5e - "Waterdeep: Dragon Heist"

    Language: Italian

  7. #7
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    So, let's clarify what the issue is. You say "none of these are valid functions" - what feedback do you get? Do you get an error message?

    Can you right-click in the formattedtext control and see if the format menu is available or not?
    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!

  8. #8
    Quote Originally Posted by Trenloe View Post
    So, let's clarify what the issue is. You say "none of these are valid functions" - what feedback do you get? Do you get an error message?

    Can you right-click in the formattedtext control and see if the format menu is available or not?
    I get a nil-error when I try to access the setEditMode.
    My twitch channel


    Currently DMing:
    D&D 5e - "Waterdeep: Dragon Heist"

    Language: Italian

  9. #9
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Quote Originally Posted by st4lk3r87 View Post
    I get a nil-error when I try to access the setEditMode.
    What is the exact error, and what is the exact line of code?
    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!

  10. #10
    Quote Originally Posted by st4lk3r87 View Post
    I get a nil-error when I try to access the setEditMode.
    Try self[k.."_trait_description"].setEditMode(). I think that should work... assuming the control template is actually what you think it is (formattedtext control).
    Tho I think the other method should as well.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

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
  •  
DICE PACKS BUNDLE

Log in

Log in