Forum: wxRuby Triggering Label Edit in ListCtrl

Cd2cdfb3022fa28729ed38556844cd04?d=identicon&s=25 Ryan P. L. (ryanp_l)
on 2012-07-03 00:04
Is there any way to trigger an item in a ListCtrl to have its label
edited? For example, I have a single column ListCtrl that shows a list
of values. There is a button that lets you add a new value to the list.
When you click it, it immediately adds a new item with the label "New
Value." As of right now, the user would need to click the item to begin
editing it's value. I would like to have it immediately start editing
the label on creation of the new value, so the user can begin typing
without using the mouse to click it.

Thanks in advance!
89f9acdcbc663e41e45ce590cd746d6e?d=identicon&s=25 Fabio Petrucci (biospank)
on 2012-07-03 09:40
(Received via mailing list)
I normally use ListCtrl to list/report items without editing but looking
at
the documentation you should be able to do editing with a combination of
http://wxruby.rubyforge.org/doc/listctrl.html#List...
http://wxruby.rubyforge.org/doc/listctrl.html#List...

set_item_state(0, Wx::LIST_STATE_SELECTED, Wx::LIST_STATE_SELECTED)

set_focus()

hope this help.

bio.
Cd2cdfb3022fa28729ed38556844cd04?d=identicon&s=25 Ryan P. L. (ryanp_l)
on 2012-07-03 17:27
Fabio Petrucci wrote in post #1067139:
> I normally use ListCtrl to list/report items without editing but looking
> at
> the documentation you should be able to do editing with a combination of
> http://wxruby.rubyforge.org/doc/listctrl.html#List...
> http://wxruby.rubyforge.org/doc/listctrl.html#List...
>
> set_item_state(0, Wx::LIST_STATE_SELECTED, Wx::LIST_STATE_SELECTED)
>
> set_focus()
>
> hope this help.
>
> bio.

Awesome! I have no idea why I never saw the edit_label method, that is
exactly what I was looking for. Thanks for the help.
This topic is locked and can not be replied to.