//---------------------------------------------------------------- protected override void MyCreateControle( CCreateur2iFormulaireV2 createur, C2iWnd wnd, Control parent, IFournisseurProprietesDynamiques fournisseurProprietes) { C2iWndTextBox wndTextBox = wnd as C2iWndTextBox; if (wndTextBox != null) { m_textBox = new C2iTextBox(); m_textBox.TextChanged += new EventHandler(CWndFor2iTextBox_TextChanged); m_textBox.Size = wndTextBox.Size; CCreateur2iFormulaireV2.AffecteProprietesCommunes(wndTextBox, m_textBox); m_textBox.Multiline = wndTextBox.Multiline; if (m_textBox.Multiline) { m_textBox.ScrollBars = ScrollBars.Vertical; } parent.Controls.Add(m_textBox); if (wndTextBox.Inspiration.Count() > 0) { m_textBox.Enter += new EventHandler(m_textBox_Enter); } } }
//--------------------------------------------- protected override void MyAppliqueRestriction( CRestrictionUtilisateurSurType restrictionSurObjetEdite, CListeRestrictionsUtilisateurSurType listeRestrictions, IGestionnaireReadOnlySysteme gestionnaireReadOnly) { if (EditedElement != null && m_textBox != null) { ERestriction rest = restrictionSurObjetEdite.RestrictionGlobale; C2iWndTextBox wndTxt = WndAssociee as C2iWndTextBox; if (wndTxt != null) { CDefinitionProprieteDynamique def = wndTxt.Property; if (def != null) { rest = def.GetRestrictionAAppliquer(restrictionSurObjetEdite); } } switch (rest) { case ERestriction.ReadOnly: case ERestriction.Hide: { gestionnaireReadOnly.SetReadOnly(m_textBox, true); break; } default: break; } } }
//---------------------------------------------------------------- void CWndFor2iTextBox_TextChanged(object sender, EventArgs e) { C2iWndTextBox txt = WndAssociee as C2iWndTextBox; if (txt != null && txt.AutoSetValue) { MajChamps(false); } if (m_gridView != null) { m_gridView.NotifyCurrentCellDirty(true); } CUtilControlesWnd.DeclencheEvenement(C2iWndTextBox.c_strIdEvenementTextChanged, this); }
void m_textBox_Enter(object sender, EventArgs e) { if (!m_bInspirationIsCalc) { m_bInspirationIsCalc = true; C2iWndTextBox wndTextBox = WndAssociee as C2iWndTextBox; C2iTextBox txtBox = Control as C2iTextBox; if (txtBox != null && wndTextBox != null && wndTextBox.Inspiration.Count() > 0) { IEnumerable <string> lst = CFournisseurInspiration.GetInspiration(wndTextBox.Inspiration); if (lst != null) { txtBox.AutoCompleteMode = AutoCompleteMode.Suggest; txtBox.AutoCompleteSource = AutoCompleteSource.CustomSource; txtBox.AutoCompleteCustomSource.Clear(); txtBox.AutoCompleteCustomSource.AddRange(lst.ToArray()); } } } }