public void addToContainerWithWeight(cave.ui.CustomContainerWidget container, Windows.UI.Xaml.UIElement child, double weight) { if (weight <= 0.00) { container.addWidget(child); } else if (container is cave.ui.HorizontalBoxWidget) { ((cave.ui.HorizontalBoxWidget)container).addWidget(child, weight); } else if (container is cave.ui.VerticalBoxWidget) { ((cave.ui.VerticalBoxWidget)container).addWidget(child, weight); } else { System.Diagnostics.Debug.WriteLine("[cave.ui.FormWidget.addToContainerWithWeight] (FormWidget.sling:495:2): Tried to add a widget with weight to a container that is not a box. Ignoring weight."); container.addWidget(child); } }
public override void initializeWidget() { base.initializeWidget(); vrb = new System.Collections.Generic.List <cave.ui.RadioButtonWidget.MyRadioButtonWidget>(); cave.ui.CustomContainerWidget box = null; if (widgetOrientation == cave.ui.RadioButtonWidget.HORIZONTAL) { box = (cave.ui.CustomContainerWidget)cave.ui.HorizontalBoxWidget.forContext(context, context.getHeightValue("2500um"), context.getHeightValue("1500um")); } else { box = (cave.ui.CustomContainerWidget)cave.ui.VerticalBoxWidget.forContext(context, context.getHeightValue("2500um"), context.getHeightValue("1500um")); } for (var i = 0; i < cape.Vector.getSize(widgetItems); i++) { var d = cape.Vector.get(widgetItems, i); if (!(d != null)) { continue; } var rb = new cave.ui.RadioButtonWidget.MyRadioButtonWidget(context); rb.setWidgetText(d); rb.setWidgetIndex(i); rb.setWidgetContainer(this); rb.setWidgetFontSize(widgetFontSize); rb.setWidgetFontResource(widgetFontResource); rb.setWidgetColor(widgetOnSelectedColor); vrb.Add(rb); if (widgetOrientation == cave.ui.RadioButtonWidget.HORIZONTAL) { ((cave.ui.HorizontalBoxWidget)box).addWidget((Windows.UI.Xaml.UIElement)rb, 1.00); } else { box.addWidget((Windows.UI.Xaml.UIElement)rb); } } addWidget((Windows.UI.Xaml.UIElement)box); }