Sign in to follow this  
Followers 0
Chimp

GUIListViewEx question

7 posts in this topic

#1 ·  Posted (edited)

Hi

only a question about GUIListViewEx
I looked at the examples of GUIListViewEx, but failed to achieve the desired result that would be simply this:

1) I have a 2d array
2) I would like to pass this array to the function GUIListViewEx so that I can view it in a 2d grid (similar to that of _araydisplay), edit it (change values, do all what allowed by GUIListViewEx, and so on)
3) and on exit have as return the same array of point 1 with the changes made in step 2.

is there an easy way to do this with GUIListViewEx

thanks

EDIT:

this thread has been splitted from >this other

Edited by PincoPanco

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

PincoPanco,

 

is there an easy way to do this with GUIListViewEx

Yes, that is exactly what the UDF is designed to do - although you need to create a GUI with a ListView to display the elements so that you can adjust them. ;)

You provide a copy of the array, code for a GUI with a suitably sized ListView control and tell me what you want to be able to do to the data (sort it, edit all or some columns, etc) and I will show you how to set it all up. But I will split your post and this reply into a separate thread so we do not hijack this one.

M23

Edit: Now split - over to you!

Edited by Melba23

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

PincoPanco,

 

Yes, that is exactly what the UDF is designed to do - although you need to create a GUI with a ListView to display the elements so that you can adjust them. ;)

You provide a copy of the array, code for a GUI with a suitably sized ListView control and tell me what you want to be able to do to the data (sort it, edit all or some columns, etc) and I will show you how to set it all up. But I will split your post and this reply into a separate thread so we do not hijack this one.

M23

Edit: Now split - over to you!

 

Hi M23

thanks for splitting this post and for the help.

well, here I post a simple form with an ListView inside filled with the values of the $My_Array (only random value in this example, just to learn how to)

What I would like to do is modify values in the listview using  GUIListViewEx. All values but the first column;

and sort columns by clicking on headers (on months) but not the first column (values of rows should remain tied together during the sort of the single columns, but first column should remain unaffected).

There are few buttons on bottom but only one is used, the one on the left to show the current values contained in $My_Array by _ArayDisplay().

On exit, the modified values should be inside  $My_Array

Is this easily feasible by GUIListViewEx?

I hope I'm not asking too much.

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <Array.au3>

Opt("GUIOnEventMode", 1)

Global $My_Array[99][13]

$Array_Edit = GUICreate("Array edit", 520, 280, -1, -1)
$listview = GUICtrlCreateListView("ID|Janu|Febr|Marc|Apri|May |June|July|Augu|Sept|Octo|Nove|Dece", 10, 10, 500, 218)

; filling of array and ListView ----
Local $Row = ""
For $x = 0 To 98
    $My_Array[$x][0] = $x
    $Row = $My_Array[$x][0] & "|"
    For $y = 1 To 12
        $My_Array[$x][$y] = Random(0, 1000, 1)
        $Row &= $My_Array[$x][$y] & "|"
    Next
    $item = GUICtrlCreateListViewItem(StringTrimRight($Row, 1), $listview)
Next
_GUICtrlListView_SetExtendedListViewStyle($listview, $LVS_EX_GRIDLINES)

; create some buttons (only one used at the moment)
GUICtrlCreateGroup("", 10, 230, 290, 42)
;
$button1 = GUICtrlCreateButton("Show array", 20, 244, 70, 20)
GUICtrlSetTip($button1, "Show current array status via _ArrayDisplay")
GUICtrlSetOnEvent($button1, "_button1")
;
$button2 = GUICtrlCreateButton("button2", 120, 244, 70, 20)
GUICtrlSetTip($button2, "Unused at the moment")
GUICtrlSetOnEvent($button2, "_button2")
;
$button3 = GUICtrlCreateButton("button3", 220, 244, 70, 20)
GUICtrlSetTip($button3, "Unused at the moment")
GUICtrlSetOnEvent($button3, "_button3")
;
GUICtrlCreateGroup("", 320, 230, 190, 42)
;
$button4 = GUICtrlCreateButton("button4", 330, 244, 70, 20)
GUICtrlSetTip($button4, "Unused at the moment")
GUICtrlSetOnEvent($button4, "_button4")
;
$button5 = GUICtrlCreateButton("button5", 430, 244, 70, 20)
GUICtrlSetTip($button5, "Unused at the moment")
GUICtrlSetOnEvent($button5, "_button5")
;
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
WEnd

Func _button1()
    _ArrayDisplay($My_Array, "current array status")
EndFunc   ;==>_button1

Func _button2()

EndFunc   ;==>_button2

Func _button3()

EndFunc   ;==>_button3

Func _button4()

EndFunc   ;==>_button4

Func _button5()

EndFunc   ;==>_button5

Func _Exit()
    _ArrayDisplay($My_Array, "This is the resulting array")
    Exit
EndFunc   ;==>_Exit

Thanks


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

PincoPanco,

Here is the majority of what you want implemented very easily - sort on header click and editable on double click (except column 0): :)

#include <GUIConstantsEx.au3>
#include <GuiListViewEx.au3>
#include <Array.au3>

Opt("GUIOnEventMode", 1)

Global $My_Array[99][13]

$Array_Edit = GUICreate("Array edit", 520, 280, -1, -1)
$listview = GUICtrlCreateListView("ID|Janu|Febr|Marc|Apri|May |June|July|Augu|Sept|Octo|Nove|Dece", 10, 10, 500, 218)
_GUICtrlListView_SetExtendedListViewStyle($listview, $LVS_EX_GRIDLINES)

; filling of array and ListView ----
Local $Row = ""
For $x = 0 To 98
    $My_Array[$x][0] = $x
    $Row = $My_Array[$x][0] & "|"
    For $y = 1 To 12
        $My_Array[$x][$y] = Random(0, 1000, 1)
        $Row &= $My_Array[$x][$y] & "|"
    Next
    GUICtrlCreateListViewItem(StringTrimRight($Row, 1), $listview)
Next

Global $iLV_Index = _GUIListViewEx_Init($listview, $My_Array, 0, 0, False, 3, "1-12")

; create some buttons (only one used at the moment)
GUICtrlCreateGroup("", 10, 230, 290, 42)
;
$button1 = GUICtrlCreateButton("Show array", 20, 244, 70, 20)
GUICtrlSetTip($button1, "Show current array status via _ArrayDisplay")
GUICtrlSetOnEvent($button1, "_button1")
;
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUISetState(@SW_SHOW)

_GUIListViewEx_MsgRegister()

While 1
    Sleep(10)
    _GUIListViewEx_EditOnClick()
WEnd

Func _button1()
    $aTempArray = _GUIListViewEx_ReturnArray($iLV_Index)
    _ArrayDisplay($aTempArray, "current array status")
EndFunc   ;==>_button1

Func _Exit()
    $My_Array = _GUIListViewEx_ReturnArray($iLV_Index)
    _ArrayDisplay($My_Array, "This is the resulting array")
    Exit
EndFunc   ;==>_Exit
The outstanding item is the non-sorting of the first column. This cannot be excluded from the overall sort as the process sorts all columns in the ListView. My current thought is to place these values in a second ListView and link the scrolling so that they are in sync - that should give me something to do this afternoon. :D

M23

1 person likes this

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

#5 ·  Posted (edited)

wow, thanks so much!
thanks to GuiListViewEx.au3 it's easier than I thought!
your example gave me the direction to go :thumbsup:

just one issue: doubble click enters edit mode, but no keys are accepted in the cell, I type on the keyboard but the cell remains white. when exiting from edit mode the previous value is still there.
any suggestion?

Edit:

the above issue was due to a malfunction of an old laptop

on other clients is OK

Edited by PincoPanco

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

PincoPanco,

Mat has kindly developed some code which solves the synchro scrolling of two ListViews, but to get it the whole script to work properly it needs some of the functions in the new Beta Array.au3 I have just posted. So please go and test the new code and then when it is released we can return and finish this script. :)

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

ok
I will go to test
thanks again for the kind help
.... I will stay tuned
bye


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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