2007-05-19, 02:40 AM
I am trying to figure out how to use a method from the skinHelper object.
skinHelper.getNamedImageElementPos(name, element)
What are name and element variables?
What I am trying to do is determine where in a text box a user has clicked the mouse. I am trying to use the above method to determine the location of the text box, and then another method (getNamedElementSize) to determine the height. Based on this information, I should be able to determine where in the text box the user clicked when the onClick event fires.
My skin has the following:
When this code executes, I always get back 0,0 for both the point and the size....
What am I doing wrong?
skinHelper.getNamedImageElementPos(name, element)
What are name and element variables?
What I am trying to do is determine where in a text box a user has clicked the mouse. I am trying to use the above method to determine the location of the text box, and then another method (getNamedElementSize) to determine the height. Based on this information, I should be able to determine where in the text box the user clicked when the onClick event fires.
Code:
[FONT=Courier New][COLOR=#2b91af]Point[/COLOR] txtBoxLoc = mDlgSkinHelper.getNamedImageElementPos("InfoDialog", [COLOR=#a31515]"InfoTextImage"[/COLOR]);[/FONT]
[FONT=Courier New][COLOR=#2b91af]Size[/COLOR] txtBoxSz = mDlgSkinHelper.getNamedImageElementSize([COLOR=#a31515]"InfoDialog"[/COLOR], [COLOR=#a31515]"InfoTextImage"[/COLOR]);[/FONT]
[FONT=Courier New][COLOR=#0000ff]if[/COLOR] (location.Y < (txtBoxLoc.Y + (txtBoxSz.Height / 2)) )[/FONT]
[SIZE=1]....[/SIZE]
My skin has the following:
Code:
<SpecialElement name="InfoDialog" loc="25,35"/>
<CompositeImage name="InfoDialog" size="670,430">
<!-- The main dialog box window -->
<DrawRoundedRect borderColor="White" fillColor="Black" loc="2,2" size="665,420" radius="5" borderWidth="3" />
<DrawImage filename="..\_CoreImages\Background.jpg" loc="5,5" size="660,415" />
<!-- The title bar -->
<DrawText text="@title" loc="15,5" size="565,30" textStyle="ScreenName" align="Left"/>
</CompositeImage>
<CompositeImage name="InfoTextImage" size="650,330">
<DrawImage filename="@image" loc="10,10" size="645,320"/>
</CompositeImage>
When this code executes, I always get back 0,0 for both the point and the size....
What am I doing wrong?