Jump to content
  • Advertisement
Sign in to follow this  
Sawsan Emam

problem with Tree View Control

This topic is 3410 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Everyone, i am using Win32 API and i am using the Tree Controls to show some data contained in some binary file i created ... my problem is the next section of code is work properly ... but when i replace NM_DBLCLK with NM_CLICK ... it return the wrong Tree Node. actually, it returns the previous selected Tree Node ... example: when i select the first Node it gives the error message saying "No Item Selected" then when i choose let's say Node 2 .. it shows the Content of Node 1 .. then when i select Node 4 (for example) it shows the Content of Node 2 and so on ... can anyone tell me where's my mistake ??? case WM_NOTIFY: switch(LOWORD(wParam)) { case IDC_TREE: switch(((LPNMHDR)lParam)->code) { case NM_DBLCLK: { TVITEM tvi; char *Text = NULL; HTREEITEM selected = NULL; selected = (HTREEITEM) SendDlgItemMessage(hWnd, IDC_TREE, TVM_GETNEXTITEM, TVGN_CARET, 0); if(selected == NULL) { MessageBox(hWnd, "NO Item Selected", "Error", MB_OK | MB_ICONERROR); break; } Text = getSelectedFilePath(hWnd, selected); HBITMAP hBmp = getThumbNail(Text); if(hBmp == NULL) SendDlgItemMessage(hMainWindow, IDC_IMAGE, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hNoThumb); else SendDlgItemMessage(hMainWindow, IDC_IMAGE, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmp); SetDlgItemText(hWnd, IDC_EDIT, Text); } break; } break; } break;

Share this post


Link to post
Share on other sites
Advertisement
It probably happens because the double click notification is sent before the selected item actually changes.
Try catching TVN_SELCHANGED notification.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!