NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 19 20 21 22 23 … 93 Next »
Popup box with buttons?

 
  • 0 Vote(s) - 0 Average
Popup box with buttons?
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#21
2010-01-08, 03:42 PM
McBainUK Wrote:Also in ShowDetailsPopup.xml there's this line:
<Placement name="FirstButton" loc="20.5,19" offset="5.5" />
Do you have a code sample for creating a vertical list of buttons?
I dont really have any ready to go code for this, but it be something like...

Initialisation:
Code:
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// determine button placement
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]buttonOrigin = skinHelper2.getPlacementPos([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"FirstButton"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]XmlNode[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] node = skinHelper2.getPlacementNode([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"FirstButton"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
buttonOffset = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]float[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Parse(node.Attributes.GetNamedItem([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"offset"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]).InnerText, System.Globalization.[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]NumberFormatInfo[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].InvariantInfo);
[/SIZE]

GetRenderList:
Code:
...
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// add buttons
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] buttonIndex = 0;
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]foreach[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]UiButton[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] button [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]in[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] buttonList)
{
[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]PointF[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] centerPoint = buttonOrigin;
centerPoint.Y = buttonOrigin.Y + (buttonOffset * buttonIndex);
button.position = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]RectangleF[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](centerPoint.X - (button.normalSize.Width / 2), centerPoint.Y - (button.normalSize.Height / 2), button.normalSize.Width, button.normalSize.Height);[/SIZE][SIZE=2]
renderList.AddRange(button.GetRenderList());
[/SIZE][SIZE=2]buttonIndex++;
}
[/SIZE][SIZE=2]...[/SIZE][SIZE=2]
[/SIZE]
McBainUK
Offline

Posting Freak

Posts: 4,711
Threads: 429
Joined: Sep 2005
#22
2010-01-08, 03:43 PM
sub Wrote:I check which button is selected, then call "handleCommand(selectedButton.GetName())"
And you determine the selected button by looking for the one with a button state of UiButton.State.Active?
Wiki profile
My Projects
Programs Plugin [SIZE=2](retired)
| Volume OSD Plugin (retired) | Documentation Wiki (retired)
[/SIZE]
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#23
2010-01-08, 04:01 PM
Yeah, pretty much.
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,104
Threads: 957
Joined: May 2006
#24
2010-08-06, 03:42 AM
Sub, I am trying to add buttons to the Popups\ScheduleRecording.xml skin and I'm trying to equate the code in this thread with NPVR code, but the button the UiButton() has changed to take a Hashtable and not take a Rectangle. What goes in the args?

Here are the two buttons I want to create.

Code:
    <Element name="ScheduleRecording" location="7,10" size="86,80" alpha="220" okButton="40,83" cancelButton="60,83">

Thanks,

Martin
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#25
2010-08-06, 03:56 AM
mvallevand Wrote:Sub, I am trying to add buttons to the Popups\ScheduleRecording.xml skin and I'm trying to equate the code in this thread with NPVR code, but the button the UiButton() has changed to take a Hashtable and not take a Rectangle. What goes in the args?

Here are the two buttons I want to create.

Code:
    <Element name="ScheduleRecording" location="7,10" size="86,80" alpha="220" okButton="40,83" cancelButton="60,83">
I dont really understand the question. Are you trying to create a new popup that uses the existing Popups\ScheduleRecording.xml skin file? (ie the screen with left/right scrollers for pre/post padding, quality etc, and the OK + Cancel buttons at the bottom)

The discussion earlier in this thread isnt too relevent. Popups and buttons etc changed quite a bit with NPVR.

In general though, the location and size of the UiButton control is set with uiButton.Location = new Rectanglef(x,y,w,h);
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,104
Threads: 957
Joined: May 2006
#26
2010-08-06, 03:59 AM
Yes, I am trying to duplicate almost exactly that screen, however I am not clear on what goes in args

okButton = new UiButton("PopupCenterButtonNormal", "PopupCenterButtonSelected", "OK", args, skinHelper);

The relative position on the attribute seems ok.

Martin
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#27
2010-08-06, 04:01 AM
Personally I'm not passing anything in for args. ie, "new Hashtable()".
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (3): « Previous 1 2 3


Possibly Related Threads…
Thread Author Replies Views Last Post
  Single row horizontal list in popup? cncb 4 2,255 2011-09-28, 09:48 PM
Last Post: cncb
  Disappearing popup message McBainUK 6 2,761 2010-11-04, 04:55 PM
Last Post: imilne
  Buttons on a popup tmrt 1 1,427 2010-09-28, 04:54 PM
Last Post: sub
  NPVR Popup sample mvallevand 3 1,672 2010-07-14, 07:54 PM
Last Post: mvallevand
  Too many buttons in plugin whurlston 7 2,503 2008-05-07, 07:04 PM
Last Post: whurlston
  Popup re-rendering whurlston 2 1,691 2008-05-03, 07:21 AM
Last Post: whurlston
  onKeyDown called on main plugin from Popup whurlston 1 1,401 2008-04-01, 07:59 AM
Last Post: whurlston
  Horizontal buttons in popups. whurlston 6 2,394 2008-03-30, 12:19 PM
Last Post: roy
  Skin Files - and Popup skin files psycik 1 1,311 2007-12-09, 03:16 PM
Last Post: sub
  Popup window idkpmiller 2 1,544 2007-04-30, 06:14 AM
Last Post: idkpmiller

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

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

Linear Mode
Threaded Mode