c++ - CListCtrl selection -


i'm trying think simple can't seem make work!

i have clistctrl , want select last element in list if user clicks in view empty space. can calling select(lastelementinlist), element selected , unselected still has "bounding rectangle" around it.

the code implements follows:

    int nsel = getnextitem(-1, lvni_selected);     if (nsel != -1)         setitemstate(nsel, 0, lvis_selected);      select(lastelementinlist); 

any hints? missing?

the "bounding rectangle" see indicates element "focused", ie. in state user interaction, such pressing down , arrows, start off point.


change focused element

to move focus newly selected element you'll have use setitemstate lvis_focused, in below example:

if (nsel != -1)     setitemstate (nsel, ~lvis_focused, lvis_focused);          // (1)  setitemstate (lastelementinlist, lvis_focused, lvis_focused);  // (2) 

// (1) -> remove focus `nsel` // (2) -> add focus `lastelementinlist` 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -