Thread Tools Display Modes
06/22/18, 07:52 AM   #1
OblivionNW
Join Date: Jan 2018
Posts: 2
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>
  Reply With Quote
06/22/18, 08:04 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
My first guess is, that your TopLevel has no size and therefore no mouse-active area.

Last edited by votan : 06/22/18 at 09:36 AM. Reason: typo
  Reply With Quote
06/22/18, 09:20 AM   #3
OblivionNW
Join Date: Jan 2018
Posts: 2
Yup, that was it. Thanks!
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » UI Window isn't movable

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