I’m trying to add a custom listcontrol to an XRC dialog following the TwoStageCreation description in the wiki.
As suggested in the example, I am adding columns to my control in the wx.EVT_WINDOW_CREATE handler.
However, I don’t understand at which point I can safely use the created widget, i.e. add items to the columns.
In the following example application where a dialog is loaded when the user presses a button
I would like to add items to the list’s columns at the point where ‘adding items’ is printed.
(I can’t do it in OnCreate as it needs additional information)
However, this does not work, because the EVT_WINDOW_CREATE handler is called afterwards on Linux.
So where is the place to safely add items after OnCreate?
You could have your OnCreate handler call a method on the parent or something that does it, or perhaps just a standalone function that you pass the listctrl to. I think it would probably work in a EVT_INIT_DIALOG event handler too, although you'll want to double-check that it happens after the EVT_CREATE_WINDOW event.
···
On 5/25/12 2:16 AM, Patrick Ruoff wrote:
Hello,
I'm trying to add a custom listcontrol to an XRC dialog following the
TwoStageCreation <http://wiki.wxpython.org/TwoStageCreation> description
in the wiki.
As suggested in the example, I am adding columns to my control in the
wx.EVT_WINDOW_CREATE handler.
However, I don't understand at which point I can safely use the created
widget, i.e. add items to the columns.
In the following example application where a dialog is loaded when the
user presses a button
I would like to add items to the list's columns at the point where
'adding items' is printed.
(I can't do it in OnCreate as it needs additional information)
However, this does not work, because the EVT_WINDOW_CREATE handler is
called afterwards on Linux.
So where is the place to safely add items after OnCreate?