How to get the image from a clistctrl?
-
Hi, i need to get the imagenumber from a clistctrl on which i added a imagelist. At the OnDoubleClick event i need to get the imagenumber from the selected item. Is there any way to retrieve the number? I want to compare like if (imagenumber == CONST_BITMAP_FOLDER) { Send next command } thx!
-
Hi, i need to get the imagenumber from a clistctrl on which i added a imagelist. At the OnDoubleClick event i need to get the imagenumber from the selected item. Is there any way to retrieve the number? I want to compare like if (imagenumber == CONST_BITMAP_FOLDER) { Send next command } thx!
See
CListCtrl::GetItem()
andLVITEM
. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com -
See
CListCtrl::GetItem()
andLVITEM
. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com -
I do this @ doubleclick event:
LVITEM lvi; int nimage; int nitem; nitem=m_ctlServerList.GetSelectionMark(); m_ctlServerList.GetItem(&lvi); nimage=lvi.iImage;
The Problem is lvi.iImage returns always 0.Couple of comments:
- You should intialize
lvi
to zero to ensure the code works correctly in release mode. - You need to do
lvi.mask = LVIF_IMAGE;
before callingGetItem()
.
Hope this helps! /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com
- You should intialize
-
Couple of comments:
- You should intialize
lvi
to zero to ensure the code works correctly in release mode. - You need to do
lvi.mask = LVIF_IMAGE;
before callingGetItem()
.
Hope this helps! /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com
Yeah it works fine! thx! I got a new problem. I Fill a list control with stuff which is todo, i call it todolist. The size of the ctrl displays 3 items without scrolling (item count varies). I want to scroll to the current proccess item. I´ve tried alot but didnt get any good result. Here´s a code snipped:
m_nTodoItem=nitem; //Scrolling m_pCtlListTodo->GetItemRect(0,rect,LVIR_ICON); size.cy=0; //m_pCtlListTodo->Scroll(-5000); size.cy=nitem * rect.Height(); //scrollpos=m_pCtlListTodo->GetScrollPos(SB_VERT); //size.cy-=scrollpos; m_pCtlListTodo->SetScrollPos(SB_VERT,0); m_pCtlListTodo->Scroll(size); //scrollpos=rect.Height(); m_pCtlListTodo->Scroll(size); //m_pCtlListTodo->SetScrollPos(SB_VERT,scrollpos); m_pCtlListTodo->SetSelectionMark(nitem);
Sometimes just the bars scroll without the content. How to scroll dynamicly with considering user actions. Thx alot for help and sorry for bad english. - You should intialize
-
Yeah it works fine! thx! I got a new problem. I Fill a list control with stuff which is todo, i call it todolist. The size of the ctrl displays 3 items without scrolling (item count varies). I want to scroll to the current proccess item. I´ve tried alot but didnt get any good result. Here´s a code snipped:
m_nTodoItem=nitem; //Scrolling m_pCtlListTodo->GetItemRect(0,rect,LVIR_ICON); size.cy=0; //m_pCtlListTodo->Scroll(-5000); size.cy=nitem * rect.Height(); //scrollpos=m_pCtlListTodo->GetScrollPos(SB_VERT); //size.cy-=scrollpos; m_pCtlListTodo->SetScrollPos(SB_VERT,0); m_pCtlListTodo->Scroll(size); //scrollpos=rect.Height(); m_pCtlListTodo->Scroll(size); //m_pCtlListTodo->SetScrollPos(SB_VERT,scrollpos); m_pCtlListTodo->SetSelectionMark(nitem);
Sometimes just the bars scroll without the content. How to scroll dynamicly with considering user actions. Thx alot for help and sorry for bad english.shibble wrote: I want to scroll to the current proccess item. Assuming you know the index of the item, you can call
CListCtrl::EnsureVisible()
. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com -
shibble wrote: I want to scroll to the current proccess item. Assuming you know the index of the item, you can call
CListCtrl::EnsureVisible()
. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com