ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Window with Dynamic Elements is Immovable (https://www.esoui.com/forums/showthread.php?t=6927)

fritzOSU03 03/29/17 01:55 PM

Window with Dynamic Elements is Immovable
 
I have the following things (this is a simplified representation) in my xml file. I'm able to add the row template dynamically from my lua file. After the virtual elements are added, the window is frozen in place and cannot be moved. I've tried moving and duplicating the movable tag. I've also tried resizing the window in order to use the new, unoccupied window space. Any ideas why this window cannot be moved and what I need to do to make it movable? Thanks in advance.

xml Code:
  1. <GuiXml>
  2.     <Controls>
  3.         <TopLevelControl name="MY_GUI" mouseEnabled="true" movable="true" hidden="true" resizeHandleSize="2" >
  4.             <Settings />
  5.             <Controls>
  6.                 <Backdrop name="$(parent)_BG" inherits="ZO_DefaultBackdrop" >
  7.                     <AnchorFill />
  8.                     <TextureCoords left="0" right="1" top="0" bottom=".875" />
  9.                 </Backdrop>
  10.                 <Control name="$(parent)_Container" mouseEnabled="true">
  11.                     <Settings.../>
  12.                 </Control>
  13.             </Controls>
  14.         </TopLevelControl>
  15.  
  16.         <Control name="RowTemplate" virtual="true">
  17.             <Dimensions x="230" y="24" />
  18.             <Controls>
  19.                 <Texture name="$(parent)_BgImage">
  20.                     <Settings.../>
  21.                 </Texture>
  22.                 <Texture name="$(parent)_Icon">
  23.                     <Settings.../>
  24.                 </Texture>
  25.                 <Label name="$(parent)_Text1" font="ZoFontGameShadow">
  26.                     <Settings.../>
  27.                 </Label>
  28.                 <Label name="$(parent)_Text2" font="ZoFontGameShadow">
  29.                     <Settings.../>
  30.                 </Label>
  31.             </Controls>
  32.         </Control>
  33.     </Controls>
  34. </GuiXml>

Dolgubon 03/29/17 06:00 PM

Ok so you do have something that is movable: MY_GUI. The problem is that MY_GUI has no dimensions at all. I would give that dimensions first, and then give those same dimensions to the background. Both sets of dimensions would need to be changed if you add a new row, and want the window to become bigger. a Top Level Control is invisible by default, so if you change thebackground sizew without changing MY_GUI size then you will have some areas that have nothing but will move everything, or some areas of the background that can't be used to move it.

fritzOSU03 03/29/17 08:24 PM

Quote:

Originally Posted by Dolgubon (Post 30374)
Ok so you do have something that is movable: MY_GUI. The problem is that MY_GUI has no dimensions at all. I would give that dimensions first, and then give those same dimensions to the background. Both sets of dimensions would need to be changed if you add a new row, and want the window to become bigger. a Top Level Control is invisible by default, so if you change thebackground sizew without changing MY_GUI size then you will have some areas that have nothing but will move everything, or some areas of the background that can't be used to move it.

This was definitely part of the problem. Thank you! I can now move the window but only if I happen to find a small sliver of space between the contents and the Top Level Control. Any way to make the contents grab-able so I don't need to try and find the six-pixel space just outside of the title label?

Baertram 03/29/17 10:26 PM

Use control:SetAnchorr(...) + control:SetParent(MY_GUI) to connect it to MY_GUI.
Should be enough to move the top level control with all anchored children by drag & dropping the children.

fritzOSU03 03/31/17 08:11 AM

Quote:

Originally Posted by Baertram (Post 30376)
Use control:SetAnchorr(...) + control:SetParent(MY_GUI) to connect it to MY_GUI.
Should be enough to move the top level control with all anchored children by drag & dropping the children.

This was a huge help. I am able to move the window by the header label now that I've set MY_GUI as the parent of the header and the header as the parent of the title label. I know, these elements weren't mentioned before. However, no matter where I put MY_GUI_Container:SetParent(MY_GUI) in my lua file, I still can't move the window by any of the virtual elements. I'm setting the RowTemplate as the parent of each of the elements and I'm setting MY_GUI_Container as the parent of each template on creation. I'm also setting the sizes and anchors for each virtual item as I go. So as to alleviate any confusion, my full xml and lua scripts are below.

XML Script
Warning: Spoiler


Lua Script
Warning: Spoiler

Baertram 03/31/17 10:59 AM

I'm not sure cuz I've never used a template and much XML stuff.
But it should be enough if you set the parent of the controls that you want to be able to click and move = your TopLevelControl "UCV_GUI".

From your lua code you should be able to drag&drop the total TopLevelControl by either clicking and dragging the TopLevelControl UCV_GUI itsself, or by clicking and dragging UCV_GUI_ListHolder or UCV_GUI_Header.
Not sure if the entries in the ListHolder can be clicked and dragged in order to move the whole TopLevelControl. I'd only make a header line that is able to drag&drop the TLC.

Dolgubon 03/31/17 01:12 PM

The only thing I can think of is setting mouseEnabled="true" for the list holder.

fritzOSU03 04/01/17 07:19 AM

Well, I tried all of these things and none worked. I got the header working for movability so I can live without the rest of the window being a move handle.


All times are GMT -6. The time now is 09:36 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI