ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Making something movable that is also a button ... kinda? (https://www.esoui.com/forums/showthread.php?t=6191)

Arbil 03/18/16 03:43 PM

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>

coolmodi 03/18/16 04:15 PM

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.


All times are GMT -6. The time now is 10:11 AM.

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