On Fri, Sep 23, 2011 at 11:05 AM, DevPlayer <devp...@gmail.com> wrote:
> How do I what the max length of a wx.TextCtrl. I've looked at source
> for if. I was unable to find the cpp files for _control_.pyd
>
Did you read the Docs? I think the description is quite concise:
http://docs.wxwidgets.org/2.8/wx_wxtextctrl.html#wxtextctrlsetmaxlength
Initially there is no limit, the limit is based off of whatever the
native control can handle which is noted as usually being 32kb.
As another example may want to take a look at my OutputBuffer class in
the Editra Control Library. It uses the STC for the display which
generally deals with large amounts of data and performance better than
the regular TextCtrl. I think it implements a lot of what your looking
for.
http://editra.org/eclib/outputbuffer
http://editra.org/docs/editra_api/class_editra_1_1src_1_1eclib_1_1outbuff_1_1_output_buffer.html
Cody
Hi Cody, Yup, read the docs which say: "(typically at least 32Kb)." which is vague at best. Not very concise. "(typically...", but not always, is this lower sized? larger sized?. Which oses, 64bit, 32 bit? Then there's "at least" as in "at least" but not on average 64Kb?, 1 Meg? is it a "memory chuck" a virtual memory alloc. To many variables to be concise.
| wx.TE_RICH | Use rich text control under Win32, this allows to have more than 64KB of text in the control even under Win9x. This style is ignored under other platforms. |
| wx.TE_RICH2 | Use rich text control version 2.0 or 3.0 under Win32, this style is ignored under other platforms |
This function sets the maximum number of characters the user can enter into the control. In other words, it allows to limit the text value length to len not counting the terminating NUL character.
If len is 0, the previously set max length limit, if any, is discarded and the user may enter as much text as the underlying native text control widget supports (typically at least 32Kb).
If the user tries to enter more characters into the text control when it already is filled up to the maximal length, a wx.wxEVT_COMMAND_TEXT_MAXLEN event is sent to notify the program about it (giving it the possibility to show an explanatory message, for example) and the extra input is discarded.
Note
Note that under GTK+, this function may only be
used with single line text controls.
Werner
On Fri, Sep 23, 2011 at 12:00 PM, DevPlayer <devp...@gmail.com> wrote:
> Hi Cody,
>
> Yup, read the docs which say: "(typically at least 32Kb)." which is
> vague at best. Not very concise. "(typically...", but not always, is
> this lower sized? larger sized?. Which oses, 64bit, 32 bit? Then
> there's "at least" as in "at least" but not on average 64Kb?, 1 Meg?
> is it a "memory chuck" a virtual memory alloc. To many variables to be
> concise.
>
I think it as about as concise as it can be. You need to consult the
documentation of the target library to find out. The implementation of
the control on different versions of the same operating system or
versions of the runtimes / target library can and will vary. It does
clearly state that no limit is imposed by default and that the limit
is only set when you call the method to set the limit at which point
you will get event callbacks when it is reached.
Edit boxes are not typically intended for working with large amounts
of text. If you are needing to be able to store and display large
amounts of data its better to not store all the data in the control
and only put in what needs to be viewed (i.e virtualize it).
> As to the links to Editra. WOW you've been active on that. Lots more
> documentation then when I first found Editra. There's a lot of good
> stuff in that app. I haven't worked with it in a while though. When I
> had that odd tab switching behavior several beta revisions back I got
> spooked when it was messing with my source code and I unknowningly
> save garbled files I had open. Thought I'd wait until it became more
> stable. That was back before the refactoring/restructure I though I
> read about.
>
? There have never been any reports of any issues with files getting
corrupted or otherwise 'messed' with. It doesn't do any thing
'autonomously'. There was one short lived release that under a non
standard workflow where there was some tab activation issues
> btw you pop in on the irc #wxpython rowley.freenode server?
>
No, life has been too busy, haven't been on irc in a long time.
Cody
For a plain wx.TextCtrl on Windows I think it was 32k on Win95 and
earlier, and 64K starting with win98. When using one of the wxTE_RICH
flags then on Windows it will be either 2 billion or 4 billion, I've
forgotten which it is. For the other platforms I'm not sure if there
are hard limits or not, but you can probably depend on it being "a large
amount."
--
Robin Dunn
Software Craftsman
http://wxPython.org
I normally use richtext variant with texts up to several megabytes and
in several cases switching to plain TextCtrl seemed to speed it up
without discarding anything (unless I missed something).
Thanks and regards,
Vlastimil Brom
> Sorry, if I misunderstood something, does the MaxLength mean, that it
> isn't possible to display longer text in plain TextCtrl than, say, 64
> kB (as I would primarily interpret it)? Or does the limit get
> automatically higher somehow, if none is set explicitly?
The widgets may have a built-in maximum that is all that can be
supported based on the design and implementation of the widget itself,
(such as how they allocate memory, etc.) SetMaxLength can be used to
set a more practical limit, so you don't end up with things like a
person's last name being a string that is 64K long because your cat fell
asleep on your keyboard. ;-)
Attached you see screenshots of the widget inspection tool climbing down
my notebook panel w/ sizers on it .
The problem:
I cannot figure out why the 2nd StaticBoxsizer's BoxSizer containing a
wx.ListCtrl just like all the others is not expanding properly, i.e. is
overlapping with the next static box sizer. (see WidgetInsepctor's
highlight in screen-capture-8)
The 4 StaticBoxSizers are exact copies and the 2nd one is the only one
behaving like this ....
You can see from the ObjectInfo that they are not formatted differently ....
Any suggestions where I am missing sthg are VERY welcome :-)
Cheers,
S
I think a small runnable sample app would be better and these images.
http://wiki.wxpython.org/MakingSampleApps
While I often forget to this too, when I do it I often found my error
while doing it and should I not be able to find my error it will make it
easier for others to help.
Werner