The error is -
Type Error: Type error in argument 2 of wsListCtrl_InsertItem. Expected
_wxListItem_p.
The doc said I only have to pass the item.
Which is exactly what the above error message is telling you too. It's
expecting a wxListItem object.
What else do
I have to pass it?
If you want to pass just a string then use the InsertStringItem methos as
mentioned in the "wxPython Note" for InsertItem.
I just purchase a C++ book. Why does it have to be three inches thick?
Because there are 1,232,495 different ways to shoot yourself in the foot
with C++. If the book is only three inches thick then it only covers a
small subset of the foot shooting methods. <wink>
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!
I need to figure out how to pass an event from a "main" window to one of its
children. Basically, I'm sending a network event from a child window,
waiting for the reply (which comes back to 'main'), and then trying to pass
info contained in the reply back to the child window that sent the first
network event.
Using PostEvent , I have figured out how to pass an event from a child back
to a parent, but how do you most easily do the opposite (send an event from
a parent to a specific child instance?)
I need to figure out how to pass an event from a "main" window to one of
its
children. Basically, I'm sending a network event from a child window,
waiting for the reply (which comes back to 'main'), and then trying to
pass
info contained in the reply back to the child window that sent the first
network event.
Using PostEvent , I have figured out how to pass an event from a child
back
to a parent, but how do you most easily do the opposite (send an event
from
a parent to a specific child instance?)
Exactly the same way:
wxPostEvent(childWindow, event)
which will add the event to the queue to be processed later in the main
thread. If the event can be processed currently and you're already in the
main thread then this will do it immediately:
childWindow.GetEventHandler().ProcessEvent(event)
And if you don't have to go through the event system then this is the
easiest of all:
childWindow.someMethod(parameters)
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!
And if you don't have to go through the event system then this is the
easiest of all:
childWindow.someMethod(parameters)
ah yes, the obvious. I think that with a little code rearrangement I'm a
candidate for this last method; however, I have a dilemna:
there may be several different instances of the same class under the same
window name existing at the same time. I need a way to identify and destroy
a specific instance rather than the 'last instance'. thus, it seems that
I'll need to get the window ID somehow (or instance ID?) and be passing it
back and forth so that everything stays in order... not sure how to do
this, but I'm going to check out the documentation... In the meantime, if
you feel like giving yet another suggestion, I'd really appreciate it. and
if you don't, how could I possibly blame you? *laugh*
Use parentWindow.FindWindowById( ID ) to get the child (doing sanity checks,
of course, to prevent nasty surprises in case someone mucks around with the
ID).
Alternately use a generic messageID:window mapping to know which messageID
(or transactionID if you prefer) is related to which window.
...
ah yes, the obvious. I think that with a little code rearrangement I'm a
candidate for this last method; however, I have a dilemna:
there may be several different instances of the same class under the same
window name existing at the same time. I need a way to identify and destroy
a specific instance rather than the 'last instance'. thus, it seems that
I'll need to get the window ID somehow (or instance ID?) and be passing it
back and forth so that everything stays in order... not sure how to do
this, but I'm going to check out the documentation... In the meantime, if
you feel like giving yet another suggestion, I'd really appreciate it. and
if you don't, how could I possibly blame you? *laugh*
...
Class Send()
- does a self.GetId() and passes it back as event variable
Alternately use a generic messageID:window mapping to know which messageID
(or transactionID if you prefer) is related to which window.
hmm, well I could assign IDs to windows in a mapping, but I'm not sure how
I'd go about destroying those windows from a messageID alone - I would still
have to get the window name somehow, right? unless, that is, I could find a
way to incorporate the ID into the window name itself and thus ensure that
each new instance is a unique variable..?
I should also mention that the child window is a dialog. perhaps this is
the reason why I'm getting 'None' when I use FindWindowById()?? Is it
necessary to use wxFrame/Window to get a window returned for
self.FindWindowById() ???
Alternately use a generic messageID:window mapping to know which messageID
(or transactionID if you prefer) is related to which window.
got it!!! sorry to keep posting to the list about this, but the only
alternative that seems to work is to do what you said: assign IDs to message
instances (since I'm using dialogs) and append to a mapping list, pass the
ID back and forth, and use it to look up the message instance in order to
destroy the child window once the event is returned. thank you very very
much for suggesting it.