Hello again,
I am trying to determine if a user has selected anything in a wxtreecontrol. I’m using GetSelection - I read in the documentation that it will return an “invalid item” if nothing is selected. What is an “invalid item.” I want to execute a piece of code depending upon if something is selected in the tree. although I’m not sure how to handle an “invalid item.” Perhaps there is a better way to do this?
As always, thanks for the help!
Jeff
Hi Jeff,
Jeff Peery wrote:
Hello again,
I am trying to determine if a user has selected anything in a wxtreecontrol. I'm using GetSelection - I read in the documentation that it will return an "invalid item" if nothing is selected. What is an "invalid item."
I am not sure but I would guess "-1"
I want to execute a piece of code depending upon if something is selected in the tree. although I'm not sure how to handle an "invalid item." Perhaps there is a better way to do this?
Check if GetSelection returns "-1" then you do nothing otherwise you do whatever.
As always, thanks for the help!
Jeff
See you
Werner
Sex, 2005-06-24 às 18:25 +0200, Werner F. Bruhin escreveu:
Hi Jeff,
Jeff Peery wrote:
> Hello again,
>
> I am trying to determine if a user has selected anything in a
> wxtreecontrol. I'm using GetSelection - I read in the documentation
> that it will return an "invalid item" if nothing is selected. What is
> an "invalid item."
I am not sure but I would guess "-1"
From docs:
"You can test whether an item is valid by calling wxTreeItemId::IsOk."
So you could do something like this:
item.IsOk()
See the TreeCtrl demo. It's using the IsOk.
Ricardo
I did do this, I used: print treectrl.getselection(), it returns some instance, something other than -1. the documentation says invalid item. Is there anything
···
“Werner F. Bruhin” werner.bruhin@free.fr wrote:
Hi Jeff,
Jeff Peery wrote:
Hello again,
I am trying to determine if a user has selected anything in a
wxtreecontrol. I’m using GetSelection - I read in the documentation
that it will return an “invalid item” if nothing is selected. What is
an “invalid item.”
I am not sure but I would guess “-1”
I want to execute a piece of code depending upon if something is
selected in the tree. although I’m not sure how to handle an “invalid
item.” Perhaps there is a better way to do this?
Check if GetSelection returns “-1” then you do nothing otherwise you do
whatever.
As always, thanks for the help!
Jeff
See you
Werner
To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
I did do this, I used: print treectrl.getselection(), it returns some instance, something other than -1. the documentation says invalid item. Is there anything
···
“Werner F. Bruhin” werner.bruhin@free.fr wrote:
Hi Jeff,
Jeff Peery wrote:
Hello again,
I am trying to determine if a user has selected anything in a
wxtreecontrol. I’m using GetSelection - I read in the documentation
that it will return an “invalid item” if nothing is selected. What is
an “invalid item.”
I am not sure but I would guess “-1”
I want to execute a piece of code depending upon if something is
selected in the tree. although I’m not sure how to handle an “invalid
item.” Perhaps there is a better way to do this?
Check if GetSelection returns “-1” then you do nothing otherwise you do
whatever.
As always, thanks for the help!
Jeff
See you
Werner
To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
I did do this, I used: print treectrl.getselection(), it returns some instance, something other than -1. the documentation says invalid item. Is there anything
···
“Werner F. Bruhin” werner.bruhin@free.fr wrote:
Hi Jeff,
Jeff Peery wrote:
Hello again,
I am trying to determine if a user has selected anything in a
wxtreecontrol. I’m using GetSelection - I read in the documentation
that it will return an “invalid item” if nothing is selected. What is
an “invalid item.”
I am not sure but I would guess “-1”
I want to execute a piece of code depending upon if something is
selected in the tree. although I’m not sure how to handle an “invalid
item.” Perhaps there is a better way to do this?
Check if GetSelection returns “-1” then you do nothing otherwise you do
whatever.
As always, thanks for the help!
Jeff
See you
Werner
To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org