• Lunes 29 de Abril de 2024, 05:01

Autor Tema:  Ayuda Urgente!!!  (Leído 1062 veces)

cz2002

  • Nuevo Miembro
  • *
  • Mensajes: 14
    • Ver Perfil
Ayuda Urgente!!!
« en: Domingo 20 de Junio de 2004, 20:35 »
0
nesecito ayuda de ustedes!! la cosa está así..

ocupo llenar un arbol de la A a Z como  raíz. eso ya lo hice y me carga perfectamente bien!!

ahora bien por medio de cajas de texto ocupo recuperar cualquier nombre e insertarlo en el arbol en orden alfabetico. osea que si digito España, me inserte españa en la le E que ya está insertada.

no he podido definir como usar  exactamente el InsertItem();


tengo:

HTREEITEM hItem;
hItem = m_arbol.InsertItem("E");
m_arbol.InsertItem( "España", hItem );

pero me crea otra vez la letra E  en la raíz

ayudenme por favor!!!

cz2002

  • Nuevo Miembro
  • *
  • Mensajes: 14
    • Ver Perfil
Re: Ayuda Urgente!!!
« Respuesta #1 en: Lunes 21 de Junio de 2004, 17:07 »
0
HEEEEEEEEEEEEEEEEEELPPPP

Eternal Idol

  • Moderador
  • ******
  • Mensajes: 4696
  • Nacionalidad: ar
    • Ver Perfil
Re: Ayuda Urgente!!!
« Respuesta #2 en: Lunes 21 de Junio de 2004, 17:12 »
0
Las MFC son un infierno y te recomiendo que las dejes lo más pronto posible, de todas maneras fijate si este ejemplo de la MSDN te ayuda:

// Gain a pointer to our tree control

CTreeCtrl* pCtrl = (CTreeCtrl*) GetDlgItem(IDC_TREE1);
ASSERT(pCtrl != NULL);

// Insert a root item using the structure. We must
// initialize a TVINSERTSTRUCT structure and pass its
// address to the call.

TVINSERTSTRUCT tvInsert;
tvInsert.hParent = NULL;
tvInsert.hInsertAfter = NULL;
tvInsert.item.mask = TVIF_TEXT;
tvInsert.item.pszText = _T("United States");

HTREEITEM hCountry = pCtrl->InsertItem(&tvInsert);

// Insert subitems of that root. Pennsylvania is
// a state in the United States, so its item will be a child
// of the United States item. We won't set any image or states,
// so we supply only the TVIF_TEXT mask flag. This
// override provides nearly complete control over the
// insertion operation without the tedium of initializing
// a structure. If you're going to add lots of items
// to a tree, you might prefer the structure override
// as it affords you a performance win by allowing you
// to initialize some fields of the structure only once,
// outside of your insertion loop.

HTREEITEM hPA = pCtrl->InsertItem(TVIF_TEXT,
   _T("Pennsylvania"), 0, 0, 0, 0, 0, hCountry, NULL);

// Insert the "Washington" item and assure that it is
// inserted after the "Pennsylvania" item. This override is
// more appropriate for conveniently inserting items with
// images.

HTREEITEM hWA = pCtrl->InsertItem(_T("Washington"),
   0, 0, hCountry, hPA);

// We'll add some cities under each of the states.
// The override used here is most appropriate
// for inserting text-only items.

pCtrl->InsertItem(_T("Pittsburgh"), hPA, TVI_SORT);
pCtrl->InsertItem(_T("Harrisburg"), hPA, TVI_SORT);
pCtrl->InsertItem(_T("Altoona"), hPA, TVI_SORT);

pCtrl->InsertItem(_T("Seattle"), hWA, TVI_SORT);
pCtrl->InsertItem(_T("Kalaloch"), hWA, TVI_SORT);
pCtrl->InsertItem(_T("Yakima"), hWA, TVI_SORT);

 :ph34r:  :comp:  :hola:

Nacional y Popular En mi país la bandera de Eva es inmortal.


Queremos una Argentina socialmente justa, económicamente libre y  políticamente soberana.
¡Perón cumple, Evita dignifica!


La mano invisible del mercado me robo la billetera.