Sign in to follow this  
Followers 0
trescon

_GUICtrlListView ??

18 posts in this topic

Hello, I have created a ListView try to do experiments but apparently goes as she wants, and 'clear and obvious that I'm wrong but I would like to know where!

I state that the programmni is full of pieces of software swapped in and out for predenetemente tests done, so it is very dirty.

Then the program reads a file created with FileWriteLine (as one word) and then broken down into various variables needed (I put a console write and I found that the variable is read from the file and all correctly)

I'm going to print the ListView data read and I can see only the first column and the columns that I had set as "fixed" for test (created from the value of the for loop / next and sommandoci a fixed value chosen by me and different for each column)

The intermediate columns, start, end, title, code, which are extracted as seconta third fourth and fifth variable I appear empty.

I would like to understand why '

Someone dell'imbranato thou wilt give to myself ...... please come forward!

thanks

#include <guiconstantsex.au3>
#include <guilistview.au3>
#include <buttonconstants.au3>
#include <comboconstants.au3>
#include <editconstants.au3>
#include <guiconstantsex.au3>
#include <windowsconstants.au3>
#include <datetimeconstants.au3>
Dim $Dati[50],$a,$b,$c
$a=20
$c=50
Dim $Rd_Concorrente[50] ,$Rd_Date_Dal[50],$Rd_Date_Al[50],$Rd_Titolo[50],$Rd_Codice[50],$Rd_Marca[50],$Rd_Modello[50],$Rd_Pollici[50]
Dim $Rd_Tipo[50],$Rd_Lineare[50],$Rd_Promo[50],$Rd_Lin_Vol[50],$Rd_Promo_Vol[50],$Rd_Www[50]
;$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work
;Dim $Dati[50]
;_Main()
$Form1 = GUICreate("Lettura", 900, 600, 100, 50)
;$Concorrente = GUICtrlCreateCombo("Ordina", 100, 24, 130, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
;GUICtrlSetData(-1, "Insegna|Data|Marca|Pollici|Tipo") ; Lunghezza 12 car
;GUICtrlSetFont(-1, 14, 400, 0, "Calibri")
$Button1 = GUICtrlCreateButton("Conferma", 600, 500, 75, 25)
GUICtrlSetFont(-1, 12, 800, 0, "Calibri")
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Call ("Leggi")
;_Main($Dati)
_Scomponi ($Dati,$a)
_Main($Rd_Concorrente ,$Rd_Date_Dal,$Rd_Date_Al,$Rd_Titolo,$Rd_Codice,$Rd_Marca,$Rd_Modello,$Rd_Pollici,$Rd_Tipo,$Rd_Lineare,$Rd_Promo,$Rd_Lin_Vol,$Rd_Promo_Vol,$Rd_Www)
EndSwitch
WEnd
Func Leggi ()
Local $file = FileOpen("c:autoitautoitprovevolantinoconcorrenza.txt", 0)
; Check if file opened for reading OK
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
$a=0
; Read in lines of text until the EOF is reached
While 1
$a=$a+1
Local $line = FileReadLine($file)
If @error = -1 Then ExitLoop
$Dati[$a]=$line
;MsgBox(0, "Line read:", $Dati[$a])
MsgBox(0, "Line read:", $a)
WEnd
FileClose($file)
EndFunc
Func _Main($Rd_Concorrente ,$Rd_Date_Dal,$Rd_Date_Al,$Rd_Titolo,$Rd_Codice,$Rd_Marca,$Rd_Modello,$Rd_Pollici,$Rd_Tipo,$Rd_Lineare,$Rd_Promo,$Rd_Lin_Vol,$Rd_Promo_Vol,$Rd_Www)
Local $hListView
GUICreate("ListView Scroll", 900, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 894, 268)
GUISetState()
; Add column
_GUICtrlListView_AddColumn($hListView, "Insegna", 100)
_GUICtrlListView_AddColumn($hListView, "Inizio", 100)
_GUICtrlListView_AddColumn($hListView, "Fine", 100)
_GUICtrlListView_AddColumn($hListView, "Titolo", 100)
_GUICtrlListView_AddColumn($hListView, "Codice", 100)
_GUICtrlListView_AddColumn($hListView, "Marca", 100)
_GUICtrlListView_AddColumn($hListView, "Modello", 100)
_GUICtrlListView_AddColumn($hListView, "Pollici", 100)
_GUICtrlListView_AddColumn($hListView, "Tipo", 100)
_GUICtrlListView_AddColumn($hListView, "Lin. Neg.", 100)
_GUICtrlListView_AddColumn($hListView, "Promo Neg.", 100)
_GUICtrlListView_AddColumn($hListView, "Lin. Vol.", 100)
_GUICtrlListView_AddColumn($hListView, "Promo Vol.", 100)
_GUICtrlListView_AddColumn($hListView, "Www", 100)
; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, $Rd_Concorrente[$iI],0);"Insegna " & $iI,0)
;_GUICtrlListView_AddItem($hListView, $Rd_Titolo [$iI],0);"Insegna " & $iI,0)
;_GUICtrlListView_AddItem($hListView, $Rd_Date_Dal[$iI],1);"Insegna " & $iI,0)
_GUICtrlListView_AddSubItem($hListView,$iI, $Rd_Date_Dal[$iI],1) ;"Inizio " & $iI+50,1,1)
_GUICtrlListView_AddSubItem($hListView,$iI, "Fine " & $iI+60,2)
_GUICtrlListView_AddSubItem($hListView,$iI, $Rd_Titolo [$iI],3,1);"Titolo " & $iI+70,3,1)
_GUICtrlListView_AddSubItem($hListView,$iI, "Codice " & $iI+80,4,1)
_GUICtrlListView_AddSubItem($hListView,0, "Marca " & $iI+90,5,1)
_GUICtrlListView_AddSubItem($hListView,0, "Modello " & $iI+100,6,1)
_GUICtrlListView_AddSubItem($hListView,0, "Pollici " & $iI+110,7,1)
_GUICtrlListView_AddSubItem($hListView,0, "Tipo " & $iI+120,8,1)
_GUICtrlListView_AddSubItem($hListView,0, "Lin. Neg " & $iI+130,9,1)
_GUICtrlListView_AddSubItem($hListView,0, "Promo Neg. " & $iI+140,10,1)
_GUICtrlListView_AddSubItem($hListView,0, "Lin. Vol. " & $iI+150,11,1)
_GUICtrlListView_AddSubItem($hListView,0, "Promo Vol. " & $iI+160,12,1)
_GUICtrlListView_AddSubItem($hListView,0, "Www " & $iI+170,13,1)
Next
_GUICtrlListView_EndUpdate($hListView)
; Scroll control 500 pixels
_GUICtrlListView_Scroll($hListView, 0, 500)

;_GUICtrlListView_UnRegisterSortCallBack($hListView)
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
;****************+
func _Scomponi ($Dati,$a)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $a = ' & $a & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Dati = ' & $Dati[3] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

For $b= 1 to $a
$Rd_Concorrente[$b] = StringMid($Dati[$b],1,12) ; 12 car
$Rd_Date_Dal[$b] = StringMid($Dati[$b],13,22) ; 10 car
$Rd_Date_Al[$b] = StringMid($Dati[$b],23,32) ; 10 car
$Rd_Titolo [$b] = StringMid($Dati[$b],33,92) ; 60 car
$Rd_Codice[$b] = StringMid($Dati[$b],33,99) ; 7 car
$Rd_Marca[$b] = StringMid($Dati[$b],110,114) ; 15 car
$Rd_Modello[$b] = StringMid($Dati[$b],115,126); 12 car
$Rd_Pollici[$b] = StringMid($Dati[$b],127,128) ; 2 car
$Rd_Tipo[$b] = StringMid($Dati[$b],129,134) ; 6 car
$Rd_Lineare[$b] = StringMid($Dati[$b],135,141) ; 7 car
$Rd_Promo[$b] = StringMid($Dati[$b],142,148) ; 7 car
$Rd_Lin_Vol[$b] = StringMid($Dati[$b],149,155) ; 7 car
$Rd_Promo_Vol[$b] = StringMid($Dati[$b],156,162) ; 7 car
$Rd_Www[$b]= StringMid($Dati[$b],163,232) ; 70 car
#cs MsgBox(0, "Pro:",$Rd_Concorrente[$b] )
MsgBox(0, "Pro_date:",$Rd_Date_Dal[$b] )
MsgBox(0, "Pro:",$Rd_Date_Al[$b])
MsgBox(0, "Pro:",$Rd_Codice[$b] )
MsgBox(0, "Pro:",$Rd_Marca[$b] )
MsgBox(0, "Pro:",$Rd_Modello[$b] )
#ce
Next

EndFunc

Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites



trescon,

And an example of "autoitautoitprovevolantinoconcorrenza.txt" - or at least one line of it? A little difficult to work on the script without the content that is supposed to go into the ListView. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi, try to text can 'be random, as long as I take them into account for the division in the individual variables used in the listview.

The problem 'that displays only the contents of the first column and the text I do not think centers.

thanks


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites

trescon,

Why should I go to the trouble of creating a random string of unknown length to test your code? Either you give me an example or you get no help - simple. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Right, I got what I deserve .... a good scolding.

Sorry, I was angry with my children!

I am attaching to this file, which for now and 'a few lines but in the future will be able' to be several tens of lines.

I hope now you can have all the clues to help me out.

thanks

Concorrenza.txt


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites

trescon,

This is a bit simpler and seems to work: ;)

#include <guiconstantsex.au3>
#include <guilistview.au3>
#include <buttonconstants.au3>
#include <comboconstants.au3>
#include <editconstants.au3>
#include <guiconstantsex.au3>
#include <windowsconstants.au3>
#include <datetimeconstants.au3>
#include <File.au3>

Global $Dati[50]
$a = 20
$c = 50

$Form1 = GUICreate("Lettura", 900, 600, 100, 50)
$Button1 = GUICtrlCreateButton("Conferma", 600, 500, 75, 25)
GUICtrlSetFont(-1, 12, 800, 0, "Calibri")
GUISetState(@SW_SHOW)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _FileReadToArray("concorrenza.txt", $Dati) ; Read the whole file in one go
            _Main()
    EndSwitch
WEnd

Func _Main()

    GUICreate("ListView Scroll", 900, 300)
    Local $hListView = GUICtrlCreateListView("", 2, 2, 894, 268)

    ; Add column
    _GUICtrlListView_AddColumn($hListView, "Insegna", 100)
    _GUICtrlListView_AddColumn($hListView, "Inizio", 100)
    _GUICtrlListView_AddColumn($hListView, "Fine", 100)
    _GUICtrlListView_AddColumn($hListView, "Titolo", 100)
    _GUICtrlListView_AddColumn($hListView, "Codice", 100)
    _GUICtrlListView_AddColumn($hListView, "Marca", 100)
    _GUICtrlListView_AddColumn($hListView, "Modello", 100)
    _GUICtrlListView_AddColumn($hListView, "Pollici", 100)
    _GUICtrlListView_AddColumn($hListView, "Tipo", 100)
    _GUICtrlListView_AddColumn($hListView, "Lin. Neg.", 100)
    _GUICtrlListView_AddColumn($hListView, "Promo Neg.", 100)
    _GUICtrlListView_AddColumn($hListView, "Lin. Vol.", 100)
    _GUICtrlListView_AddColumn($hListView, "Promo Vol.", 100)
    _GUICtrlListView_AddColumn($hListView, "Www", 100)

    GUISetState()

    ; Add items
    _GUICtrlListView_BeginUpdate($hListView)
    ; Loop through the file
    For $b = 1 To $Dati[0]
        Local $iItem = _GUICtrlListView_AddItem($hListView, StringMid($Dati[$b], 1, 12))
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 13, 22), 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 23, 32), 2)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 33, 92), 3, 1);"Titolo " & $iI+70,3,1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 33, 99), 4, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 110, 114), 5, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 115, 126), 6, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 127, 128), 7, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 129, 134), 8, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 135, 141), 9, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 142, 148), 10, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 149, 155), 11, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 156, 162), 12, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 163, 232), 13, 1)
    Next
    _GUICtrlListView_EndUpdate($hListView)
    ; Scroll control 500 pixels
    _GUICtrlListView_Scroll($hListView, 0, 500)

EndFunc   ;==>_Main

Any questions? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Well, it works well and it 'even more slender.

If you look I had added (for now only for reference) the statement "_GUICtrlListView_UnRegisterSortCallBack ($ hListView)", which should be put to its function?

Thanks for everything

Alberto


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites

Hello Melba23, in the example you changed I do not work the splitting of the variable $ data, in the sense that in the first column properly select characters from 1 to 12, in the second and in the other this is no longer (13-22, 23-32, etc.).

The command line is the same, you know me explain why.

When there are things that seem right and should not be divenyo nervous.

Thank you again.


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites

trescon,

not work the splitting of the variable $ data

Have you changed the data or the code? If so, please post them so I can investigate. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Melba Thanks for availability.

No I have not changed anything, the problem 'that the variable $ data is broken down into various parts as it should do, since we use the command Stringmid ().

In practice, the subdivision takes place but the length of the field is not divided and 'correct with respect to the parameters of the command StringMid ().

The program is being edited by you and the file and 'what I posted.

thanks

Alberto


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites

Well, it works well and it 'even more slender.

If you look I had added (for now only for reference) the statement "_GUICtrlListView_UnRegisterSortCallBack ($ hListView)", which should be put to its function?

Thanks for everything

Alberto

This statement I have yet to add, I did some tests but on another copy of the file.

I could not get it to work and I would be grateful if you could give me some advice here.

thanks


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites

trescon,

the subdivision takes place but the length of the field is not divided and 'correct with respect to the parameters of the command StringMid

Then you need to adjust the StringMid values to correctly divide the text. Only you can do that as I have no idea which elements you want to display in which subitem. ;)

_GUICtrlListView_UnRegisterSortCallBack

I would strongly suggest looking at _GUICtrlListView_SimpleSort first - it is much easier to use. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

trescon,

Then you need to adjust the StringMid values to correctly divide the text. Only you can do that as I have no idea which elements you want to display in which subitem. ;)

I would strongly suggest looking at _GUICtrlListView_SimpleSort first - it is much easier to use. ;)

M23

It is right, I know how to divide the filelo just me.

But if you look at the 4 lines attached, taken from the program that we have corrected (more than we, you) limits extraction to control strigmid are there but do not work.

The first line must be drawn 12 characters long, the latter must be 10 characters long, and the third the same 10 characters.

If you try to run the programm with the file that I sent you, you will see that the second field (DATE) that divrebbe be 10 characters long (12/03/2012) is actually much longer.

The same is for the other calpi taken as an example.

Why behave like this?

thanks

Local $iItem = _GUICtrlListView_AddItem($hListView, StringMid($Dati[$b], 1, 12))

_GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 13, 22), 1)

_GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 23, 32), 2)

_GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 33, 92), 3, 1);"Titolo


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites

trescon,

Have you looked at the Help file for StringMid? What is the third parameter called? Have you set it correctly? ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

trescon,

Have you looked at the Help file for StringMid? What is the third parameter called? Have you set it correctly? ;)

M23

I'm sorry but you're right.

I had understood that the third parameter is not the number of characters to extract, but it was up to that character extract.

Gigantic mistake.

I'm sorry I made you persere time.

Now I will try also the command that you suggested.

Meanwhile, thank you very much.

Hello


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites

trescon,

No problem. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

trescon,

This is a bit simpler and seems to work: ;)

#include <guiconstantsex.au3>
#include <guilistview.au3>
#include <buttonconstants.au3>
#include <comboconstants.au3>
#include <editconstants.au3>
#include <guiconstantsex.au3>
#include <windowsconstants.au3>
#include <datetimeconstants.au3>
#include <File.au3>

Global $Dati[50]
$a = 20
$c = 50

$Form1 = GUICreate("Lettura", 900, 600, 100, 50)
$Button1 = GUICtrlCreateButton("Conferma", 600, 500, 75, 25)
GUICtrlSetFont(-1, 12, 800, 0, "Calibri")
GUISetState(@SW_SHOW)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _FileReadToArray("concorrenza.txt", $Dati) ; Read the whole file in one go
            _Main()
    EndSwitch
WEnd

Func _Main()

    GUICreate("ListView Scroll", 900, 300)
    Local $hListView = GUICtrlCreateListView("", 2, 2, 894, 268)

    ; Add column
    _GUICtrlListView_AddColumn($hListView, "Insegna", 100)
    _GUICtrlListView_AddColumn($hListView, "Inizio", 100)
    _GUICtrlListView_AddColumn($hListView, "Fine", 100)
    _GUICtrlListView_AddColumn($hListView, "Titolo", 100)
    _GUICtrlListView_AddColumn($hListView, "Codice", 100)
    _GUICtrlListView_AddColumn($hListView, "Marca", 100)
    _GUICtrlListView_AddColumn($hListView, "Modello", 100)
    _GUICtrlListView_AddColumn($hListView, "Pollici", 100)
    _GUICtrlListView_AddColumn($hListView, "Tipo", 100)
    _GUICtrlListView_AddColumn($hListView, "Lin. Neg.", 100)
    _GUICtrlListView_AddColumn($hListView, "Promo Neg.", 100)
    _GUICtrlListView_AddColumn($hListView, "Lin. Vol.", 100)
    _GUICtrlListView_AddColumn($hListView, "Promo Vol.", 100)
    _GUICtrlListView_AddColumn($hListView, "Www", 100)

    GUISetState()

    ; Add items
    _GUICtrlListView_BeginUpdate($hListView)
    ; Loop through the file
    For $b = 1 To $Dati[0]
        Local $iItem = _GUICtrlListView_AddItem($hListView, StringMid($Dati[$b], 1, 12))
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 13, 22), 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 23, 32), 2)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 33, 92), 3, 1);"Titolo " &amp; $iI+70,3,1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 33, 99), 4, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 110, 114), 5, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 115, 126), 6, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 127, 128), 7, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 129, 134), 8, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 135, 141), 9, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 142, 148), 10, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 149, 155), 11, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 156, 162), 12, 1)
        _GUICtrlListView_AddSubItem($hListView, $iItem, StringMid($Dati[$b], 163, 232), 13, 1)
    Next
    _GUICtrlListView_EndUpdate($hListView)
    ; Scroll control 500 pixels
    _GUICtrlListView_Scroll($hListView, 0, 500)

EndFunc   ;==>_Main

Any questions? :)

M23

Hi, I'm asking you a hint.

How could you see for the previous file I had used as the mode of fixed-length field, adding a hash mark (#) as filler.

The thing however becomes heavy because every time you go to make sure to add and remove fonts.

Wanting to create a file with a variable length field that command you advise me?

Thank you

Alberto

Inviato da iPad


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

trescon,

Separate the various section with a character that you will not use in the text to display and use StringSplit. Save the data like this:

Marcopolo#15/11/2012#01/12/2012#INCREDIBILE !  STAR'S TABLET#0105449#Sharp#LC60LE743E#60#Led#000000#000000#179910#rate da 179,90 €#www.900
Marcopolo#15/11/2012#01/12/2012#INCREDIBILE !  STAR'S TABLET#0014656#Samsung#UE55ES6560#55#Led#000000#000000#159910#rate da 159,90 € + Tablet#www.123
Marcopolo#15/11/2012#01/12/2012#INCREDIBLE!   STAR'S TABLET#0106250#Sony#KDL46HX755#46#Led#000000#000000#1299#rate da 129,90 € + Tablet#www.456
Marcopolo#15/11/2012#01/12/2012#INCREDIBLE!   STAR'S TABLET#0106573#Panasonic#TXL42DT50E#42#Led#000000#000000#109910#rate da 109,90 e + Tablet#www.789
Marcopolo#15/11/2012#01/12/2012#INCREDIBLE!   STAR'S TABLET#0016617#Lg Electronics#42LM640S#42#Led#000000#000000#79910#rate da 79,90 € + Tablet#www.012

I am not sure I have put the "#" delimiters in the correct places, but it should give you the idea. ;)

And then use something like this to read it:

#include <guiconstantsex.au3>
#include <windowsconstants.au3>
#include <datetimeconstants.au3>
#include <File.au3>

Global $Dati
$a = 20
$c = 50

$Form1 = GUICreate("Lettura", 900, 600, 100, 50)
$Button1 = GUICtrlCreateButton("Conferma", 600, 500, 75, 25)
GUICtrlSetFont(-1, 12, 800, 0, "Calibri")
GUISetState(@SW_SHOW)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _FileReadToArray("concorrenza.txt", $Dati) ; Read the whole file in one go
            _Main()
    EndSwitch
WEnd

Func _Main()

    GUICreate("ListView Scroll", 900, 300)
    Local $hListView = GUICtrlCreateListView("", 2, 2, 894, 268)

    ; Add column
    _GUICtrlListView_AddColumn($hListView, "Insegna", 100)
    _GUICtrlListView_AddColumn($hListView, "Inizio", 100)
    _GUICtrlListView_AddColumn($hListView, "Fine", 100)
    _GUICtrlListView_AddColumn($hListView, "Titolo", 100)
    _GUICtrlListView_AddColumn($hListView, "Codice", 100)
    _GUICtrlListView_AddColumn($hListView, "Marca", 100)
    _GUICtrlListView_AddColumn($hListView, "Modello", 100)
    _GUICtrlListView_AddColumn($hListView, "Pollici", 100)
    _GUICtrlListView_AddColumn($hListView, "Tipo", 100)
    _GUICtrlListView_AddColumn($hListView, "Lin. Neg.", 100)
    _GUICtrlListView_AddColumn($hListView, "Promo Neg.", 100)
    _GUICtrlListView_AddColumn($hListView, "Lin. Vol.", 100)
    _GUICtrlListView_AddColumn($hListView, "Promo Vol.", 100)
    _GUICtrlListView_AddColumn($hListView, "Www", 100)

    GUISetState()

    ; Add items
    _GUICtrlListView_BeginUpdate($hListView)
    ; Loop through the file
    For $b = 1 To $Dati[0]
        ; Split the line on the "#" characters
        $aItems = StringSplit($Dati[$b], "#")
        ; Add the first item
        Local $iItem = _GUICtrlListView_AddItem($hListView, $aItems[1], 1, 12)
        ; And then loop through the rest adding them as sub-items
        For $i = 2 To $aItems[0]
            _GUICtrlListView_AddSubItem($hListView, $iItem, $aItems[$i], $i - 1)
        Next
    Next
    _GUICtrlListView_EndUpdate($hListView)
    ; Scroll control 500 pixels
    _GUICtrlListView_Scroll($hListView, 0, 500)

EndFunc   ;==>_Main

All clear? :)

M23

Edited by Melba23
Fixed code tags

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0