WTL & CListViewCtrl 
Author Message
 WTL & CListViewCtrl

Hi,

I seem to have a problem that I can't sort using WTL and the common
control list view.

I want to put a WTL CListViewCtrl control on a dialog and be able to
edit the items by clicking once to enter edit mode. I've created the
control with the following:

        m_ListView.Create(m_hWnd,
        CRect(0, 0, rect.right, rect.bottom),
        NULL,
        LVS_EDITLABELS  | LVS_REPORT |  WS_CHILD | WS_VISIBLE);
        m_ListView.InsertColumn(0, "col1", LVCFMT_LEFT, -1, -1);
        m_ListView.InsertItem(0, "itm1");
        m_ListView.InsertItem(0, "itm2");

Each time I click on one of the items the listview does display the
edit box ready to edit the text. When I try to type one character into
the edit box the program quits/crashes. I can't seem to find out why.
If I put a break point as the program comes out of the message loop I
can see that the last value for the msg is WM_SETTEXT. I've tried the
equivalent using MFC and it works fine (so my commctl looks okay).

Is this a problem with WTL?

Using NT4 WS, SP 4, IE5.

Thanks for any help - I'm running out of ideas as to what could be
causing this behaviour.

Cheers.
Dave.

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 20 Nov 2002 03:00:00 GMT  
 WTL & CListViewCtrl
I had similar problem with CListCtrl. In my opinion the Wizzard is buggy, it
generates handlers for notification codes from dialog without using
notification code, so the message map looks like:

 BEGIN_MSG_MAP(CLayerDlg)
  MSG_WM_INITDIALOG(OnInitDialog)
  COMMAND_ID_HANDLER(IDOK, OnButtonOk)
  NOTIFY_HANDLER(IDC_LIST_LAYER, LVN_BEGINLABELEDIT, OnBeginLabelEdit)
  NOTIFY_HANDLER(IDC_LIST_LAYER, LVN_ENDLABELEDIT, OnEndLabelEdit)
 END_MSG_MAP()

This is not correct, since the OnButtonOk will be called also for
notifications that happen inside edit control of ListControl. Your dialog
will be closed at unexpected time. So try to change the line to:

  COMMAND_HANDLER(IDOK, BN_CLICKED, OnButtonOk)

Regards, Jan

--

Jan Bares
(remove no.spam from my email address)
JPCAD Graphics Engine developer, surf to http://www.antek.cz



Fri, 22 Nov 2002 03:00:00 GMT  
 WTL & CListViewCtrl
Hi Jan,

Thanks, you were right. I took out the OK button stuff from the message
map and it works fine now - well it doesn't exit unexpectedly anyway.

Thanks for replying.

Cheers,
Dave.



Quote:
> I had similar problem with CListCtrl. In my opinion the Wizzard is
buggy, it
> generates handlers for notification codes from dialog without using
> notification code, so the message map looks like:

>  BEGIN_MSG_MAP(CLayerDlg)
>   MSG_WM_INITDIALOG(OnInitDialog)
>   COMMAND_ID_HANDLER(IDOK, OnButtonOk)
>   NOTIFY_HANDLER(IDC_LIST_LAYER, LVN_BEGINLABELEDIT, OnBeginLabelEdit)
>   NOTIFY_HANDLER(IDC_LIST_LAYER, LVN_ENDLABELEDIT, OnEndLabelEdit)
>  END_MSG_MAP()

> This is not correct, since the OnButtonOk will be called also for
> notifications that happen inside edit control of ListControl. Your
dialog
> will be closed at unexpected time. So try to change the line to:

>   COMMAND_HANDLER(IDOK, BN_CLICKED, OnButtonOk)

> Regards, Jan

> --

> Jan Bares
> (remove no.spam from my email address)
> JPCAD Graphics Engine developer, surf to http://www.antek.cz

Sent via Deja.com http://www.deja.com/
Before you buy.


Fri, 22 Nov 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. WTL CListViewCtrl

2. WTL - Very new to WTL - Trying to insert new COM object in WTL

3. WTL drug &drop

4. WTL 7.0 & ATL Dialog error message

5. WTL & VC7 beta 2

6. compliance problem between (WTL & [SDK/MFC])

7. WTL & ATL

8. WTL & ATL

9. WTL & MIN_CRT

10. compliance problem between (WTL & SDK)

11. ATL & WTL

12. CListViewCtrl and DragAndDrop

 

 
Powered by phpBB® Forum Software