I am unfamiliar with this syntax and am having trouble finding info about it...

void MyTextCtrl::OnChar(wxKeyEvent& event)
{
if ( isalpha( event.KeyCode() ) )
{
// key code is within legal range. we call event.Skip() so the
// event can be processed either in the base wxWidgets class
// or the native control.

event.Skip();
}
else
{
// illegal key hit. we don't call event.Skip() so the
// event is not processed anywhere else.

wxBell();
}
}

I get unfamillar with the first line where the :: is. could someone explain what type of operator or other this is?

also on execution get error right at this point.

Recommended Answers

All 4 Replies

The good folk over in the C++ forum will be happy to, I'm sure. wxWidgets is written in C++, and wxPython sits on top of it. Are you trying to figure out something in wxPython?

Jeff

Ahh, that makes sense...

I am working with wxPython attempting working with GUI Events in hopes of making some ground towards a CSS editor but have run into problems finding the Bind function of the EvtHandler Class as is referenced in a tutorial.

Any clues where to find Bind function and EVT types for Bind in the wxPython documentation?

Ah. I see from the posted code that you've already found the "Event Handling Overview."

Here's a basic example of binding in wxPython:

app.frame.canvas = Canvas(parent=app.frame)
app.frame.canvas.Bind(wx.EVT_LEFT_UP, callback)
...

# This is frequently a class method, so will have the header 'callback(self, event)'
def callback(event):
   handle_my_event_here()

If you want a full listing of all possible events, try this at the command line:

print [x for x in dir(wx) if x.startswith('EVT')]

Hope that helps. Let us know if you have something more specific in mind.

Jeff

Well that does produce a nice list of 'em :)

Although would be helpfull to have some descriptions as well.

thanks -- andrew

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.