wxListCtrl and GetItemText on Windows limits string length to 511

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

wxListCtrl and GetItemText on Windows limits string length to 511

franz steinhaeusler
Hello, after a longer research, I found the problem in my application:
On gtk, everything is fine (no string length limit)

But on Windows, if I set a string of length > 511, the string in GetItemText is truncated to 511 characters (or 512 characters, with 0 Byte on the end?)

small example in pycrust Windows:
>>> l=wx.ListCtrl(c)
>>> l.InsertStringItem(0, "h"*700)
0
>>> r = l.GetItemText(0)
>>> print r, len(r)
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh 511
>>>

in Gtk;
>>> l=wx.ListCtrl(c)
>>> l.InsertStringItem(0, "h"*700)
0
>>> r = l.GetItemText(0)
>>> print r, len(r)
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh 700
>>>


If I can solve that problem (I use the EditableListBox), I cannot really use my app on windows (without any serious change).
How can I get windows to deliver *ALL* Characters in the Listbox? Is there any style for that? I there any workaround?

Many thanks in advance!

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wxListCtrl and GetItemText on Windows limits string length to 511

franz steinhaeusler
Forgot to mention: Python 2.7, wxPython 2.8.12.1 (same on windows and on ubuntu)

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wxListCtrl and GetItemText on Windows limits string length to 511

Andrea Gavana
In reply to this post by franz steinhaeusler
Hi,

On Sat, 15 Apr 2017 at 18:20, franz steinhaeusler <[hidden email]> wrote:
Hello, after a longer research, I found the problem in my application:
On gtk, everything is fine (no string length limit)

But on Windows, if I set a string of length > 511, the string in GetItemText is truncated to 511 characters (or 512 characters, with 0 Byte on the end?)

small example in pycrust Windows:
>>> l=wx.ListCtrl(c)
>>> l.InsertStringItem(0, "h"*700)
0
>>> r = l.GetItemText(0)
>>> print r, len(r)
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh 511
>>>

in Gtk;
>>> l=wx.ListCtrl(c)
>>> l.InsertStringItem(0, "h"*700)
0
>>> r = l.GetItemText(0)
>>> print r, len(r)
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh 700
>>>


If I can solve that problem (I use the EditableListBox), I cannot really use my app on windows (without any serious change).
How can I get windows to deliver *ALL* Characters in the Listbox? Is there any style for that? I there any workaround?

Many thanks in advance!


It appears it cannot be done:


Although I'm no super expert and I may have missed some info. If it can't be done, then you might want to give UltimateListCtrl a try, I am sure there is no such limitation in there...

By the way, why would you need to display 700 characters in a listctrl item? Even if you do, the column width must be something like 2,000 pixels...

Andrea.




--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wxListCtrl and GetItemText on Windows limits string length to 511

franz steinhaeusler
Hello Andrea,

first I was away some years from wxPython, I need to come into it again.

My app is a clipboard manager like clipx on windows or parcellite on ubuntu, which I want to have crossplatorm.

I have ported the EditableListbox from wxWidgets Source to python and here I have my problems with the listctrl.
With the editableListbox, I want to view/edit clipboard (and also "snippets" entries. And some clipboard data entries are quiet long.
I want to have Tooltips in Listctrl to view the content and I have an edit button (which calls a dialog with stc Editor) to comfortable edit the entry.


I have already tried your UltimateListCtrl and SuperTooltip (which is a fantastic work from you), but I had some problems/inconsistencies. Maybe I try again, but I think I would have to patch some of your Sources.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wxListCtrl and GetItemText on Windows limits string length to 511

franz steinhaeusler
I thought, I send the testexample. It should demonstrate it best. The annoying thing (so often) ist, that gtk and ms windows behave more different (in wxWidgets/wxPython) than you want to expect.

Just run wxEditableListBox.py. I hope, will be all complete to run and show the problems. Also the button down and upĀ  (I exended original EditableListBox from demo a little bit - for example call external edit window (stc Control) to more comfortable editing.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

wxEditableListBox.py (27K) Download Attachment
wxStcEditText.py (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wxListCtrl and GetItemText on Windows limits string length to 511

James Scholes
In reply to this post by franz steinhaeusler
franz steinhaeusler wrote:
> here I have my problems with the listctrl.
> With the editableListbox, I want to view/edit clipboard (and also
> "snippets" entries. And some clipboard data entries are quiet long.
> I want to have Tooltips in Listctrl to view the content and I have an
> edit button (which calls a dialog with stc Editor) to comfortable edit
> the entry.

If the underlying GUI control doesn't support what you're trying to do,
don't rely on it.  Store the clipboard entries separately in some other
structure like a list of strings, rather than having wx do the work for
you.  When you show the edit dialog, retrieve the full text of the entry
from your list instead of using ListCtrl.GetItemText.

This is pretty common in GUI apps - the list of clipboard entries is
your data model, the list is your view.  Don't confuse the two and the
limitations of the GUI won't matter.
--
James Scholes
http://twitter.com/JamesScholes

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wxListCtrl and GetItemText on Windows limits string length to 511

franz steinhaeusler
Hello James,

I thought over the whole thing and decided to solve that the way you mention it.
I chose an extra list of strings, which I update accordingly.

thanks again

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...