//------------------------------------------------------------- private void ImplementeTemplate() { using (CWaitCursor waiter = new CWaitCursor()) { m_toolTip.SetToolTip(m_txtLibelle, ""); if (Besoin != null && Besoin.IsNew() && m_listeTemplates != null && !Besoin.HasChildren && !m_bIsEntering && !m_bIsInitializing && m_extModeEdition.ModeEdition) { m_listeTemplates.Filtre = new CFiltreData(CPhaseSpecifications.c_champLibelle + "=@1 and " + CPhaseSpecifications.c_champUseAsTemplate + "=@2", m_txtLibelle.Text, true); if (m_listeTemplates.Count > 0) { Besoin.Libelle = m_txtLibelle.Text; Besoin.ApplyTemplate(m_listeTemplates[0] as CPhaseSpecifications); ((CControleListeBesoins)AssociatedListControl).AddItemsFils((CItemBesoin)CurrentItem); MyInitChamps(CurrentItem); int?nItem = AssociatedListControl.CurrentItemIndex; AssociatedListControl.CurrentItemIndex = nItem; AssociatedListControl.Refresh(); } } } }
private void m_txtLibelle_Enter(object sender, EventArgs e) { if (!m_bIsEntering) { m_bIsEntering = true; if (m_listeTemplates == null && m_extModeEdition.ModeEdition && Besoin != null) { m_txtLibelle.AutoCompleteCustomSource = new AutoCompleteStringCollection(); m_listeTemplates = new CListeObjetDonneeGenerique <CPhaseSpecifications>(Besoin.ContexteDonnee, new CFiltreData(CPhaseSpecifications.c_champUseAsTemplate + "=@1", true)); m_listeTemplates.AssureLectureFaite(); m_listeTemplates.InterditLectureInDB = true; m_txtLibelle.AutoCompleteMode = AutoCompleteMode.Suggest; m_txtLibelle.AutoCompleteSource = AutoCompleteSource.CustomSource; foreach (CPhaseSpecifications phase in m_listeTemplates) { m_txtLibelle.AutoCompleteCustomSource.Add(phase.Libelle); } } if (Besoin != null && Besoin.IsValide() && Besoin.IsNew() && m_extModeEdition.ModeEdition) { m_txtLibelle.AutoCompleteMode = AutoCompleteMode.Suggest; } else { m_txtLibelle.AutoCompleteMode = AutoCompleteMode.None; } m_bIsEntering = false; } }