Thread Tools Display Modes
03/18/16, 03:43 PM   #1
Arbil
Join Date: Jan 2016
Posts: 1
Making something movable that is also a button ... kinda?

I have little box with a background and border and some text in it. It also has a mouseup event that brings up something else when that event fires. That is the only thing that element does. Can I make this thing movable? It doesn't seem to be working and I am assuming it's because it has the mouseup event. Can I make a mouse down event that makes it so when I click it and hold it it lets me drag it??

Lua Code:
  1. <TopLevelControl name="Blah" hidden="false" movable="true" mouseEnabled="true" clampedToScreen="true" >
  2.         <Anchor point="TOPLEFT" offsetY="20" offsetX="20"/>
  3.         <Dimensions x="400" y="30" />
  4.         <OnHide>
  5.             --PlayFadeAnimationOnControl(Blah,true,100,1000,nil, function() Blah:SetHidden(true) end)
  6.         </OnHide>
  7.         <OnShow>
  8.             --PlayFadeAnimationOnControl(Blah,false,100,1000, function() Blah:SetHidden(false) end, nil)
  9.         </OnShow>
  10.         <OnInitialized>
  11.         </OnInitialized>
  12.         <Controls>
  13.             <Backdrop name="$(parent)BG" inherits="ZO_ThinBackdrop" mouseEnabled="true" movable="true">
  14.                 <Dimensions x="400" y="50"/>
  15.                 <Edge file="EsoUI/Art/Miscellaneous/borderedInsetTransparent_edgeFile.dds" edgeFileWidth="128" edgeFileHeight="16" />
  16.                 <Controls>
  17.                     <EditBox name="QAT_Edit" hidden="true"/>
  18.                     <Label name="$(parent)LocationLabel" font="ZoFontGame" text="Location" mouseEnabled="true">
  19.                         <Anchor point="CENTER" relativeTo="$(parent)"/>
  20.                         <OnMouseUp>
  21.                             --insert Cell click actions here
  22.                             --show/hide sidebar
  23.                             if button==1 then
  24.                                 Blah_ShowSideBar()
  25.                             elseif button==3 then
  26.                                
  27.                             elseif button==2 then
  28.                                 --if scrolling then
  29.                                     --StopCredits()
  30.                                 --else
  31.                                     --scrolling = true
  32.                                     --ShowCredits()
  33.                                 --end
  34.                             end
  35.                         </OnMouseUp>
  36.                     </Label>
  37.                 </Controls>
  38.             </Backdrop>
  39.            
  40.         </Controls>
  41.     </TopLevelControl>
  Reply With Quote
03/18/16, 04:15 PM   #2
coolmodi
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 47
I think your backdrop fills the whole TopLevelControl and blocks mouseinput to it, remove the mouseEnabled="true" from it and it should become movable as long as you don't click on the area the label takes. Clicking on the label will do the other stuff.

You also don't need movable="true" on the backdrop. The TopLevelControl itself is movable so everything in it moves with it.

Edit: If the backdrop is supposed to fill the whole TopLevelControl you could also use <AnchorFill /> instead of dimensions.

Last edited by coolmodi : 03/18/16 at 04:19 PM.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Making something movable that is also a button ... kinda?


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