// a activation du composant (par click souris ou tabulation clavier) private void Field_Input_Enter(object sender, EventArgs e) { XmlNode root; TextBox tinput = (TextBox)sender; mod_global.Focused_Control = Field_Input; mod_global.MF.InputPreviewTb.Text = Field_Input.Text; if (tinput.Tag.ToString() == "item") { mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"].Enabled = true; mod_global.MF.SaisieTabControl.SelectedTab = mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"]; mod_global.MF.SaisieTabControl.TabPages["VideoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["DateTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["PhotoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["AudioTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SectionTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SchemaTab"].Enabled = false; mod_global.MF.flowLayoutPanel2.Controls.Clear(); multiple_choice_button but; root = mod_global.Get_Codes_Id_DocElement(); //On utilise un navigateur pour pouvoir trier les noeuds XPathNavigator nav = root.CreateNavigator(); XPathExpression exp = nav.Compile("/codes/code[id='" + field_label.Name + "']/valeur/item"); exp.AddSort("@position", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number); foreach (XPathNavigator item in nav.Select(exp)) { string but_text = item.GetAttribute("nom", "") + " | " + item.Value; if (item.GetAttribute("lien", "") == "") { if (item.GetAttribute("ajoute", "") == "true") { but = new multiple_choice_button(but_text, null, false, true); } else { but = new multiple_choice_button(but_text, null, false, false); } } else if (item.GetAttribute("lien", "") == "true") { but = new multiple_choice_button(but_text, null, true, false); } else { but = new multiple_choice_button(but_text, null, false, false); } mod_global.MF.flowLayoutPanel2.Controls.Add(but); } /* ANCIEN CODE NS remplacé par GB le 16/12/2009 * XmlNode node; * * node = root.SelectSingleNode("/codes/code[id='" + field_label.Name + "']/valeur"); * * foreach (XmlNode nod in node.ChildNodes) * { * string but_text = nod.Attributes["nom"].InnerText + " | " + nod.InnerText; * * if (nod.Attributes.GetNamedItem("lien") == null) * but = new multiple_choice_button(but_text, null, false); * else * if (nod.Attributes["lien"].InnerText == "true") * but = new multiple_choice_button(but_text, null, true); * else * but = new multiple_choice_button(but_text, null, false); * * mod_global.MF.flowLayoutPanel2.Controls.Add(but); * * }*/ } else if (tinput.Tag.ToString() == "texte") { mod_global.MF.flowLayoutPanel2.Controls.Clear(); mod_global.MF.virtual_kb1.Set_Alpha_Numeric(); mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"].Enabled = true; mod_global.MF.SaisieTabControl.SelectedTab = mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"]; mod_global.MF.SaisieTabControl.TabPages["VideoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["DateTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["PhotoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["AudioTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SectionTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SchemaTab"].Enabled = false; } else if (tinput.Tag.ToString() == "numerique") { mod_global.MF.flowLayoutPanel2.Controls.Clear(); mod_global.MF.virtual_kb1.Set_Only_Numeric(); mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"].Enabled = true; mod_global.MF.SaisieTabControl.SelectedTab = mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"]; mod_global.MF.SaisieTabControl.TabPages["VideoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["DateTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["PhotoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["AudioTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SectionTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SchemaTab"].Enabled = false; } else if (tinput.Tag.ToString() == "date") { mod_global.MF.SaisieTabControl.TabPages["DateTab"].Enabled = true; mod_global.MF.SaisieTabControl.SelectedTab = mod_global.MF.SaisieTabControl.TabPages["DateTab"]; mod_global.MF.SaisieTabControl.TabPages["VideoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["PhotoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["AudioTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SectionTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SchemaTab"].Enabled = false; } else if (tinput.Tag.ToString() == "horaire") { mod_global.MF.SaisieTabControl.TabPages["SectionTab"].Enabled = true; mod_global.MF.section_horaire1.Init_Section_Img(mod_accueil.FORME_OUVRAGE); mod_global.MF.SaisieTabControl.SelectedTab = mod_global.MF.SaisieTabControl.TabPages["SectionTab"]; mod_global.MF.SaisieTabControl.TabPages["DateTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["VideoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["PhotoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["AudioTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SchemaTab"].Enabled = false; } }
private void Carac_Tb_OnClick(object sender, EventArgs e) { XmlNode root; XmlNode node; TextBox Field_Input = (TextBox)sender; root = mod_global.Get_Codes_Obs_DocElement(); node = root.SelectSingleNode("/codes/code[id='" + current_code + "']/caracteristiques/caracteristique[@nom='" + Field_Input.Tag + "']"); mod_global.Focused_Control = Field_Input; mod_global.Focused_Carac_Panel = this; mod_global.MF.InputPreviewTb.Text = Field_Input.Text; // Afficher l'info au Status Panel if (node.Attributes["info"] != null) { mod_global.MF.statusPanel.Text = node.Attributes["info"].InnerText; } else { mod_global.MF.statusPanel.Text = ""; } //On applique le mode de saisie correspondant au champ focused if (node.Attributes["type"].InnerText == "item") { mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"].Enabled = true; mod_global.MF.SaisieTabControl.SelectedTab = mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"]; mod_global.MF.SaisieTabControl.TabPages["VideoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["DateTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["PhotoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["AudioTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SectionTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SchemaTab"].Enabled = false; mod_global.MF.flowLayoutPanel2.Controls.Clear(); //On utilise un navigateur pour pouvoir trier les noeuds XPathNavigator nav = root.CreateNavigator(); XPathExpression exp = nav.Compile("/codes/code[id='" + current_code + "']/caracteristiques/caracteristique[@nom='" + Field_Input.Tag + "']/item"); exp.AddSort("@position", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number); foreach (XPathNavigator item in nav.Select(exp)) { multiple_choice_button but; string but_text = item.GetAttribute("nom", "") + " | " + item.Value; //Si le choix contient des attributs concernant le comportement des champs suivants (on teste la présence de q1 comme attribut du choix en cours) if (item.GetAttribute("q1", "") != "") { but = new multiple_choice_button(but_text, Get_CaracFieldsNewState_HT(item), false, false); } else if (item.GetAttribute("lien", "") == "") { if (item.GetAttribute("ajoute", "") == "true") { but = new multiple_choice_button(but_text, null, false, true); } else { but = new multiple_choice_button(but_text, null, false, false); } } else if (item.GetAttribute("lien", "") == "true") { but = new multiple_choice_button(but_text, null, true, false); } else { but = new multiple_choice_button(but_text, null, true, false); } mod_global.MF.flowLayoutPanel2.Controls.Add(but); } /* ANCIEN CODE NS remplacé par GB le 16/12/2009 * foreach (XmlNode nod in node.ChildNodes) * { * multiple_choice_button but; * string but_text = nod.Attributes["nom"].InnerText + " | " + nod.InnerText; * * //Si le choix contient des attributs concernant le comportement des champs suivants (on teste la présence de q1 comme attribut du choix en cours) * if (nod.Attributes.GetNamedItem("q1") != null) * but = new multiple_choice_button(but_text, Get_CaracFieldsNewState_HT(nod), false); * else * if (nod.Attributes.GetNamedItem("lien") == null) * but = new multiple_choice_button(but_text, null, false); * else * if (nod.Attributes["lien"].InnerText == "true") * but = new multiple_choice_button(but_text, null, true); * else * but = new multiple_choice_button(but_text, null, true); * * * mod_global.MF.flowLayoutPanel2.Controls.Add(but); * }*/ } else if (node.Attributes["type"].InnerText == "texte") { mod_global.MF.flowLayoutPanel2.Controls.Clear(); mod_global.MF.virtual_kb1.Set_Alpha_Numeric(); mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"].Enabled = true; mod_global.MF.SaisieTabControl.SelectedTab = mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"]; mod_global.MF.SaisieTabControl.TabPages["VideoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["DateTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["PhotoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["AudioTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SectionTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SchemaTab"].Enabled = false; } else if (node.Attributes["type"].InnerText == "numerique") { mod_global.MF.flowLayoutPanel2.Controls.Clear(); mod_global.MF.virtual_kb1.Set_Only_Numeric(); mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"].Enabled = true; mod_global.MF.SaisieTabControl.SelectedTab = mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"]; mod_global.MF.SaisieTabControl.TabPages["VideoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["DateTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["PhotoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["AudioTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SectionTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SchemaTab"].Enabled = false; } else if (node.Attributes["type"].InnerText == "date") { mod_global.MF.SaisieTabControl.TabPages["DateTab"].Enabled = true; mod_global.MF.SaisieTabControl.SelectedTab = mod_global.MF.SaisieTabControl.TabPages["DateTab"]; mod_global.MF.SaisieTabControl.TabPages["VideoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["PhotoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["AudioTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SectionTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SchemaTab"].Enabled = false; } else if (node.Attributes["type"].InnerText == "video") { mod_global.MF.SaisieTabControl.TabPages["VideoTab"].Enabled = true; mod_global.MF.SaisieTabControl.SelectedTab = mod_global.MF.SaisieTabControl.TabPages["VideoTab"]; mod_global.MF.SaisieTabControl.TabPages["DateTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["PhotoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["AudioTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SectionTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SchemaTab"].Enabled = false; } else if (node.Attributes["type"].InnerText == "photo") { mod_global.MF.SaisieTabControl.TabPages["PhotoTab"].Enabled = true; mod_global.MF.photo_select1.Read_Photos_From_TextList(mod_global.Focused_Control.Text); mod_global.MF.SaisieTabControl.SelectedTab = mod_global.MF.SaisieTabControl.TabPages["PhotoTab"]; mod_global.MF.SaisieTabControl.TabPages["DateTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["VideoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["AudioTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SectionTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SchemaTab"].Enabled = false; } else if (node.Attributes["type"].InnerText == "audio") { mod_global.MF.SaisieTabControl.TabPages["AudioTab"].Enabled = true; mod_global.MF.SaisieTabControl.SelectedTab = mod_global.MF.SaisieTabControl.TabPages["AudioTab"]; mod_global.MF.SaisieTabControl.TabPages["DateTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["VideoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["PhotoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SectionTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SchemaTab"].Enabled = false; } else if (node.Attributes["type"].InnerText == "horaire") { mod_global.MF.SaisieTabControl.TabPages["SectionTab"].Enabled = true; mod_global.MF.section_horaire1.Init_Section_Img(current_forme); mod_global.MF.SaisieTabControl.SelectedTab = mod_global.MF.SaisieTabControl.TabPages["SectionTab"]; mod_global.MF.SaisieTabControl.TabPages["DateTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["KeyboardTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["VideoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["PhotoTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["AudioTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["ChoiceTab"].Enabled = false; mod_global.MF.SaisieTabControl.TabPages["SchemaTab"].Enabled = false; } }