View Single Post
02/01/19, 05:23 PM   #1
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
Moving a control with

Hey guys, I need some help with the following task:



I want the icon to be dragable, but only by clicks inside the green square in it's top left corner.

If I apply SetMouseEnabled(true) and SetMovable(true) to the base control, the whole control will react to mouse clicks, not only the green square.

If I apply SetMouseEnabled(true) and SetMovable(true) to the green square, then only the green square reacts to mouse clicks, but the icon does not move with it despite being it's parent element.

This is the XML code:


Code:
<!-- Icon aura -->
<Control name="AM_IconAuraControl" virtual="true" clampedToScreen="true">
	<!--<Anchor point="TOPLEFT" relativeTo="AuraMasteryTLW" anchorPoint="TOPLEFT" />-->
	<Controls>
			
		<Control name="$(parent)_Anchor" hidden="true">
			<Dimensions x="12" y="12" />
			<Anchor point="TOPLEFT" relativeTo="$(parent)" anchorPoint="TOPLEFT" />
			<Controls>
				<Backdrop name="$(parent)_Backdrop" centerColor="FF00FF00" edgeColor="FF000000" level="2">
					<AnchorFill />
					<Edge edgeSize="1" /> 
				</Backdrop>
				<Label name="$(parent)_LabelCoords" font="$(BOLD_FONT)|16|soft-shadow-thin" color="00FF00" text="400,400">
					<Anchor point="TOP" relativeTo="$(parent)" anchorPoint="TOP" offsetY="-20" />	
				</Label>
			</Controls>
		</Control>
	
		<Backdrop name="$(parent)_Backdrop">
			<AnchorFill />
		</Backdrop>
		<Cooldown name="$(parent)_Cooldown" fillColor="000000BF" horizontalAlignment="TEXT_ALIGN_CENTER" verticalAlignment="TEXT_ALIGN_CENTER">
			<AnchorFill />
		</Cooldown>
		<Label name="$(parent)_Label">
			<Anchor point="TOPLEFT" relativeTo="$(parent)" anchorPoint="TOPLEFT" offsetX="2" offsetY="2" />
			<Anchor point="BOTTOMRIGHT" relativeTo="$(parent)" anchorPoint="BOTTOMRIGHT" offsetX="-2" offsetY="-2" />
		</Label>
		<Texture name="$(parent)_Icon">
			<AnchorFill />
		</Texture>
	</Controls>
</Control>

Last edited by Letho : 02/01/19 at 05:26 PM.
  Reply With Quote