There is a way to point to an item of a wx.ComboBox using SetSelection method on ClientData insted of index?
Giuseppe
Python-it.org
There is a way to point to an item of a wx.ComboBox using SetSelection method on ClientData insted of index?
Giuseppe
Python-it.org
Scrolling the whole content of ClientData could do:
for j in range(wxCB.GetCount()):
if wxCB.GetClientData(j) == x:
wxCB.SetSelection(j)
break
Buon anno
2007/12/29, Giuseppe Costanzi g.costanzi@email.it:
There is a way to point to an item of a wx.ComboBox using SetSelection
method on ClientData insted of index?Giuseppe
Python-it.org
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org
Surely your idea of using a dictionary is more elegant, and since you have made up a numeric dict the additional memory cost is trivial. Beyond the inquiry is made in C++, not Python, so much faster: and the combo content might become very long. Thank you for your suggestion.
2007/12/30, Giuseppe Costanzi g.costanzi@idi.it:
Ciao Raffaello, you have suggest me to use a dictionary.
On combo data load function I makefor j in range(self.cbCategory.GetCount()):
a=self.cbCategory.GetClientData(j)
print j,ax=int(a[0]) dct_Categories[x]=j
print j,a return
0 (2, ‘AGGLUTINATION’)
1 (27, ‘ELISA’)
2 (52, ‘VARIOUS’)
3 (53, ‘VIDAS’)
4 (59, ‘TO ASSIGN’)now the dictionary (dct_Categories) will be
{59: 4, 2: 0, 27: 1, 52: 2, 53: 3}
So I populate the dictionary,notice that I’ve use for the key the
dataclient value(x) instead
of the combo index…than to point on ClientData for example i can do
CategoriesID = 53
it means that
dct_Categories[CategoriesID] return 3, so
self.cbCategory.SetSelection(dct_Categories[CategoriesID])
that finally selects on combo the item with index=3It work but there is a more elegant mode to do this?
Thanks Raffaello
buon anno anche a te!
Giuseppe
Python-it.org <http://Python-it.org
>Raffaello Barella ha scritto:
Scrolling the whole content of ClientData could do:
for j in range(wxCB.GetCount()):
if wxCB.GetClientData(j) == x:
wxCB.SetSelection(j)
breakBuon anno
2007/12/29, Giuseppe Costanzi <g.costanzi@email.it
<mailto:
g.costanzi@email.it>>:There is a way to point to an item of a wx.ComboBox using SetSelection method on ClientData insted of index? Giuseppe [
Python-it.org](http://Python-it.org) <http://Python-it.org>
--------------------------------------------------------------------- To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org
<mailto:wxPython-users-unsubscribe@lists.wxwidgets.org> For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org <mailto:wxPython-users-help@lists.wxwidgets.org
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org