Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange values of TVITEM Item.state 1

Status
Not open for further replies.

firelex

Programmer
Jan 10, 2002
118
DE
Hello, all!
The problem is:

Code:
CTreeCtrl* pTree = (CTreeCtrl*) GetDlgItem(IDC_START_TREE);
HTREEITEM hDadItem = pTree->GetSelectedItem();
TVITEM ItemData;
TCHAR szText[1024];

ItemData.mask = TVIF_TEXT | TVIF_HANDLE;
ItemData.hItem = hDadItem;
ItemData.pszText = szText;
ItemData.cchTextMax = 1024;

pTree->GetItem(&ItemData);
...
now, in ItemData.state should(!!) be some of the following :
[tt]TVIS_EXPANDED, TVIS_BOLD, TVIS_CUT, TVIS_DROPHILITED, TVIS_EXPANDEDONCE, TVIS_EXPANDPARTIAL, TVIS_SELECTED[/tt]

with the values

[tt]TVIS_EXPANDED == 32,
TVIS_BOLD == 16,
TVIS_CUT == 4,
TVIS_DROPHILITED == 8,
TVIS_EXPANDEDONCE == 64,
TVIS_EXPANDPARTIAL == 128,
TVIS_SELECTED == 2[/tt]

BUT instead TRACE and debugger show some strage things like 2, 64, 66, 98...

Any ideas??
 
As you can see all of that values are flags. There could be set any combination of them.
To verify a flag instead of
if(xxx == TVIS_SELECTED) you should use
if(xxx & TVIS_SELECTED)

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top