This post is pinned, but appears to be from over 15 years ago. Is the information still relevant?
I am fairly new to wxwidgets programming, however I have done a significiant amount with GUIs in the past.
I'm confused by events in wxwigets. There are event tables, functions like Connect and also Bind. I understand that event tables are an old way of doing things: Setting events up statically at compile time, and that Connect is dynamic, and newer, but that Bind is newer still and is now the prefered way to handle events.
With sockets, there also appear to be a further function: SetEventHandler().
So am I to use a combination of SetEventHandler and Bind? I don't understand why SetEventHandler is neccessary. It appears to be a member function of either the client or server socket, and takes as argument an EventHandler, of which the wxWindow is a derived class.
The arguments to Bind also appear to be very strange. It takes a few arguments, one of which is the address of the callback function, but NONE of which are a server or client socket structure.
Even weirder are that some graphical user interface objects inherit from wxWindow, but this is a tangent at this point.
Sockets FAQ/Tutorial
Re: Sockets FAQ/Tutorial
Honestly, i don't know. I'd use the "sockets" sample that comes with wxWidgets as reference.This post is pinned, but appears to be from over 15 years ago. Is the information still relevant?
This is all correct. Although i personally think it's still ok to use static event tables. Bind() does the same as Connect(), but it has additional typesafety at compile time that avoid mistakes that often lead to crashes when using Connect(). For that reason Connect() should be avoided.I'm confused by events in wxwigets. There are event tables, functions like Connect and also Bind. I understand that event tables are an old way of doing things: Setting events up statically at compile time, and that Connect is dynamic, and newer, but that Bind is newer still and is now the prefered way to handle events.
Usually, with GUI events, the window is the natural event handler. But with sockets, it's unclear where socket events get sent to. That's why you need to call SetEventHandler()With sockets, there also appear to be a further function: SetEventHandler().
Use the source, Luke!