Writing a custom control

Hi, I have to write a custom control. Could someone tell me which class
should I derive from (wx.Window or wx.Control?), and what methods do I
have to override? (BTW, is there some tutorial on the topic or just an
example somewhere?)
Thank you.

Hello Lorenzo,

Hi, I have to write a custom control. Could someone tell me which class
should I derive from (wx.Window or wx.Control?)

Well, it depends which kind of control it is. As a start, when I
implement new controls, I usually subclass wx.PyControl (but this is
not a "must").

and what methods do I have to override?

Well, if it is a composite owner-draw control, you should override the
wx.EVT_SIZE and wx.EVT_PAINT events for sure. You may also need to
catch the wx.EVT_SET/KILL_FOCUS events, mouse events and key events,
depending on your needs for that control.

(BTW, is there some tutorial on the topic or just an
example somewhere?)

I don't know if there are tutorials on this topic, but for some
examples of custom controls you may check some of the classes I have
written till now:

http://xoomer.virgilio.it/infinity77/eng/freeware.html

Or, if you prefer in italian:

http://xoomer.virgilio.it/infinity77/ita/freeware.html

Excluding the first application, all the others are custom controls,
either translated from C++ or created from scratch.

HTH.

Andrea.

ยทยทยท

--
"Imagination Is The Only Weapon In The War Against Reality."

http://xoomer.virgilio.it/infinity77/