Jump to content

Recommended Posts

Posted

Hi, I am inserting xml into listview item:

_GUICtrlListViewInsertItem($lst_result,0,$URL)

where :

$URL is the xml (I count 1612 characters) ,

0 - input into first line

$lst_result is the listview control

The problem that the xml string is truncated and not entered well.

Is it a problem of the Method or the buffer of the list item is to small.

If it too smal, then how to increase it.

Be Green Now or Never (BGNN)!

Posted

Hi, I am inserting xml into listview item:

_GUICtrlListViewInsertItem($lst_result,0,$URL)

where :

$URL is the xml (I count 1612 characters) ,

0 - input into first line

$lst_result is the listview control

The problem that the xml string is truncated and not entered well.

Is it a problem of the Method or the buffer of the list item is to small.

If it too smal, then how to increase it.

My guess is Microsoft limitation, the insert uses StringLen($s_text) + 1 for the length of the insert.

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Posted (edited)

did some testing, so now my guess would be your code, or the string your trying to insert is the problem

below is the test of 1700 characters, works just fine.

#include <GuiConstants.au3>
#include <GuiListView.au3>

;~ Const $LVS_SORTDESCENDING = 0x0020
opt('MustDeclareVars', 1)
Dim $listview, $Btn_Exit, $msg, $Status, $Btn_Insert, $ret, $Input_Index, $test = ""
GUICreate("ListView Insert Item", 392, 322)

For $x = 1 To 1700
    $test &= "a"
Next
$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
_GUICtrlListViewSetColumnWidth ($listview, 0, 75)
_GUICtrlListViewSetColumnWidth ($listview, 1, 75)
_GUICtrlListViewSetColumnWidth ($listview, 2, 75)
GUICtrlCreateLabel("Enter Item # to Insert To:", 90, 190, 130, 20)
$Input_Index = GUICtrlCreateInput("", 220, 190, 80, 20, $ES_NUMBER)
$Btn_Insert = GUICtrlCreateButton("Insert Item", 150, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
_GUICtrlListViewInsertItem ($listview, 0, $test & "|data1|more1")
MsgBox(0,"test",StringLen(_GUICtrlListViewGetItemText ($listview, 0, 0)))
MsgBox(0,"test2",_GUICtrlListViewGetItemText ($listview, 0, 0))
GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
         ExitLoop
      Case $msg = $Btn_Insert
         If (StringLen(GUICtrlRead($Input_Index)) > 0) Then
            $ret = _GUICtrlListViewInsertItem ($listview, Int(GUICtrlRead($Input_Index)), "test|1|2")
            If ($ret <> $LV_ERR) Then
               GUICtrlSetData($Status, 'Inserted Item at: ' & $ret)
            Else
               GUICtrlSetData($Status, 'Failed to Insert Item')
            EndIf
         Else
            GUICtrlSetData($Status, 'Must enter a Item Index to insert')
         EndIf
   EndSelect
WEnd
Exit
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.

 

Posted

Yes your code is working.

I think the problem is because the XML file that was input on one item contain

a special character that cause the problem.

Be Green Now or Never (BGNN)!

Posted

Hi,

But item "0"only has 255 chars[by looking at the listview itself; ]? [GetText incorrect!; and length];

For $x = 1 To 1700
    $test &= chr (mod($x,52)+64)
NextoÝ÷ جµ§u©eþ«¨µå¨®H§Ê+­ç-'è®g¢~)Ý¢æí¶¼ºÚ"µÍÜ    ÌÍÞHHÈMÌ   ÌÍÝÝ    [ÏH    ÌÍÞ^

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Posted

What can be displayed and what is actually is stored is two different things

Note that although the list-view control allows any length string to be stored as item text, only the first 260 TCHARs are displayed.

http://msdn.microsoft.com/library/en-us/sh...ures/lvitem.asp

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

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
  • Recently Browsing   0 members

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