Fantasy Grounds Merchandise
  1. #1

    Problem with stringcontrol and delaykeyupdate

    Ok somehow the backspace key is being treated as a loss of focus (and value changed) - even though the <delaykeyupdate> is set in <stringcontrol>. In fact, so is del key. If I key in characters it works as it should and does not trigger OnValueChanged call. But backspace and delete do trigger it - which is unexpected as until the string is "done editing" one does not expect the logic under the OnValueChanged to be triggered.

    I never noticed this happening before - previously, at some point back in time, backspace to edit (remove) characters worked fine.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  2. #2
    Do you have a specific example in the existing rulesets where it is doing this? Or a simple extension showing the issue?

    Thanks,
    JPG

  3. #3
    I tried to find a ruleset example but it appears my Combat Groups extension is the only thing using onValueChange functionality with the delaykeyupdate. Here is the specific ct_host.xml field that triggers it...

    Code:
    			<stringcontrol name="EditCTGroup">
    				<anchored width="200" height="30">
    				  <left parent="combatgroup_visible_button" anchor="right" offset="7" />
    				  <bottom parent="combatgroup" anchor="bottom" offset="0" />
    				</anchored>
    				<tooltip textres="combatgroup_editctgroup_tooltip" />
    				<delaykeyupdate />				
    				<font>sheettext</font>
    				<script>
    					function onInit()
    						CombatGroupsManager.InitEditCTGroup(window);
    					end
    					function onValueChanged()
    						CombatGroupsManager.EditCTGroupChanged(window);
    					end
    					function onDoubleClick()
    						return CombatGroupsManager.fitWindowToGroup(getValue());
    					end
    				</script>
    				<frame name="groupbox" offset="5,5,2,2" />
    			</stringcontrol>
    I suspect simply adding onValueChanged() into ANY control that also uses <delaykeyupdate /> would show it being triggered on backspace/del keys but not any normal text keys. That is the issue - it triggers on backspace/del when I would think the <delaykeyupdate /> would have prevented it triggering until a return/tab key was hit or it lost focus.
    Last edited by SilentRuin; September 4th, 2021 at 22:16.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  4. #4
    I have delivered a workaround to fake it into looking like its working. I preserve cursor position at start of onValueChanged processing and return it to original position when done, as some of the filter processing it triggers will reset the cursor position in the field (as it is processed when I'm still actually editing it - i.e. removing and adding characters).
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  5. #5
    Anything that changes a block of text will trigger a full value change event (copy/paste, etc.). Since backspace and delete can be used to delete blocks of text (if selected); then they generate that event.

    Regards,
    JPG

  6. #6
    Quote Originally Posted by Moon Wizard View Post
    Anything that changes a block of text will trigger a full value change event (copy/paste, etc.). Since backspace and delete can be used to delete blocks of text (if selected); then they generate that event.

    Regards,
    JPG
    Typically keywords that block processing until the edit is complete don't trigger on anything but return/tab or loss of focus. While I can see block processing triggering a change of focus - simply adding and removing characters (part of the editing process) should not. However, I've worked around it from a visual perspective - if not an actual don't process till done perspective.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  7. #7
    As far as I remember, the code was migrated from FGC, so it didn't make sense to change it and possibly break other code.

    JPG

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