Click here to Skip to main content
15,905,508 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Communication of CCheckListViewCtrl with parent CMainFrame Pin
Vlad010-Jun-07 8:11
Vlad010-Jun-07 8:11 
GeneralRe: Communication of CCheckListViewCtrl with parent CMainFrame Pin
Stuart Dootson10-Jun-07 8:27
professionalStuart Dootson10-Jun-07 8:27 
GeneralRe: Communication of CCheckListViewCtrl with parent CMainFrame Pin
Vlad011-Jun-07 8:20
Vlad011-Jun-07 8:20 
GeneralRe: Communication of CCheckListViewCtrl with parent CMainFrame Pin
Stuart Dootson11-Jun-07 8:40
professionalStuart Dootson11-Jun-07 8:40 
GeneralRe: Communication of CCheckListViewCtrl with parent CMainFrame Pin
Vlad012-Jun-07 8:20
Vlad012-Jun-07 8:20 
GeneralRe: Communication of CCheckListViewCtrl with parent CMainFrame Pin
Stuart Dootson12-Jun-07 8:57
professionalStuart Dootson12-Jun-07 8:57 
GeneralRe: Communication of CCheckListViewCtrl with parent CMainFrame [modified] Pin
Vlad013-Jun-07 5:13
Vlad013-Jun-07 5:13 
GeneralRe: Communication of CCheckListViewCtrl with parent CMainFrame Pin
Stuart Dootson12-Jun-07 11:17
professionalStuart Dootson12-Jun-07 11:17 
OK - I knocked up a quick sample using splitters and list views.

1. Creating the list view (and a rich edit control) as children of a splitter - this is part of CMainFrame::OnCreate:

splitter_.Create(*this, rcDefault, 0, 0, WS_EX_CLIENTEDGE);
list_.Create(splitter_, rcDefault, 0, CControlWinTraits::GetWndStyle(0)|LVS_OWNERDATA|LVS_REPORT, CControlWinTraits::GetWndExStyle(0), 1234, 0);
edit_.Create(splitter_, rcDefault, 0,
             WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|ES_READONLY|ES_AUTOHSCROLL|ES_AUTOVSCROLL|ES_MULTILINE);
edit_.SetFont(AtlGetStockFont(ANSI_FIXED_FONT));
m_hWndClient = splitter_;
splitter_.SetSplitterPanes(list_, edit_);
list_.AddColumn(_T("Test"), 0);
list_.SetItemCount(20);
UpdateLayout();
splitter_.SetSplitterPos(200);


The controls are declared as members of CMainFrame with these types:

CSplitterWindow splitter_;
CListViewCtrl list_;
CRichEditCtrl edit_;


Note that LVS_OWNERDATA is part of the window style (i.e. ORed with styles like WS_VISIBLE etc). SetItemCount tells the list view what items to ask for.

2. I handle notifications like this:

MainFrm.h: (this is within the CMainFrame definition)
BEGIN_MSG_MAP(CMainFrame)
   MESSAGE_HANDLER(WM_CREATE, OnCreate)
   MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
   COMMAND_ID_HANDLER(ID_APP_EXIT, OnFileExit)
   COMMAND_ID_HANDLER(ID_FILE_NEW, OnFileNew)
   COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout)
   NOTIFY_HANDLER(1234, LVN_GETDISPINFO, OnGetDispInfo)
   NOTIFY_HANDLER(1234, LVN_ODSTATECHANGED, OnODStateChanged)
   CHAIN_MSG_MAP(CUpdateUI<CMainFrame>)
   CHAIN_MSG_MAP(CFrameWindowImpl<CMainFrame>)
END_MSG_MAP()
LRESULT OnGetDispInfo(WORD /*wID*/, LPNMHDR nmHeader, BOOL&);
LRESULT OnODStateChanged(WORD /*wID*/, LPNMHDR nmHeader, BOOL&);


MainFrm.cpp:
LRESULT CMainFrame::OnGetDispInfo(WORD /*wID*/, LPNMHDR nmHeader, BOOL&)
{
    NMLVDISPINFO* getDispInfo = reinterpret_cast<NMLVDISPINFO*>(nmHeader);

    getDispInfo->item.state = LVIF_TEXT;

    CString s;
    s.Format(_T("%d"), getDispInfo->item.iItem);

    lstrcpy(getDispInfo->item.pszText, s);


    return 0;
}

LRESULT CMainFrame::OnODStateChanged(WORD /*wID*/, LPNMHDR nmHeader, BOOL&)
{
    OutputDebugString(_T("CMainFrame::OnODStateChanged"));
    return 0;
}


LVN_ODSTATECHANGED is fired by the list view when you do a Shift-click to select multiple items. LVN_ITEMCHANGED seems to be fired when single items are selected.

Anyway - hope this helps.
GeneralRe: Communication of CCheckListViewCtrl with parent CMainFrame [modified] Pin
Vlad013-Jun-07 5:58
Vlad013-Jun-07 5:58 
QuestionUsing fonction recv , dynamic buffer Pin
NorGUI8-Jun-07 4:23
NorGUI8-Jun-07 4:23 
AnswerRe: Using fonction recv , dynamic buffer Pin
Stuart Dootson8-Jun-07 11:08
professionalStuart Dootson8-Jun-07 11:08 
QuestionDereferencing a function pointer in std::map Pin
Cpt Rick8-Jun-07 2:37
Cpt Rick8-Jun-07 2:37 
AnswerRe: Dereferencing a function pointer in std::map [modified] Pin
Stuart Dootson8-Jun-07 2:57
professionalStuart Dootson8-Jun-07 2:57 
GeneralRe: Dereferencing a function pointer in std::map Pin
Cpt Rick8-Jun-07 3:16
Cpt Rick8-Jun-07 3:16 
Questionplease Its Urgent Pin
Banks K7-Jun-07 20:03
Banks K7-Jun-07 20:03 
AnswerRe: please Its Urgent Pin
Paul Conrad14-Jul-07 11:11
professionalPaul Conrad14-Jul-07 11:11 
QuestionWhy can not define _ATL_MIN_CRT in Service Project? Pin
samfromcn6-Jun-07 23:05
samfromcn6-Jun-07 23:05 
AnswerRe: Why can not define _ATL_MIN_CRT in Service Project? Pin
Stuart Dootson7-Jun-07 0:27
professionalStuart Dootson7-Jun-07 0:27 
Questionhow can an ATL get its own name in the container? Pin
Rex.xie6-Jun-07 3:14
Rex.xie6-Jun-07 3:14 
AnswerRe: how to get the instance name of an ATL shown in the container. Pin
Steve S7-Jun-07 2:36
Steve S7-Jun-07 2:36 
GeneralRe: how to get the instance name of an ATL shown in the container. Pin
Rex.xie7-Jun-07 16:47
Rex.xie7-Jun-07 16:47 
GeneralRe: how to get the instance name of an ATL shown in the container. Pin
Steve S11-Jun-07 21:22
Steve S11-Jun-07 21:22 
GeneralRe: how to get the instance name of an ATL shown in the container. Pin
Rex.xie11-Jun-07 21:30
Rex.xie11-Jun-07 21:30 
Questionhow to block print screen with C++ Pin
satish_abiram5-Jun-07 3:17
satish_abiram5-Jun-07 3:17 
AnswerRe: how to block print screen with C++ Pin
Fatbuddha 113-Jun-07 2:21
Fatbuddha 113-Jun-07 2:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.