Jump to content

Listviewitem text limit?


Recommended Posts

All I can say is that I ran into this as well, seems to be some kind of Windows limit :D

Alzo

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

  • 11 months later...

Hello,

I have the same problem. I can only 260 characters write in one line with guictrlcreatelistviewitem.

I need as minimum 340 characters.

Can anyone help me?

260 is the amount that the listview shows in the item not what the item actually holds

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

260 is the amount that the listview shows in the item not what the item actually holds

Hi, i've nevebeen sure the exact natue of that 260 limit; do you mean

1. number ot sub-items per listview item.

2. number of characters prt subitem.

3. number of characters of the first subitem of the item (ie of the "item" shwn as first on a ine wth the subpitems.)

4. Is this documented anywhere I can read about it?

5. Is there a limit on total number of characters in one item (ie sum of tem text plus subitems text ) in addition to the above.

?

I have not tested fully, but my impression before I wrote _Arraydisplay was that all was well ie no crash) if I limite the number of subitems to display to <260?

Best, randall

Link to comment
Share on other sites

from msdn

If the structure receives item attributes, pszText is a pointer to a buffer that receives the item text. Note that although the list-view control allows any length string to be stored as item text, only the first 260 TCHARs are displayed.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

hi,

@gafrost

There is some limit on the header display perhaps?

Run my attached script for array display (internally I limit that to 250 columns), and it shows only about 207 (wider 259 items) or 211 (154 char items) columns; same if I write a new non-delimited script.

What do you think? - character number in header plus header subitems?

best, randall

Edited by randallc
Link to comment
Share on other sites

Hello,

I create a ListView:

$L_Console = GUICtrlCreateListView("|", 2, 275, 590, 204, BitOR($LVS_NOCOLUMNHEADER, $LVS_SINGLESEL, $WS_VSCROLL, $WS_HSCROLL), $LVS_EX_FLATSB)
_GUICtrlListViewSetColumnWidth(-1, 0, 2500)oÝ÷ Ù8^§îËb¢{h¸­z)⵫­¢+ÙÕ¹}½¹Í½±ÝÉ¥Ñ ÀÌØí½¹Í½±°ÀÌØíÑáаÀÌØí½±½ÈôÁá¤(%¥ÀÌØíÑáбÐìÐìÅÕ½ÐìÅÕ½ÐìQ¡¸($$ÀÌØíÝÉ¥ÑôU%
Ñɱ
ÉÑ1¥ÍÑY¥Ý%Ñ´ ÀÌØíÑáаÀÌØí½¹Í½±¤($%U%
ÑɱMÑ   ­
½±½È ´Ä°ÀÌØí½±½È¤($$ÀÌØí½Õ¹Ðô}U%
Ñɱ1¥ÍÑY¥ÝÑ%ѵ
½Õ¹Ð ÀÌØí½¹Í½±¤($%}U%
Ñɱ1¥ÍÑY¥ÝMɽ±° ÀÌØí½¹Í½±°À°ÈÀÀ¤(%¹%)¹Õ¹oÝ÷ Ø    Ýiû§rبÚ,j÷X­zk"+ZºÚ"µÍ[ÈØÛÛÛÛØ]J    ÌÍØÛÛÛÛK ÌÍÜØ][JBZYÝ[ÔYÚ
    ÌÍÜØ][K
H   ÉÝÈ  ][ÝËÙÉ][ÝÈ[BIÌÍÜØ][HH  ÌÍÜØ][[È ][ÝËÙÉ][ÝÂQ[YBZY[Q^ÝÊ   ÌÍÜØ][JH[BIÌÍÝYXØÚZXHÙÐÞ
Í  ][ÝÑ]ZH^ÝY   ][ÝË  ][ÝÔÛÛYH]ZH ][ÝÈ  [È ÌÍÜØ][[È ][ÝÈ?ØÚYX[Ù[É][ÝÊBBZY   ÌÍÝYXØÚZXH
[BBYØXJ
BBBIÌÍÙ[HH[[  ÌÍÜØ][KBBBIÌÍØÛÝ[HÑÕRPÝÝY]ÑÙ]][PÛÝ[
    ÌÍØÛÛÛÛJBBBYÜ   ÌÍÚHHÈ  ÌÍØÛÝ[LBBBBIÌÍÛ[HHÑÕRPÝÝY]ÑÙ]][U^
    ÌÍØÛÛÛÛK ÌÍÚJBBBBQ[]S[J    ÌÍÙ[K    ÌÍÛ[JBBBS^BBWØÛÛÛÛ]Ü]J ÌÍÓÐÛÛÛÛK   ][ÝÓÙÈÝHXÚ    ][ÝÈ  [È ÌÍÜØ][[È ][ÝÈÙÜZXÚ][ÝË    ÌÍÙÜY[BBBQ[PÛÜÙJ ÌÍÙ[JBBQ[ÙBBBWØÛÛÛÛ]Ü]J   ÌÍÓÐÛÛÛÛK   ][ÝÔÜZXÚÈÙÜÈÝHXÙXØÚ[][ÝÊBBQ[YQ[ÙBBYØXJ
BBIÌÍÙ[HH[[   ÌÍÜØ][KBBIÌÍØÛÝ[HÑÕRPÝÝY]ÑÙ]][PÛÝ[
    ÌÍØÛÛÛÛJBBYÜ    ÌÍÚHHÈ  ÌÍØÛÝ[LBBBIÌÍÛ[HHÑÕRPÝÝY]ÑÙ]][U^
    ÌÍØÛÛÛÛK ÌÍÚJBBBQ[]S[J ÌÍÙ[K    ÌÍÛ[JBBS^BWØÛÛÛÛ]Ü]J   ÌÍÓÐÛÛÛÛK   ][ÝÓÙÈÝHXÚ    ][ÝÈ  [È ÌÍÜØ][[È ][ÝÈÙÜZXÚ][ÝË    ÌÍÙÜY[BBQ[PÛÜÙJ  ÌÍÙ[JBQ[YY[XJ
B[[

I have 1 Item that is longer as 260 characters. This is not really badly for me but a little unbeautiful.

Link to comment
Share on other sites

ok, ok :)

Here is a example script. I need a ListView, because i need the backgroundcolor for some items.

#include <GUIConstants.au3>
#Include <GuiListView.au3>

$red = 0xff0000
$green = 0x00FF40

$Form1 = GUICreate("Form1", 630, 262, 193, 115)
$b_write = GUICtrlCreateButton("Write", 100, 224, 100, 30, $BS_FLAT)
$b_save = GUICtrlCreateButton("Save", 300, 224, 100, 30, $BS_FLAT)
$L_Console = GUICtrlCreateListView("|", 0, 32, 626, 182, BitOR($LVS_NOCOLUMNHEADER, $LVS_SINGLESEL, $WS_VSCROLL, $WS_HSCROLL), $LVS_EX_FLATSB)
_GUICtrlListViewSetColumnWidth(-1, 0, 2500)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $b_write
            _consolewrite($L_Console, "This is a example text that is longer as 260 characters. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 260123456789")
        Case $b_save
            $logfile = FileSaveDialog("Log speichern", @ScriptDir, "Log-Datei (*.log)")
            if Not @error Then _consolesave($L_Console, $logfile)
    EndSwitch
WEnd


Func _consolewrite($console, $text, $color = 0xffffff)
    if $text <> "" Then
        $write = GUICtrlCreateListViewItem($text, $console)
        GUICtrlSetBkColor(-1, $color)
        $count = _GUICtrlListViewGetItemCount($console)
        _GUICtrlListViewScroll($console,0,200)
    EndIf
EndFunc

Func _consolesave($console, $save_file)
    if StringRight($save_file, 4) <> ".log" Then 
        $save_file = $save_file & ".log"
    EndIf
    
    if FileExists($save_file) Then
        $ueberschreib = MsgBox(36, "Datei existiert", "Soll die Datei " & $save_file & " überschrieben werden?")
        if $ueberschreib = 6 Then
            $file = FileOpen($save_file, 2)
            $count = _GUICtrlListViewGetItemCount($console)
            for $i = 0 to $count -1
                $line = _GUICtrlListViewGetItemText($console, $i)
                FileWriteLine($file, $line)
            Next
            _consolewrite($L_Console, "Log wurde nach " & $save_file & " gespeichert.", $green)
            FileClose($file)
        Else
            _consolewrite($L_Console, "Speichern des Logs wurde abgebrochen.")
        EndIf
    Else
        $file = FileOpen($save_file, 2)
        $count = _GUICtrlListViewGetItemCount($console)
        for $i = 0 to $count -1
            $line = _GUICtrlListViewGetItemText($console, $i)
            FileWriteLine($file, $line)
        Next
        _consolewrite($L_Console, "Log wurde nach " & $save_file & " gespeichert.", $green)
        FileClose($file)
    EndIf
EndFunc
Link to comment
Share on other sites

Hi,

I cannot get alternate colours to wrk, but just display the rest of the line in the next column?

_GUICtrlListViewSetColumnWidth($L_Console, 0, 259 * 7 - 198)oÝ÷ Ûû-®)lº·ºÚ"µÍÌÍÝÜ]HHÕRPÝÜX]SÝY]Ò][J ÌÍÝ^ [È ][Ýß  ][ÝÈ  [ÈÝ[ÓZY
    ÌÍÝ^
K   ÌÍØÛÛÛÛJ
Best, Randall
Link to comment
Share on other sites

Hello,

thanks for the tip! :)

I change my script to this

#include <GUIConstants.au3>
#Include <GuiListView.au3>

$red = 0xff0000
$green = 0x00FF40

$Form1 = GUICreate("Form1", 630, 262, 193, 115)
$b_write = GUICtrlCreateButton("Write", 100, 224, 100, 30, $BS_FLAT)
$b_save = GUICtrlCreateButton("Save", 300, 224, 100, 30, $BS_FLAT)
$L_Console = GUICtrlCreateListView("| |", 0, 32, 626, 182, BitOR($LVS_NOCOLUMNHEADER, $LVS_SINGLESEL, $WS_VSCROLL, $WS_HSCROLL), $LVS_EX_FLATSB)
GUISetState(@SW_SHOW)

_consolewrite($L_Console, "jdfölkjsf", $green)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $b_write
            _consolewrite($L_Console, "This is a example text that is longer as 260 characters. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 260123456789")
        Case $b_save
            $logfile = FileSaveDialog("Log speichern", @ScriptDir, "Log-Datei (*.log)")
            if Not @error Then _consolesave($L_Console, $logfile)
    EndSwitch
WEnd

Func _consolewrite($console, $text, $color = 0xffffff)
    if $text <> "" Then
        If StringLen($text) > 260 then
            $write = GUICtrlCreateListViewItem($text & "|" & StringMid($text, 260), $console)
        Else
            $write = GUICtrlCreateListViewItem($text, $console)
            GUICtrlSetBkColor(-1, $color)
            $count = _GUICtrlListViewGetItemCount($console)
            _GUICtrlListViewScroll($console,0,200)
        EndIf
    EndIf
    _GUICtrlListViewSetColumnWidth($L_Console, 0, $LVSCW_AUTOSIZE)
    _GUICtrlListViewSetColumnWidth($L_Console, 1, $LVSCW_AUTOSIZE)
EndFunc

Func _consolesave($console, $save_file)
    if StringRight($save_file, 4) <> ".log" Then 
        $save_file = $save_file & ".log"
    EndIf
    
    if FileExists($save_file) Then
        $ueberschreib = MsgBox(36, "Datei existiert", "Soll die Datei " & $save_file & " überschrieben werden?")
        if $ueberschreib = 6 Then
            $file = FileOpen($save_file, 2)
            $count = _GUICtrlListViewGetItemCount($console)
            for $i = 0 to $count -1
                $line = _GUICtrlListViewGetItemText($console, $i, 0)
                FileWriteLine($file, $line)
            Next
            _consolewrite($L_Console, "Log wurde nach " & $save_file & " gespeichert.", $green)
            FileClose($file)
        Else
            _consolewrite($L_Console, "Speichern des Logs wurde abgebrochen.")
        EndIf
    Else
        $file = FileOpen($save_file, 2)
        $count = _GUICtrlListViewGetItemCount($console)
        for $i = 0 to $count -1
            $line = _GUICtrlListViewGetItemText($console, $i, 0)
            FileWriteLine($file, $line)
        Next
        _consolewrite($L_Console, "Log wurde nach " & $save_file & " gespeichert.", $green)
        FileClose($file)
    EndIf
EndFunc

If a line is longer as 260 characters then the text is split to 2 strings and written in a new column.

This is nearly perfect. There are some spaces after the first column if the text is longer as 260 characters.

Link to comment
Share on other sites

Hi,

I cannot get alternate colours to wrk, but just display the rest of the line in the next column?

_GUICtrlListViewSetColumnWidth($L_Console, 0, 259 * 7 - 198)oÝ÷ Ûû-®)lº·ºÚ"µÍÌÍÝÜ]HHÕRPÝÜX]SÝY]Ò][J ÌÍÝ^ [È ][Ýß  ][ÝÈ  [ÈÝ[ÓZY
    ÌÍÝ^
K   ÌÍØÛÛÛÛJ
Best, Randall
Good!

See deleted line above to minimise the spaces?

Randall

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...