List Info

Thread: Capture click event on static text?




Capture click event on static text?
user name
2006-04-24 15:57:35

> > >   m_txtUrl->Connect( wxID_URL, wxEVT_LEFT_DOWN,
>; > >   ;  wxCommandEventHandler(AboutDlg::OnURLClick) );
> > >
> > >Seems to work OK
> >
> > Great! I think you might need to add the 'sink' object,
> > i.e. a pointer to the dialog, to make sure it works
>; > reliably.
>
>
>Please excuse my stupidity.  I tend to write in Perl and Ruby these
>;days and this is my first quick project in C++ for a while.  Can you
>please explain what you mean in terms that a dumbo like me can follow...

No problem, it's not entirely obvious. When you do a connect
using syntax as per your example above, wxWidgets expects
the function to be in the object you called Connect on,
i.e. m_txtUrl. If you want the receiving object to be
a different object, you need to add a further argument to
connect, i.e. your dialog that contains OnURLClick.

Admittedly this could be explained better in the docs...

Regards,

Julian



[1]

about | contact  Other archives ( Real Estate discussion Medical topics )