2010-01-08, 03:42 PM
McBainUK Wrote:Also in ShowDetailsPopup.xml there's this line:I dont really have any ready to go code for this, but it be something like...
<Placement name="FirstButton" loc="20.5,19" offset="5.5" />
Do you have a code sample for creating a vertical list of buttons?
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);
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]