Skip to main content
gamedev.net
🔒 Locked

VC++ 6.0 problem

Started by TrickHat 2 replies 650+ views
Original Post
TrickHat
TrickHat
I'm working on building Utility program for a MUD to simplify coding. Currently, I'm trying to use an MFC application, with Doc/View Arch. My trouble comes from getting information from the view(more specifically, a tree dialog) back to the document. I know I can use MyDoc* pDoc = GetDocument(); to get the document object, but I can't think of a way to collate the tree with the information in the document. (ie: Is there a way to get an id#, or text, or some kind of identifier from the selected HTREEITEM in the tree?) Any help would be /greatly/ appreciated. TrickHat
felisandria
felisandria
I generally use SetItemData to set the item data of the tree elements to the corresponding data pointer for the information of that node. Then when I call GetSelectedItem and GetItemData on the returned selection, I can correlate it with the data pointer in the document.

You can also GetItemText on the returned GetSelectedItem, if you just want the text.

-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
Anon Mike
Anon Mike
This has something approaching zero to do with VC6...

Anyway, Get/SetItemData is the usual thing to do with Win32 controls in general. If you don't want to do that for some reason you can always just create a map, e.g. std::map<HTREEITEM, id/text/whatever>.

-Mike
TrickHat
TrickHat
Thanks both.

Another question...I wish to use tab controls in the dialogs for this utility, though I've never used them before. Is there any good sites that explain how to use these controls you know of?

Thanks again, TrickHat

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.