NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 43 44 45 46 47 … 93 Next »
How do you use skinHelper.getNamedImageElementPos(name,element) ??

 
  • 0 Vote(s) - 0 Average
How do you use skinHelper.getNamedImageElementPos(name,element) ??
JavaWiz
Offline

Posting Freak

Jacksonville, FL. USA
Posts: 2,522
Threads: 141
Joined: Dec 2006
#1
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.

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?
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#2
2007-05-19, 02:52 AM
The getNamedImageElementPos() and getNamedImageElementSize() methods are used to find the location of <Element> tags defined composite images, rather than the composite images themselves.

For example, from the FM Radio skin:

Code:
        <CompositeImage name="ScanningPopup" size="720,480">
            <DrawRoundedRect loc="50,120" size="635,240" radius="@PopupCornerRadius" borderWidth="@PopupBorderWidth" borderColor="PopupBorder" fillColor="PopupBackground"/>        
            <DrawText text="Scanning for FM radio stations..." loc="70,135" size="480,30" textStyle="GeneralText" align="Left" visible="true"/>                                    
            <DrawText text="Checking: " loc="70,165" size="480,30" textStyle="GeneralText" align="Left" visible="true"/>                                        
            <DrawText text="@currentFrequency" loc="200,165" size="200,30" textStyle="GeneralText" align="Left" visible="true"/>                                                
            <DrawText text="@lockStatus" loc="310,165" size="200,30" textStyle="LockText" align="Left" visible="true"/>                                
            <DrawText text="@message" loc="70,270" size="600,30" textStyle="GeneralText" align="Left" visible="true"/>                                
[b]            <Element name="scanPositionGraphic" loc="160,220" size="430,17" />
            <Element name="Skip" loc="165,310" size="130,40"/>
            <Element name="Keep" loc="300,310" size="130,40"/>
            <Element name="Cancel" loc="435,310" size="130,40"/>[/b]
        </CompositeImage>

getNamedImageElementPos("ScanningPopup", "Skip") would return 165,310 in the example above
JavaWiz
Offline

Posting Freak

Jacksonville, FL. USA
Posts: 2,522
Threads: 141
Joined: Dec 2006
#3
2007-05-19, 03:08 AM
Ah, ok. Is there anyway to determine where a composite element is postioned within the skin itself. In other words, if I have a text box, button, label, list, whatever, can I determine it's topmost x,y coordinate?
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#4
2007-05-19, 03:28 AM
No, this is usually up to the plugin developer and the plugin itself. The skinhelper doesnt know what the developer is going to do with that composite image. The plugin could show that composite image a dozen times on the screen in different places - for example all the buttons are the same composite image, shown all over the place.
JavaWiz
Offline

Posting Freak

Jacksonville, FL. USA
Posts: 2,522
Threads: 141
Joined: Dec 2006
#5
2007-05-19, 04:34 AM
Ok, good point, I wasn't thinking of it that way....

Any ideas how I might go about determining where in a text box the user clicked based on the location being sent in the onClick event. It seems something must know since there is a method off the control:

bool clickedInThisControl = control.OnClick(location)

that returns a boolean as to wheter the click occurred within the boundaries of this control. What I'd like to know is where in the control did the user click AND what are the dimensions of the control (be it a text box, label, list,...).
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#6
2007-05-19, 06:02 AM
Are you talking about your own plugin? If so, you should know where on the screen your own components are. An OnClick() handler would usually have some logic that would check these.

This isnt really something GB-PVR has visibility of. Basically it informs a plugin that the user has clicked in a specific place, and the plugin can return 'true' if the screen needs to be updated in response to this (which will trigger GB-PVR to call the render() function on the plugin). It has no idea if the user clicked on something, or if so what.
McBainUK
Offline

Posting Freak

Posts: 4,711
Threads: 429
Joined: Sep 2005
#7
2007-05-19, 08:28 AM
May be useful to have a look at the source for one of my plugins or the UI libary. Most have source on their wiki page.
Wiki profile
My Projects
Programs Plugin [SIZE=2](retired)
| Volume OSD Plugin (retired) | Documentation Wiki (retired)
[/SIZE]
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Possible to have another element in details-single.xml Northpole 2 2,188 2014-07-11, 09:51 PM
Last Post: Northpole
  GetRenderList() always called with "block-extras..." element in renderlist alibert 1 1,593 2012-06-18, 10:24 AM
Last Post: sub
  Element explanations? PatM 12 3,802 2012-03-12, 10:16 PM
Last Post: PatM
  Skin element Details in NowNext Jaggy 2 1,772 2011-09-19, 11:50 PM
Last Post: Jaggy
  Add another element to the horizontal main menu Northpole 7 2,805 2011-08-25, 06:18 PM
Last Post: imilne
  Actual size of inner element in NPVR scb147 2 1,735 2010-11-02, 06:40 PM
Last Post: scb147
  SkinHelper fall back to Default ACTCMS 4 1,936 2010-10-31, 03:03 PM
Last Post: ACTCMS
  TV Guide Element Render order Northpole 0 1,273 2010-10-24, 04:11 PM
Last Post: Northpole
  pluginSkinHelper.getNamedImageElementPos herrmannj 1 1,246 2009-12-06, 01:50 AM
Last Post: sub
  skinhelper idkpmiller 8 2,569 2006-12-13, 10:49 PM
Last Post: ubu

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode