ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   UI Window isn't movable (https://www.esoui.com/forums/showthread.php?t=7883)

OblivionNW 06/22/18 07:52 AM

UI Window isn't movable
 
I created an additional UI label as an extension to an existing addon but I want to be able to drag to move it into a new position on the screen. It's a simple text label but I can't figure out what I'm doing wrong here.

I'm defining the label like this:
Lua Code:
  1. AsylumNotifier.Jump = WINDOW_MANAGER:CreateTopLevelWindow("JumpNofifier");
  2.     AsylumNotifier.Jump:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, AsylumNotifier.vars.jump_left, AsylumNotifier.vars.jump_top);
  3.     AsylumNotifier.Jump:SetClampedToScreen(true);
  4.     AsylumNotifier.Jump:SetMouseEnabled(true);
  5.     AsylumNotifier.Jump:SetMovable(true);
  6.     AsylumNotifier.Jump:SetHandler("OnMoveStop", AsylumNotifier.OnJumpMoveStop);
  7.     AsylumNotifier.Jump.label = WINDOW_MANAGER:CreateControl(nil, AsylumNotifier.Jump, CT_LABEL);
  8.     AsylumNotifier.Jump.label:SetDimensions(400, 40);
  9.     AsylumNotifier.Jump.label:SetAnchor(TOPLEFT, AsylumNotifier.Jump, TOPLEFT, 0, 0);
  10.     AsylumNotifier.Jump.label:SetFont('$(BOLD_FONT)|$(KB_48)|soft-shadow-thick');
  11.     AsylumNotifier.Jump.label:SetText('JUMP NOTIFIER');
  12.     AsylumNotifier.Jump.label:SetHidden(true);
  13.     AsylumNotifier.Jump.fragment = ZO_HUDFadeSceneFragment:New(AsylumNotifier.Jump);

Later on in the code this function:
Lua Code:
  1. function AsylumNotifier.OnJumpMoveStop( )
  2.     AsylumNotifier.vars.jump_left = AsylumNotifier.Jump:GetLeft();
  3.     AsylumNotifier.vars.jump_top = AsylumNotifier.Jump:GetTop();
  4. end

I have also tried defining it in the GUI XML but that also didn't work, when I did it like that I used the following code:
Lua Code:
  1. <TopLevelControl name="JumpNotifier" mouseEnabled="true" movable="true" clampedToScreen="true" hidden="true">
  2.             <OnMoveStop>
  3.                 AsylumNotifier.OnJumpMoveStop()
  4.             </OnMoveStop>
  5.  
  6.             <Controls>
  7.                 <Label name="$(parent).label" text="JUMP NOTIFIER" horizontalAlignment="LEFT" verticalAlignment="BOTTOM" font="$(BOLD_FONT)|$(KB_48)|soft-shadow-thick">
  8.                     <AnchorFill/>
  9.                 </Label>
  10.             </Controls>
  11.         </TopLevelControl>

votan 06/22/18 08:04 AM

My first guess is, that your TopLevel has no size and therefore no mouse-active area.

OblivionNW 06/22/18 09:20 AM

Yup, that was it. Thanks!


All times are GMT -6. The time now is 02:58 PM.

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