Thread Tools Display Modes
03/29/17, 01:55 PM   #1
fritzOSU03
 
fritzOSU03's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 19
Question 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>
  Reply With Quote
03/29/17, 06:00 PM   #2
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 408
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.
  Reply With Quote
03/29/17, 08:24 PM   #3
fritzOSU03
 
fritzOSU03's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 19
Originally Posted by Dolgubon View Post
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?
  Reply With Quote
03/29/17, 10:26 PM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
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.
  Reply With Quote
03/31/17, 08:11 AM   #5
fritzOSU03
 
fritzOSU03's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 19
Originally Posted by Baertram View Post
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

Last edited by fritzOSU03 : 03/31/17 at 08:57 AM. Reason: Code cleanup and clarification.
  Reply With Quote
03/31/17, 10:59 AM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
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.
  Reply With Quote
03/31/17, 01:12 PM   #7
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 408
The only thing I can think of is setting mouseEnabled="true" for the list holder.
  Reply With Quote
04/01/17, 07:19 AM   #8
fritzOSU03
 
fritzOSU03's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 19
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.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Window with Dynamic Elements is Immovable

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off