How to update the selected item path in ComboBox
-
Can somebody help me in the case that i want that the path of the selected item in the treecrtl should get updated or what we say get selected inthe combobox box .. How to achieve that.... Thanks in Advance Saniaaa
-
Can somebody help me in the case that i want that the path of the selected item in the treecrtl should get updated or what we say get selected inthe combobox box .. How to achieve that.... Thanks in Advance Saniaaa
saniaa wrote:
what we say get selected inthe combobox box ..
CComboBox::GetCurSel(); or if you want to Search for a string in the list box of a combo box and, if the string is found, select the string in the list box and copy the string to the edit control you can use, CComboBox::SelectString();
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Can somebody help me in the case that i want that the path of the selected item in the treecrtl should get updated or what we say get selected inthe combobox box .. How to achieve that.... Thanks in Advance Saniaaa
Here it is. CString csTreeItem = m_ObjTree.GetItemText(m_ObjTree.GetSelectedItem()); CString csComboItem; for( int nInd =0; nInd < m_ObjCombo.GetCount(); nInd++ ) { ObjCombo.GetLBText(nInd, csComboItem); if( 0 == csComboItem.compare(csTreeItem )) { ObjCombo.SetCurSel(nInd ); break; } }
-
Here it is. CString csTreeItem = m_ObjTree.GetItemText(m_ObjTree.GetSelectedItem()); CString csComboItem; for( int nInd =0; nInd < m_ObjCombo.GetCount(); nInd++ ) { ObjCombo.GetLBText(nInd, csComboItem); if( 0 == csComboItem.compare(csTreeItem )) { ObjCombo.SetCurSel(nInd ); break; } }
Thanks for ur reply.. Acccording to ur way as per my understanding my combobox should have the selected item from the treectrl in its datalist ,and then comparing it with the one selected , it is updating in comboboox. But if i have the simple combbox datalist which just have the datlist items like C:\ ,D:\ not the whole contents of the drives ... in such sitution do we manage it ??? Thanks Saniaa
-
saniaa wrote:
what we say get selected inthe combobox box ..
CComboBox::GetCurSel(); or if you want to Search for a string in the list box of a combo box and, if the string is found, select the string in the list box and copy the string to the edit control you can use, CComboBox::SelectString();
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
Thanks for ur reply ... The Datlist of the combobox does not contain the item which is get selected in the treectrl . The way u have given is for that situation. Here combobox just contain C:\,D:\ like this dataitems in it. and when the selection in the treectrl gets changed i want the changed or selected item path should get updated in the combobox . Is there any way to achieve this.. Thanks Shikha
-
Can somebody help me in the case that i want that the path of the selected item in the treecrtl should get updated or what we say get selected inthe combobox box .. How to achieve that.... Thanks in Advance Saniaaa
Hi, I'm not sure ... you've got a combobox only with drive letters and on treectrl full path, and when you select some path on tree, in combobox should appear full path ? If yes: - HTREEITEM GetSelectedItem() - you'll get selected item handle - CString GetItemText( HTREEITEM hItem ) - you'll get item text - HTREEITEM GetParentItem( HTREEITEM hItem ) - you'll get parents' item handle - CString GetItemText( HTREEITEM hItem ) - you'll get item text ... unless your parents' item handle will equal with root - HTREEITEM GetRootItem( ) when you'll get all path, you can send all text to combobox - int InsertString( int nIndex, LPCTSTR lpszString ) and select - int SetCurSel( int nSelect );
----------- Mila
-
Thanks for ur reply.. Acccording to ur way as per my understanding my combobox should have the selected item from the treectrl in its datalist ,and then comparing it with the one selected , it is updating in comboboox. But if i have the simple combbox datalist which just have the datlist items like C:\ ,D:\ not the whole contents of the drives ... in such sitution do we manage it ??? Thanks Saniaa
Sorry. I don't get ur need clearly. if the selected tree control item not in ur combo box, You want to add it in the combo and select that one?? or map to any other item??
-
Can somebody help me in the case that i want that the path of the selected item in the treecrtl should get updated or what we say get selected inthe combobox box .. How to achieve that.... Thanks in Advance Saniaaa
Do you select an item on treectrl and you want to compare it with item on combobox
WhiteSky
-
Do you select an item on treectrl and you want to compare it with item on combobox
WhiteSky
Combobox is not having the item which got selected in the treectrl .so my requiremant is that, as the treectrl item get selected or get changed the combobox should show the current path of the item(which got selected on the treectrl) in its editbox.Is it possible..?and How ? God hepls those who hepls themselves .... Thanks in advance Saniaa
-
Combobox is not having the item which got selected in the treectrl .so my requiremant is that, as the treectrl item get selected or get changed the combobox should show the current path of the item(which got selected on the treectrl) in its editbox.Is it possible..?and How ? God hepls those who hepls themselves .... Thanks in advance Saniaa
You select an item on treectrl and now you want to display this item on ComboBox(edit),Right?
WhiteSky