What is the proper way to conect?

0 views
Skip to first unread message

iko...@earthlink.net

unread,
Nov 20, 2009, 6:29:46 PM11/20/09
to wx-u...@googlegroups.com
Hi, ALL,
I have a dialog with 2 list boxes.
I am trying to do the following:

list_box_1->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( CMyDialog::OnSelect ) );

However, it looks like I don't have access to CMyDialog data
from CMyDialog::OnSelect() function.

What did I do wrong?

Thank you.

Kenneth Porter

unread,
Nov 20, 2009, 6:49:15 PM11/20/09
to wx-u...@googlegroups.com
--On Friday, November 20, 2009 6:29 PM -0500 iko...@earthlink.net wrote:

> However, it looks like I don't have access to CMyDialog data
> from CMyDialog::OnSelect() function.

Exact error message?


Vadim Zeitlin

unread,
Nov 20, 2009, 7:44:42 PM11/20/09
to wx-u...@googlegroups.com
On Fri, 20 Nov 2009 18:29:46 -0500 (EST) iko...@earthlink.net wrote:

> list_box_1->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( CMyDialog::OnSelect ) );

You must use the sink argument of Connect() when connecting to a method of
another object (how do you think is wx supposed to know on which CMyDialog
to call this method if you don't tell it?). This is one of the main reasons
why Bind() is better than it.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

iko...@earthlink.net

unread,
Nov 20, 2009, 10:16:44 PM11/20/09
to wx-u...@googlegroups.com
Thank you, Vadim.
For some reason, when I tried to use Bind() my VC6 came back
saying "there is no such method in wxListbox"...

Vadim Zeitlin

unread,
Nov 20, 2009, 11:14:57 PM11/20/09
to wx-u...@googlegroups.com
On Fri, 20 Nov 2009 22:16:44 -0500 (EST) iko...@earthlink.net wrote:

> For some reason, when I tried to use Bind() my VC6 came back
> saying "there is no such method in wxListbox"...

Bind() is not available for VC6, this compiler is too broken to support

Reply all
Reply to author
Forward
0 new messages