5E Storm Kings Thunder Playlist
  1. #1

    Extension Development - onClickDown Return Value

    The documentation for the return value of a windowcontrol's onClickDown() handler found at https://www.fantasygrounds.com/refdo...cp#onClickDown, specifically "A value of false indicates that the default framework functionality for the this particular control should not be executed, but the processing should continue for the element below this control, if any." appears to indicate that if one control is drawn over top another, the bottom control will receive the onClickDown event when the top control returns false. However, this does not appear to be the case. The following has been used to show that only the topmost control's handler will receive the event when testing in the 5E ruleset, though it is assumed that the ruleset has no bearing on this particular functionality.
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <root release="3.0" version="3">
        <properties>
            <name>OnClickDownExample</name>
    
            <ruleset>
                <name>5E</name>
            </ruleset>
        </properties>
    
        <base>
    
            <script name="opener">
                function onInit()
                    Interface.openWindow("tester", "");
                end
            </script>
    
            <windowclass name="tester">
                <frame>utilitybox</frame>
                <script>
                    function onClickDown(button, x, y)
                        Debug.chat("window");
                        return false;
                    end
                </script>
                <sheetdata>
                    <genericcontrol name="bottom">
                        <anchored position="over" />
                        <script>
                            function onClickDown(button, x, y)
                                Debug.chat("bottom");
                                return false;
                            end
                        </script>
                    </genericcontrol>
                    <genericcontrol name="top">
                        <anchored position="over" />
                        <script>
                            function onClickDown(button, x, y)
                                Debug.chat("top");
                                return false;
                            end
                        </script>
                    </genericcontrol>
                </sheetdata>
            </windowclass>
            
        </base>
    </root>
    My creations: https://github.com/MeAndUnique/FantasyGrounds
    Discord: MeAndUnique#6805

  2. #2
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    13,472
    Blog Entries
    9
    MOD: moved to Workshop, as that's the best place to discuss extensions and development.

  3. #3
    Quote Originally Posted by LordEntrails View Post
    MOD: moved to Workshop, as that's the best place to discuss extensions and development.
    This is discussing a bug in the code - so is that still Workshop where we would put those? Typically, in the past, any bugs in the code (engine or ruleset) was always put elsewhere. Is this something new?

  4. #4
    This is by design; though the documentation may need to be clarified. When it states that "the processing should continue for the element below this control", it refers to the window and other parent elements, not any other controls in the same window.

    In these scenarios, I usually use the "disabled" tag to block mouse interactions completely for one of the controls. Or intercept events at the higher-level control and pass to the lower-level control.

    Regards,
    JPG

  5. #5
    Quote Originally Posted by Moon Wizard View Post
    This is by design; though the documentation may need to be clarified. When it states that "the processing should continue for the element below this control", it refers to the window and other parent elements, not any other controls in the same window.

    In these scenarios, I usually use the "disabled" tag to block mouse interactions completely for one of the controls. Or intercept events at the higher-level control and pass to the lower-level control.

    Regards,
    JPG
    Thanks for the reply, that helps clarify expectation for sibling control interactions. The above example still does not cause the window to receive the event from the "bottom" control if the "top" control is removed, which sounds like it is a bug if I am interpreting intent correctly.
    My creations: https://github.com/MeAndUnique/FantasyGrounds
    Discord: MeAndUnique#6805

  6. #6
    Well, technically, window instances do not support click events (only window controls do); so they would continue to be passed up the hierarchy to any window containers (subwindow/windowlist).

    Regards,
    JPG

  7. #7
    Ok, cool, thanks for clearing that up for me.
    My creations: https://github.com/MeAndUnique/FantasyGrounds
    Discord: MeAndUnique#6805

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Fantasy Grounds Fridays Pre

Log in

Log in