Click here to Skip to main content
15,913,115 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: Connection points for Chat server using ATL/COM Pin
Roger Stoltz12-Jun-07 21:31
Roger Stoltz12-Jun-07 21:31 
GeneralWTL 8.0 Released! Pin
Rob Caldecott11-Jun-07 12:43
Rob Caldecott11-Jun-07 12:43 
GeneralRe: WTL 8.0 Released! Pin
Stuart Dootson11-Jun-07 21:10
professionalStuart Dootson11-Jun-07 21:10 
GeneralRe: WTL 8.0 Released! Pin
DevMentor.org11-Jul-07 23:59
DevMentor.org11-Jul-07 23:59 
QuestionTool Tip on List Control Pin
Abhijeet Rajput10-Jun-07 23:33
Abhijeet Rajput10-Jun-07 23:33 
QuestionCommunication of CCheckListViewCtrl with parent CMainFrame Pin
Vlad09-Jun-07 7:53
Vlad09-Jun-07 7:53 
AnswerRe: Communication of CCheckListViewCtrl with parent CMainFrame Pin
Stuart Dootson9-Jun-07 14:39
professionalStuart Dootson9-Jun-07 14:39 
GeneralRe: Communication of CCheckListViewCtrl with parent CMainFrame Pin
Vlad010-Jun-07 7:37
Vlad010-Jun-07 7:37 
Stuart Dootson wrote:
I think LVN_ITEMCHANGED is what you want. It is sent whenever an item changes someway - that includes when the item state changes - and the item state will change when the item is selected or de-selected

It'll be related to NOTIFY_HANDLER(_EX) - I'm afraid I don't have access to a machine with WTL on at the moment (I use OS X at home), so I can't tell you outright.


I've installed an excellent VS add-on: WTL Helper
by Sergey Solozhentsev http://www.codeproject.com/macro/wtlhelper.asp[^]

It inserted an adequate message handler for LVN_ITEMCHANGED
into Message Map of CMainFrame:

NOTIFY_CODE_HANDLER_EX(LVN_ITEMCHANGED, OnLvnItemChanged)

and created the prototipe of the handler:

LRESULT CMainFrame::OnLvnItemChanged(LPNMHDR pnmh)
{
LPNMLISTVIEW pnmv = (LPNMLISTVIEW)pnmh;
//If the iItem member of the structure pointed to by pnmv is -1,
//the change has been applied to all items in the list view.

return 0;
}

for this handler.

To test the handler I added first the code ignoring the parameter pnmv:

m_wndView2.AppendText(L"Item changed!\n");

Here m_wndView2 is the right pane, i.e. rich edit control.

This code produced one strange phenomenon:
if one clicks with the mouse on some non selected item
(when only one other item is selected) the line "Item changed!"
appears THREE times instead of 2. I do not know why.

If one changes this code, taking into account the parameter pnmv:

if((pnmv->uNewState&LVNI_SELECTED)!=(pnmv->uOldState&LVNI_SELECTED))
m_wndView2.AppendText(L"Item changed!\n");

then the line "Item changed!" is printed 2 times, as expected.

But there is one problem with this message handler.
If one adds at once 100 items to selected one (via SHIFT+Left mouse click),
then OnLvnItemChanged() executes 100 times: every newly selected item
causes the execution. I will not permit to redraw rich edit pane 100 times:
texts corresponding to items of ListView can be quite large.
So I would like to have 1 single notification instead of 100.
If I could determine somehow which of these 100 notifications is the last
one in a series, I would react only on this last message. But I see no way
to catch the last message in a series. OK, there is one clumsy way:
to add a timer to CMainFrame, showing how much time is passed
after the last LVN_ITEMCHANGED message.
If this time becomes more than, say, 2ms, then
CMainFrame should update rich edit pane...
But this way is both too clumsy and too ugly.
Do there exists a more elegant way?

Stuart Dootson wrote:
I suspect Michael Dunn's articles on WTL (here's the one about splitters[^]) will tell you all you need to know - I've always found them very useful!


Yes, I became acquainted with WTL reading the first articles of the series:
"WTL for MFC programmers". They really turned out to be invaluable
source of info. In spite of the fact that the last time I used MFC
was about 5--6 years ago, so I remember almost nothing about MFC
except magic words "Doc/View paradigm" Smile | :)

And I've used some code from later articles of the series.
In particular ListView in my program is borrowed from article VI.
I believe this will not be the last borrowing Smile | :)
GeneralRe: Communication of CCheckListViewCtrl with parent CMainFrame Pin
Stuart Dootson10-Jun-07 7:55
professionalStuart Dootson10-Jun-07 7:55 
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 
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 

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.