Hi, I am trying some demo code treecrtlcombopopup from the wxpythom
demo. I was trying to set the initial value in the combo box using
tcp.SetStringValue() but found that the code either is completely
broken or i don't understand what it is trying to do. Anyhow after
hacking on it a bit I managed to get tcp.SetStringValue() to expand
the tree and show highlighted found string. Still not quite what I was
trying to acheive - then I tried cc.SetValue() and bingo, value set.
Perhaps this should be in the demos as it is not obvious. Also can
someone explain to me how tcp.SetStringValue() is supposed to work for
the treecrtlcombopopup.
The popup's SetStringValue is called by the combo ctrl when the value is changed via the ctrl. It shouldn't usually need to be called from application code. The purpose is so the popup can change selection or do whatever is needed to signify that the combo ctrl has a changed value.
···
On 4/22/11 6:25 AM, adqwetry wrote:
Hi, I am trying some demo code treecrtlcombopopup from the wxpythom
demo. I was trying to set the initial value in the combo box using
tcp.SetStringValue() but found that the code either is completely
broken or i don't understand what it is trying to do. Anyhow after
hacking on it a bit I managed to get tcp.SetStringValue() to expand
the tree and show highlighted found string. Still not quite what I was
trying to acheive - then I tried cc.SetValue() and bingo, value set.
Perhaps this should be in the demos as it is not obvious. Also can
someone explain to me how tcp.SetStringValue() is supposed to work for
the treecrtlcombopopup.
--
Robin Dunn
Software Craftsman
The intent is that the ctrl is giving the popup a chance to update itself in whatever way is desired (if at all) to represent the new value in the ctrl. In the case of the tree ctrl popup we are just looking for an item in the tree that matches the string value in the comboctrl and selecting it if a match is found. In other cases something different will be done, for example a popup that shows date and time widgets would want to parse the string and set the values of the calendar widget and the widget(s) used for editing the time.
···
On 4/22/11 12:43 PM, adqwetry wrote:
Hi Robin, Thanks for the prompt reply. I am still a little confused. I
can see the SetStringValue being called running the demo, which calls
FindItem, can see an item being found but "if found:" in
SetStringValue never seems to be true. Is "return item" in FindItem()
supposed to return item to SetStringValue() or to the recursive
FindItem()? Interestingly, commenting out the SetStringValue function
seems to make no difference to the operation of the demo.On Apr 23, 12:29 am, Robin Dunn<ro...@alldunn.com> wrote:
On 4/22/11 6:25 AM, adqwetry wrote:
The popup's SetStringValue is called by the combo ctrl when the value is
changed via the ctrl. It shouldn't usually need to be called from
application code. The purpose is so the popup can change selection or
do whatever is needed to signify that the combo ctrl has a changed value.
--
Robin Dunn
Software Craftsman