Archived

This topic is now archived and is closed to further replies.

aboeing

listbox notify

Recommended Posts

hi i just wanted to know how to know when someone right clicks in a listbox control. im using win32 and as far as i can see there only seems to be a LBN_DBLCLK notification... (i want to display a pop-up menu when this happens..) cheerz

Share this post


Link to post
Share on other sites
figured it out, just using the WM_CONTEXTMENU message to get all right clicks and then testing if the mouse position is within the controls rectange (GetWindowRect( hwt, &pos)

ive actually got another problem, in that the list box contains a fair number of items, however i want to refresh this information every second or so, and clearing the listbox and re-adding the items is highly annoying, is there a better way to do this? (can you simply replace the existing text for an item somehow?)

cheers

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
try sending the listbox a WM_SETREDRAW with FALSE, then do the clearing/re-adding, then send another WM_SETREDRAW with TRUE, then invalidate the window to force it to redraw.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
also, to speed up the refresh, instead of clearing/re-adding, just do a LB_DELETESTRING followed by a LB_INSERTSTRING for the item(s) that change.

Share this post


Link to post
Share on other sites