Exemple #1
0
        public void Test02_SelectRadioButton()
        {
            var radio = new RadioButtonControl();

            radio.SystemUnderTest(new ControlLocatorDef <FindControl>(
                                      () => new FindWindow("Demo Form"),
                                      () => new FindByAutomationId("radioButton3")
                                      ));
            radio.Selected = true;
            Assert.IsTrue(radio.Selected);
            radio.UnSelect();
        }
Exemple #2
0
 //Event Process
 public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     if (!Owner.Locked && e.Button != System.Windows.Forms.MouseButtons.Right)
     {
         List <RadioButtonControl> RadioButtons = this.RadioButtonList.Where(item => item.Bounds.Contains(e.CanvasLocation)).ToList();
         if (RadioButtons.Count != 0)
         {
             this.RadioButton             = RadioButtons[0];
             this.RadioButton.IsMouseDown = true;
         }
     }
     return(base.RespondToMouseDown(sender, e));
 }
Exemple #3
0
        private string GetRadioButtonHtml(RadioButtonControl control)
        {
            string id = GetControlID(control);

            return(string.Format("<span style=\"{0}\"><input style=\"vertical-align:middle;width:{1}px;border:none;padding:0;margin:0 5px 0 0;\" type=\"radio\" name=\"{2}\" value=\"{3}\" onclick=\"{4}\" id=\"{5}\" {6}/><label style=\"{9}\" for=\"{7}\">{8}</label></span>",
                                 // style
                                 GetRadioButtonStyle(control),
                                 // width
                                 Zoom(10),
                                 // name
                                 control.Name,
                                 // value
                                 control.Text,
                                 // onclick
                                 GetEvent(ONCLICK, control, SILENT_RELOAD, $"document.getElementById('{id}').checked"),
                                 // title
                                 id,
                                 control.Checked ? "checked" : "",
                                 id,
                                 control.Text,
                                 GetControlFont(control.Font)
                                 ));
        }
Exemple #4
0
        public System.Web.UI.Control GetWebControl(System.Web.HttpServerUtility server, System.Xml.XmlNode renderingDocument)
        {
            PlaceHolder ph = new PlaceHolder();

            Label lbl = new Label();

            if (renderingDocument.Attributes["renderedLabel"] != null)
            {
                lbl.Text = renderingDocument.Attributes["renderedLabel"].Value.FromXmlValue2Render(server);
            }
            else
            {
                lbl.Text = this.Name.FromXmlName2Render(server);
            }
            lbl.CssClass = "label";
            ph.Controls.Add(lbl);

            bool        isRadio = ((XmlSchemaSimpleTypeRestriction)((XmlSchemaSimpleType)elemPointer.SchemaType).Content).Facets.Count <= MAX_ELEM_BEFORE_DROPDOWN;
            ListControl radio;

            if (isRadio)
            {
                radio = new RadioButtonControl(this);
            }
            else
            {
                radio = new DropDownListControl(this);
            }

            foreach (ListItem i in radio.Items)
            {
                i.Text = i.Text.FromXmlValue2Render(server);
            }

            if (isRadio && radio.Items.Count > 0)
            {
                radio.Items[0].Selected = true;
            }

            //--Rendering Document
            XmlAttribute clas = renderingDocument.Attributes["class"];
            XmlAttribute rel  = renderingDocument.Attributes["rel"];

            if (clas != null && rel != null)
            {
                foreach (ListItem el in isRadio ? ((RadioButtonControl)radio).Items : ((DropDownListControl)radio).Items)
                {
                    el.Attributes.Add("class", clas.Value.FromXmlValue2Render(server));
                    //el.Attributes.Add("rel", rel.Value.FromXmlValue2Render(server));
                }
            }
            if (renderingDocument.Attributes["description"] != null)
            {
                radio.ToolTip = renderingDocument.Attributes["description"].Value.FromXmlValue2Render(server);
            }
            //--
            if (isRadio)
            {
                if (radio.Items.Count > MAX_ELEM_BEFORE_VERTICAL_ALIGN)
                {
                    ((RadioButtonControl)radio).RepeatDirection = RepeatDirection.Vertical;
                    // ((RadioButtonControl)radio).RepeatColumns = 5;
                }
                else
                {
                    ((RadioButtonControl)radio).RepeatDirection = RepeatDirection.Horizontal;
                }
            }

            /* if (!Common.getElementFromSchema(baseSchema).IsNillable)
             * {
             *   RequiredFieldValidator rqfv = new RequiredFieldValidator();
             *   rqfv.ErrorMessage = "Required field: select an option";
             *   rqfv.ControlToValidate = radio.ID;
             *   rqfv.ValidationGroup = "1";
             *   ph.Controls.Add(rqfv);
             * }*/
            ph.Controls.Add(radio);
            return(ph);
        }
Exemple #5
0
 private void RadioButtonClick(RadioButtonControl rb, string data)
 {
     rb.Checked = data == "true";
     rb.FilterData();
     rb.OnClick(null);
 }
Exemple #6
0
 private string GetRadioButtonStyle(RadioButtonControl control)
 {
     return($"{GetControlPosition(control)} {GetControlFont(control.Font)}");
 }