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:
AsylumNotifier.Jump = WINDOW_MANAGER:CreateTopLevelWindow("JumpNofifier");
AsylumNotifier.Jump:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, AsylumNotifier.vars.jump_left, AsylumNotifier.vars.jump_top);
AsylumNotifier.Jump:SetClampedToScreen(true);
AsylumNotifier.Jump:SetMouseEnabled(true);
AsylumNotifier.Jump:SetMovable(true);
AsylumNotifier.Jump:SetHandler("OnMoveStop", AsylumNotifier.OnJumpMoveStop);
AsylumNotifier.Jump.label = WINDOW_MANAGER:CreateControl(nil, AsylumNotifier.Jump, CT_LABEL);
AsylumNotifier.Jump.label:SetDimensions(400, 40);
AsylumNotifier.Jump.label:SetAnchor(TOPLEFT, AsylumNotifier.Jump, TOPLEFT, 0, 0);
AsylumNotifier.Jump.label:SetFont('$(BOLD_FONT)|$(KB_48)|soft-shadow-thick');
AsylumNotifier.Jump.label:SetText('JUMP NOTIFIER');
AsylumNotifier.Jump.label:SetHidden(true);
AsylumNotifier.Jump.fragment = ZO_HUDFadeSceneFragment:New(AsylumNotifier.Jump);
Later on in the code this function:
Lua Code:
function AsylumNotifier.OnJumpMoveStop( )
AsylumNotifier.vars.jump_left = AsylumNotifier.Jump:GetLeft();
AsylumNotifier.vars.jump_top = AsylumNotifier.Jump:GetTop();
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:
<TopLevelControl name="JumpNotifier" mouseEnabled="true" movable="true" clampedToScreen="true" hidden="true">
<OnMoveStop>
AsylumNotifier.OnJumpMoveStop()
</OnMoveStop>
<Controls>
<Label name="$(parent).label" text="JUMP NOTIFIER" horizontalAlignment="LEFT" verticalAlignment="BOTTOM" font="$(BOLD_FONT)|$(KB_48)|soft-shadow-thick">
<AnchorFill/>
</Label>
</Controls>
</TopLevelControl>