TextCtrl, getting current line, is that possible ?

thanks Raoul,

but I don't see any TextCtrl in your example code ;-)

On the other hand, you brought me to the idea of using a list, which

might be a better idea.

cheers,

Stef
···

On 26-07-2010 19:09, Raoul Palma wrote:

          See the example in

the attached file. The panel needs to be put in a
wx.Window or one of its subclasses like a wx.Frame.

          You also need to put some line items in the wx.TextCtrl,

too, but that’s easy.

          Raoul

Hi,

···

On Mon, Jul 26, 2010 at 6:17 PM, Raoul <raoulpalma@yahoo.com> wrote:

Yup, you're right. You can only retrieve a cursor coordinate from a
TextCtrl. (Why would anyone want to do that ?! ) I am guessing that
you want to retrieve the actual text from a list item and its position
in the list. To do this requires a wx.ListBox which is far more
flexible. A TextCtrl is just for display purposes and is not meant to
be user-interactive.

What?!?!

A TextCtrl is quite possible the most common and widely used user
interactive control in all applications ever made (or at least a very
close second behind a Button). Sorry but saying it is not meant to be
user interactive is simply false.

Cody

It probably is more popular (i.e., used more), but it just doesn't
have the methods to get the text values and the item indices. Its
general purpose is to allow the user to enter and modify lines of text
in a list. There doesn't seem to be a method to retrieve the index of
a text item within the list, yet many of its methods are dependent on
knowing that item's index.

A ListBox, although its items are immutable, is another form of a text
list in which any random combination of lines can be selected and
their indices and values be easily be retrieved. This seems to be what
is wanted.

···

On Jul 26, 7:36 pm, Cody Precord <codyprec...@gmail.com> wrote:

Hi,

On Mon, Jul 26, 2010 at 6:17 PM, Raoul <raoulpa...@yahoo.com> wrote:
> Yup, you're right. You can only retrieve a cursor coordinate from a
> TextCtrl. (Why would anyone want to do that ?! ) I am guessing that
> you want to retrieve the actual text from a list item and its position
> in the list. To do this requires a wx.ListBox which is far more
> flexible. A TextCtrl is just for display purposes and is not meant to
> be user-interactive.

What?!?!

A TextCtrl is quite possible the most common and widely used user
interactive control in all applications ever made (or at least a very
close second behind a Button). Sorry but saying it is not meant to be
user interactive is simply false.

Cody

So many good people, so many good opions :wink:

The reason I used a TextCtrl is exactly the reason Cody mentioned: KISS
And Kiss in more than 1 way:
- keep it simple for the programmer (not to learn difficult objects like a listctrl)
- keep it simple for the user, in having just a few widgets he can learn in a short time
To keep it even more simple (= all my programs will have an identical look and feel and even more
important: identical behavior,
and I've to rememember just a small subset of the overwhelming wxPython methods ),
therefor I wrap wxPython components almost always in "My_Own_Class"

cheers,
Stef

···

On 27-07-2010 02:09, WinCrazy wrote:

It probably is more popular (i.e., used more), but it just doesn't
have the methods to get the text values and the item indices. Its
general purpose is to allow the user to enter and modify lines of text
in a list. There doesn't seem to be a method to retrieve the index of
a text item within the list, yet many of its methods are dependent on
knowing that item's index.

A ListBox, although its items are immutable, is another form of a text
list in which any random combination of lines can be selected and
their indices and values be easily be retrieved. This seems to be what
is wanted.

On Jul 26, 7:36 pm, Cody Precord <codyprec...@gmail.com> wrote:

Hi,

On Mon, Jul 26, 2010 at 6:17 PM, Raoul <raoulpa...@yahoo.com> wrote:

Yup, you're right. You can only retrieve a cursor coordinate from a
TextCtrl. (Why would anyone want to do that ?! ) I am guessing that
you want to retrieve the actual text from a list item and its position
in the list. To do this requires a wx.ListBox which is far more
flexible. A TextCtrl is just for display purposes and is not meant to
be user-interactive.

What?!?!

A TextCtrl is quite possible the most common and widely used user
interactive control in all applications ever made (or at least a very
close second behind a Button). Sorry but saying it is not meant to be
user interactive is simply false.

Cody