Jump to content
Verssuss

Cant load items from listview after copy any item

Recommended Posts

hello my problem looks like i do 


Case $menu_file_save
            $file_save = FileSaveDialog("Choose a filename.", "", "Data (*.lvs)", $FD_PATHMUSTEXIST)
            _GUIListViewEx_SaveListView($iLV_Index, $file_save)

after i open program again i use this to load my saved items

Case $menu_file_load
            Local $file_open = FileOpenDialog("Choose Scheme", @ScriptDir & "\", "Data (*.lvs)", $FD_FILEMUSTEXIST)
            _GUIListViewEx_LoadListView($iLV_Index, $file_open)

 

it work almost good but all items are in list by this function

        Case $button_copy
            _GUICtrlListView_CopyItems($ListView, $ListView)

they not save and they not come back after i load
all items come excepted that one what i copy

i use this #include "GUIListViewEx.au3"
 

plz help me

 

Share this post


Link to post
Share on other sites
Posted (edited)

here is my code
 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include "GUIListViewEx.au3"
#include <Array.au3> ; Just for display in example
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <GuiListView.au3>
;~ #include <ListView.au3>
#include <GuiListBox.au3>
#include <GuiImageList.au3>
#include <SendMessage.au3>
#include <ScreenCapture.au3>
#include <Misc.au3>
#include <GuiEdit.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>
#include <File.au3>
#include <AutoItConstants.au3>


$width = 670
$gui_title = "gui"
$GUI = GUICreate($gui_title, 670, 600,@DesktopWidth - ($width + 1), 0)
GUISetState()

$menu_file = GUICtrlCreateMenu("File")
$menu_file_save = GUICtrlCreateMenuItem("Save Settings", $menu_file)
$menu_file_load = GUICtrlCreateMenuItem("Load Settings", $menu_file)


$button_copy = GUICtrlCreateButton("COPY", 480, 220, 50, 25)
$button_up = GUICtrlCreateButton("UP", 480, 330, 50, 25)
$button_down = GUICtrlCreateButton("DOWN", 480, 360, 50, 25)
$button_del_selected = GUICtrlCreateButton("DEL", 480, 390, 50, 25)
$button_add = GUICtrlCreateButton("ADD", 480, 510, 50, 25)


_GUIListViewEx_MsgRegister()
$ListView = GUICtrlCreateListView("111111111111|2|3|4|5|6|7|8", 10, 200, 450, 300, $LVS_SHOWSELALWAYS)
$iLV_Index = _GUIListViewEx_Init($ListView, "", 0, 0, True, 1 + 2 + 8)
_GUIListViewEx_SetEditStatus($iLV_Index, "0;1;2;3;4;5")
_GUICtrlListView_SetExtendedListViewStyle($ListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))

_GUICtrlListView_SetColumnWidth($ListView, 7, 0)


While 1
;~  Sleep(10)

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $menu_file_save
            $file_save = FileSaveDialog("Choose a filename.", "", "Data (*.lvs)", $FD_PATHMUSTEXIST)
            _GUIListViewEx_SaveListView($iLV_Index, $file_save)
        Case $menu_file_load
            Local $file_open = FileOpenDialog("Choose Scheme", @ScriptDir & "\", "Data (*.lvs)", $FD_FILEMUSTEXIST)
            _GUIListViewEx_LoadListView($iLV_Index, $file_open)
        Case $button_del_selected
            _GUIListViewEx_Delete()
        Case $button_up
            _GUIListViewEx_SetActive($iLV_Index)
            _GUIListViewEx_Up()
        Case $button_down
            _GUIListViewEx_SetActive($iLV_Index)
            _GUIListViewEx_Down()


        Case $button_copy
            _GUICtrlListView_CopyItems($ListView, $ListView)
        Case $button_add
            _go()
    EndSwitch

WEnd

Func _go()
    Global $vData[6] = ["Name1 "]
    _GUIListViewEx_Insert($vData)
EndFunc

so press button add few times then select any item and copy it then save file then del all items and load file again. copied items wont load

Edited by Verssuss

Share this post


Link to post
Share on other sites

Thanks for making this snippet.  It greatly helps us to understand what is the issue.  So I tested your code and the function _GUIListViewEx_LoadListView is crashing.  Since it is @Melba23 UDF, and the UDF is not trivial, I will let him see what is going on.  Good luck.

Share this post


Link to post
Share on other sites

Verssuss,

You are using a non-UDF function to add items to the ListView (_GUICtrlListView_CopyItems). Because of this the UDF does not know that these items have been added and so any further manipulation of the ListView with the UDF will almost certainly end in tears as the UDF's internal array will no longer match the actual content. If you use the UDF you MUST use it to do ALL manipulation of the ListView content so that it can keep up with the actual content. So this works for me:

Case $button_copy
            ;_GUICtrlListView_CopyItems($ListView, $ListView)
            $vData = _GUICtrlListView_GetItemTextString($ListView)
            _GUIListViewEx_Insert($vData)

All good now?

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

not exactly.
now u can copy only single item and in back function i was abble to hold ctrl and select as many item i want and copy them all
now if u dont even select any item it just insert empty line to my listwiew.

Share this post


Link to post
Share on other sites

Verssuss,

Case $button_copy
            ;_GUICtrlListView_CopyItems($ListView, $ListView)
            $aSelected = _GUICtrlListView_GetSelectedIndices($ListView, True)
            If $aSelected[0] <> 0 Then
                For $i = $aSelected[0] To 1 Step -1
                    $vData = _GUICtrlListView_GetItemTextString($ListView, $aSelected[$i])
                    _GUIListViewEx_Insert($vData)
                Next
            EndIf

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

Verssuss,

Delighted I could help. Just edit the first post and change the title if you really feel the need to add anything.

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

no i dont need that but i have new problem with that UDF

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include "GUIListViewEx.au3"
#include <Array.au3> ; Just for display in example
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <GuiListView.au3>
;~ #include <ListView.au3>
#include <GuiListBox.au3>
#include <GuiImageList.au3>
#include <SendMessage.au3>
#include <ScreenCapture.au3>
#include <Misc.au3>
#include <GuiEdit.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>
#include <File.au3>
#include <AutoItConstants.au3>


$width = 670
$gui_title = "gui"
$GUI = GUICreate($gui_title, 670, 600,@DesktopWidth - ($width + 1), 0)
GUISetState()

$menu_file = GUICtrlCreateMenu("File")
$menu_file_save = GUICtrlCreateMenuItem("Save Settings", $menu_file)
$menu_file_load = GUICtrlCreateMenuItem("Load Settings", $menu_file)


$button_copy = GUICtrlCreateButton("COPY", 480, 220, 50, 25)
$button_up = GUICtrlCreateButton("UP", 480, 330, 50, 25)
$button_down = GUICtrlCreateButton("DOWN", 480, 360, 50, 25)
$button_del_selected = GUICtrlCreateButton("DEL", 480, 390, 50, 25)
$button_add = GUICtrlCreateButton("ADD", 480, 510, 50, 25)


_GUIListViewEx_MsgRegister()
$ListView = GUICtrlCreateListView("111111111111|2|3|4|5|6|7|8", 10, 200, 450, 300, $LVS_SHOWSELALWAYS)
$iLV_Index = _GUIListViewEx_Init($ListView, "", 0, 0, True, 1 + 2 + 8)
_GUIListViewEx_SetEditStatus($iLV_Index, "0;1;2;3;4;5")
_GUICtrlListView_SetExtendedListViewStyle($ListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))

_GUICtrlListView_SetColumnWidth($ListView, 7, 0)


HotKeySet("{F1}", "_go")
HotKeySet("{F2}", "_go1")

While 1
;~  Sleep(10)

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $menu_file_save
            $file_save = FileSaveDialog("Choose a filename.", "", "Data (*.lvs)", $FD_PATHMUSTEXIST)
            _GUIListViewEx_SaveListView($iLV_Index, $file_save)
        Case $menu_file_load
            Local $file_open = FileOpenDialog("Choose Scheme", @ScriptDir & "\", "Data (*.lvs)", $FD_FILEMUSTEXIST)
            _GUIListViewEx_LoadListView($iLV_Index, $file_open)
        Case $button_del_selected
            _GUIListViewEx_Delete()
        Case $button_up
            _GUIListViewEx_SetActive($iLV_Index)
            _GUIListViewEx_Up()
        Case $button_down
            _GUIListViewEx_SetActive($iLV_Index)
            _GUIListViewEx_Down()


        Case $button_copy
            _GUICtrlListView_CopyItems($ListView, $ListView)
        Case $button_add
            _go()
    EndSwitch

WEnd

Func _go()
    Global $vData[6] = ["Name1 "]
    _GUIListViewEx_Insert($vData)
EndFunc

Func _go1()
    Global $vData[6] = ["Name2 "]
    _GUIListViewEx_Insert($vData)
EndFunc

here error code 


"C:\Users\verss\OneDrive\Pulpit\AUTOIT\GUIListViewEx.au3" (1354) : ==> Subscript used on non-accessible variable.:
Local $iMax_Row = $aGLVEx_SrcArray[0][0]
Local $iMax_Row = $aGLVEx_SrcArray^ ERROR

 

it happend after i press few times F1 and F2. what im doing wrong ? it looks like listwiev not refresh all items before next come.
it just looks like that

Share this post


Link to post
Share on other sites

Verssuss,

And as you have not changed this function in your script:

Case $button_copy
            _GUICtrlListView_CopyItems($ListView, $ListView)

I am not in the least surprised.

Change the function to that I posted earlier and try again.

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

this function working great i already tested just not posted it. and the error I'm talking about has nothing to do with the copy function

Share this post


Link to post
Share on other sites

Verssuss,

Well, I can press FI & F2 multiple times in that script without problem. Can you be more specific about exactly what you do.

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

try meybe press f1 and f2 same time few times it shows u. listwiev no time for refresh i think

Share this post


Link to post
Share on other sites

Verssuss,

I can press both keys together (although I think it is a very bad idea) multiple times without problem.

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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
Posted (edited)

that error in console say nothing ??

i use this 
 Title .........: GUIListViewEx
; AutoIt Version : 3.3.10 +
; Language ......: English

 

even when i hold f1 OR f2 it crash with same error


C:\Users\verss\OneDrive\Pulpit\AUTOIT\GUIListViewEx.au3" (1354) : ==> Subscript used on non-accessible variable.:
Local $iMax_Row = $aGLVEx_SrcArray[0][0]
Local $iMax_Row = $aGLVEx_SrcArray^ ERROR

Edited by Verssuss

Share this post


Link to post
Share on other sites
Posted (edited)

i use this 

 

help > help f1

v3.3.14.5

©1999-2018 Jonathan Bennett & AutoIt Team
 

help > about SCIte 

SciTE
Version 4.1.2 
    Feb 13 2019 23:07:51

 

idk what one is right

 

Edited by Verssuss

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...