Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.
By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.
Generally a good idea, however it would mean adding an additional design feature not used in other parts of the gauge.Put a red dot on the click spot and tell people to click the dot? If your parts are labeled put the click spot on top of the label?
That's quite a nifty solution, thanks for pointing this out! It's essentially calculating a line across the rectangle and then checking on which side of the line the cursor is. The only downside for this particular problem is that the shape of the mouse cursor could potentially turn out the wrong one.Maybe you can get an idea from this post:
http://www.aerodynamika.com/cgi-bin/yabb2/YaBB.pl?num=1312822766
Is there a way to get the X,Y coordinates of the mouse click in the clickable area?
<Gauge Name="possible mouse shape workaround" version="1.0">
<Macro Name="Output">L:Calc_out@1, bool</Macro>
<Macro Name="Turn_On_Child">
<!-- @1 = mouse X position, @2 = mouse Y position, @3 = suffix of L:var -->
@1 128 - sqr @2 128 - sqr + abs 15129 < if{ 1 (>@Output(@3)) }
<!-- just for test digit display -->
@1 (>G:Var1)
@2 (>G:Var2)
</Macro>
<Macro Name="Turn_Off_Child">
<!-- @1 = mouse X position, @2 = mouse Y position, @3 = suffix of L:var -->
@1 128 - sqr @2 128 - sqr + abs 15129 > if{ 0 (>@Output(@3)) }
<!-- just for test digit display -->
@1 (>G:Var3)
@2 (>G:Var4)
</Macro>
<Element Name="Parent Mouse Area Visual">
<Rectangle Width="256" Height="256" FillColor="Blue" Bright="Yes"></Rectangle>
</Element>
<Element Name="Child Activated Area Visual">
<Position X="0" Y="0"/>
<Element Name="Off">
<Visible>(@Output(1)) !</Visible>
<Circle Radius="123" LineWidth="5" Color="Red" FillColor="Blue"/>
</Element>
<Element Name="On">
<Visible>(@Output(1))</Visible>
<Circle Radius="123" LineWidth="5" Color="Red" FillColor="White"/>
</Element>
</Element>
<Element Name="Test Display">
<FormattedText X="256" Y="20" Font="Arial" Color="Yellow" FontSize="14" FontWeight="800" Bright="Yes">
<String>%\{tabs=5L,251R}%Parent = %((G:Var1))%!d!, %((G:Var2))%!d!%\t%Child = %((G:Var3))%!d!, %((G:Var4))%!d!%</String>
</FormattedText>
</Element>
<Mouse>
<!-- parent #1 -->
<!-- rectangular area that engulfs the circle or needed activate area -->
<Area Name="Parent Sensing Area" Left="0" Top="0" Width="256" Height="256">
<!-- no cursor -->
<Cursor Type="None"/>
<!-- no clicks available -->
<Click Kind="Move+Leave">
<!-- send to macro to calculate if in area, return 0 or 1 in L:var based on them -->
(M:Event) 'Move' scmp 0 == if{ @Turn_On_Child((M:X), (M:Y), 1) }
<!-- extra insurance to deactivate child if mouse left rectangle area -->
(M:Event) 'Leave' scmp 0 == if{ 0 (>@Output(1)) }
</Click>
</Area>
<!-- child #1 -->
<!-- rectangular area same size as parent -->
<!-- calculations in macro determine to turn off, IE calculated shape -->
<Area Name="Child Click Area" Left="0" Top="0" Width="256" Height="256">
<!-- turn child area off if inside in defined area in macro -->
<Visible>(@Output(1))</Visible>
<Tooltip ID="">%HEY!! IT WORKS! :)%</Tooltip>
<Cursor Type="Hand"/>
<Click Kind="LeftSingle+Move+Leave">
<!-- send to macro to calculate if in area, return 0 or 1 in L:var based on them -->
(M:Event) 'Move' scmp 0 == if{ @Turn_Off_Child((M:X), (M:Y), 1) }
<!-- extra insurance to deactivate child if mouse left rectangle area -->
(M:Event) 'Leave' scmp 0 == if{ 0 (>@Output(1)) }
(M:Event) 'LeftSingle' scmp 0 == if{
<!-- DO MY STUFF -->
}
</Click>
</Area>
</Mouse>
</Gauge>
<Macro Name="MouseCX">46</Macro>
<Macro Name="MouseCY">46</Macro>
<Macro Name="MouseR1">42</Macro>
<Macro Name="MouseR2">23</Macro>
<Macro Name="MouseR3">16</Macro>
<Comment>
@MouseCX, CY - center
@MouseR1, R2 - outer/inner radius
@MouseR3 - key Alt
L:MouseX,Y - mouse coordinates (relative to CX/CY)
L:MouseD,A - distance and angle (relative to CX/CY)
L:MouseP - active key (0 - none, 1 - key On, 2 - key Off, 3 - key Stby, 4 - key alt
</Comment>
<Macro Name="GetMouseCoordinates">
(M:X) @MouseCX - (>L:MouseX,enum) (M:Y) @MouseCY - (>L:MouseY,enum)
(L:MouseX,enum) sqr (L:MouseY,enum) sqr + sqrt (>L:MouseD,enum)
(L:MouseX,enum) (L:MouseY,enum) /-/ atg2 180 * pi / (>L:MouseA,enum)
(L:MouseD,enum) @MouseR1 > if{ 0 (>L:MouseP,enum) }
els{
(L:MouseD,enum) @MouseR2 >
if{
-30 30 (L:MouseA,enum) rng if{ 1 (>L:MouseP,enum) (* Key ON *) }
els{
90 150 (L:MouseA,enum) rng if{ 2 (>L:MouseP,enum) (* Key OFF *) }
els{
-150 -90 (L:MouseA,enum) rng if{ 3 (>L:MouseP,enum) (* Key STBY *) }
els{ 0 (>L:MouseP,enum) } } } }
els{
(L:MouseD,enum) @MouseR3 > if{ 0 (>L:MouseP,enum) }
els{ 4 (>L:MouseP,enum) (* Key ALT *) } } }
</Macro>
<Mouse>
<Area Name="Cursor Off" Left="53" Top="10" Width="93" Height="93">
<Visible>(L:MouseP,enum) 0 ==</Visible>
<Cursor Type="None"/>
<Click Kind="Move">
@GetMouseCoordinates
0 (>L:KeyPress,enum)
</Click>
</Area>
<Area Name="Cursor On" Left="53" Top="10" Width="93" Height="93">
<Visible>(L:MouseP,enum) 0 !=</Visible>
<Cursor Type="Hand"/>
<Tooltip>%('Key ALT' 'Key STBY' 'Key OFF' 'Key ON' '' 5 (L:MouseP,enum) case)%!s!</Tooltip>
<Click Kind="LeftSingle+LeftRelease+Move">
@GetMouseCoordinates
(M:Event) 'LeftSingle' scmp 0 ==
if{
(L:MouseP,enum) 1 == if{ 1 (>L:KeyPress,enum) }
els{
(L:MouseP,enum) 2 == if{ 2 (>L:KeyPress,enum) }
els{
(L:MouseP,enum) 3 == if{ 3 (>L:KeyPress,enum) }
els{
(L:MouseP,enum) 4 == if{ 4 (>L:KeyPress,enum) }
els{
0 (>L:KeyPress,enum)
} } } } }
(M:Event) 'LeftRelease' scmp 0 == if{ 0 (>L:KeyPress,enum) }
</Click>
</Area>
</Mouse>