DICE PACKS BUNDLE
  1. #1

    Window/subwindows and combobox odd behavior

    I am having some odd behavior with combobox within a subwindow.

    In a Story window I've added a subwindow (author_header) above the typical "header" subwindow and attached the header to the bottom of the author_header. Within the author_header subwindow I've added 2 labels, a checkbox and a combobox.

    When using the combobox that has a selection already (see animated gif below) the combobox opens but the view is slid down and the top of the combobox is pushed up where it's not visible. In the animation you can see that when I move the mouse up (when I go to the right side) to the author_header section and use mousewheel it will snap up to top and look normal.

    Is there an event I can capture that I can then run "setScrollPosition(0,0)" on the subwindow and correct this when the combobox is opened? Or is there another way to deal with this?

    https://i.imgur.com/003RMZq.gifv


    The subwindow template and combobox template are nothing special but here they are:

    Code:
    <template name="note_author_header">
    	<subwindow>
    		<anchored>
    			<top offset="23" />
    			<left offset="15" />
    			<right offset="-15" />
    		</anchored>
    		<activate />
    		<fastinit />
    	</subwindow>
    </template>
    
    <template name="author_frameselect">
        <combobox>
          <script>
            function onInit()
              super.onInit();
              addItems(AuthorManagerADND.aBlockFrames);
            end
          </script>
    	 <anchored>
    	 <top parent="rightanchor" offset="8" />
    	 <left offset="45" />
    	 <right offset="-90" />
    	 </anchored>
          <listdirection>down</listdirection>
          <listmaxsize>8</listmaxsize>
        </combobox>
    </template>
    ---
    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.

  2. #2
    It's because the combobox is actually an amalgation of controls, and the combobox creates a windowlist control above itself by default. Because your combo box is at the top of the window, the window is trying to re-layout to accommodate the extra controls.

    If you specify a <listdirection>down</listdirection> tag for your template, the combobox should append the selection list below the string field.

    Regards,
    JPG

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    If you specify a <listdirection>down</listdirection> tag for your template, the combobox should append the selection list below the string field.
    I do have listdirection set to down. Or do you mean somewhere else?

    Code:
    <template name="author_frameselect">
        <combobox>
          <script>
            function onInit()
              super.onInit();
              addItems(AuthorManagerADND.aBlockFrames);
            end
          </script>
    	 <anchored>
    	 <top parent="rightanchor" offset="8" />
    	 <left offset="45" />
    	 <right offset="-90" />
    	 </anchored>
          <listdirection>down</listdirection>
          <listmaxsize>8</listmaxsize>
        </combobox>
    </template>
    ---
    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
    Apologies, that's what I get for answering late, and making assumptions.

    Looking at it again and knowing that the combobox is down; I'm going to guess that the combobox is within a subwindow which is dynamically sizing larger when the combobox list is created? If that's the case and the other controls are anchored to the subwindow, then they will be pushed down when the subwindow resizes.

    It's a known limitation of the combobox limitation that it doesn't play nice within nested subwindows, because it is an amalgamation of controls and laid out as inidividual controls. If you have it nested, then it will either be clipped (if using fixed height subwindow) or will expand the subwindow (if using dynamic height subwindow). This is similar for child windows of a windowlist.

    Regards,
    JPG

  5. #5
    Quote Originally Posted by Moon Wizard View Post
    Apologies, that's what I get for answering late, and making assumptions.

    Looking at it again and knowing that the combobox is down; I'm going to guess that the combobox is within a subwindow which is dynamically sizing larger when the combobox list is created? If that's the case and the other controls are anchored to the subwindow, then they will be pushed down when the subwindow resizes.

    It's a known limitation of the combobox limitation that it doesn't play nice within nested subwindows, because it is an amalgamation of controls and laid out as inidividual controls. If you have it nested, then it will either be clipped (if using fixed height subwindow) or will expand the subwindow (if using dynamic height subwindow). This is similar for child windows of a windowlist.

    Regards,
    JPG
    Yup, it's stacked subwindows. I'll tinker with it a little more and see what I can maybe get working. If not, sounds like a cycler might be a better choice for this. If I limit the choices to a smaller list the drop box will be less necessary anyway.
    ---
    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.

  6. #6
    Not the way I wanted to do it but this works.

    (cycler). It took some tinkering to initialize the non-static data.
    https://i.imgur.com/zpdj5nv.gifv

    Here is the meat of it.
    Code:
      <template name="author_frameselect">
        <button_stringcycler>
          <script>
            function onInit()
              local sSelections = "";
              for _, sItem in pairs(AuthorManagerADND.aBlockFrames) do
                sSelections = sSelections .. sItem .. "|";
              end
              super.onInit();
              super.initialize(sSelections, sSelections,DB.getValue(window.getDatabaseNode(),"ref_frame",AuthorManagerADND.aBlockFrames[1]));
              super.updateDisplay();
            end
          </script>
    		<anchored width="80" height="15">
    			<top parent="rightanchor" offset="8" />
    			<left anchor="center" offset="-40" />
    		</anchored>
        </button_stringcycler>
      </template>
    ---
    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
  •  
FG Spreadshirt Swag

Log in

Log in