Verssuss Posted April 26, 2020 Share Posted April 26, 2020 I can't imagine how to set the size of a variable. To make sure I never exceed it, I should set 9999999999999 ?? #include <GUIConstants.au3> #include <MsgBoxConstants.au3> #include <GUIListView.au3> HotKeySet("{F2}", "_xxx") $GUI = GUICreate("gui", 670, 500) GUISetState() $ListView = GUICtrlCreateListView("Name|No Name|Surrname|Next Name|U cant do it name", 10, 200, 450, 250,$LVS_SHOWSELALWAYS) $LV = GUICtrlGetHandle($ListView) $q = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch Sleep(10) WEnd Func _xxx() HotKeySet("{F2}") Local $asdf[1000] $var2 = _GUICtrlListView_GetSelectedIndices($LV) $asdf[$q] = _GUICtrlListView_InsertItem($LV,"Name "& $q, $var2 + 1) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "IS", 1) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "THIS", 2) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "WROKING", 3) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "RIGHT", 4) _GUICtrlListView_setItemSelected($LV, $asdf[$q], True) _GUICtrlListView_setItemSelected($LV, $asdf[$q] - 1, False) $q = $q + 1 HotKeySet("{F2}", "_xxx") EndFunc also what can be said about my new method of putting the item in any chosen place without any delay. script result based on trial and error how to set item to always be visible?? Link to comment Share on other sites More sharing options...
mikell Posted April 26, 2020 Share Posted April 26, 2020 5 hours ago, Verssuss said: how to set item to always be visible?? _GUICtrlListView_EnsureVisible($LV, $q) About the size of a variable I don't understand the question... Set the one you want, the limitations are mentioned here Verssuss 1 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 26, 2020 Moderators Share Posted April 26, 2020 Verssuss, If you look at the Recursion tutorial in the Wiki and scroll down to the "A little added extra" section at the end you will see a good way of getting an array to expand dynamically to fit any size of data. M23 Verssuss 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Verssuss Posted April 26, 2020 Author Share Posted April 26, 2020 (edited) so i set Global $asdf[16777216] is this any problem with anything now or later ?? i also fixed function a bit and every day it is better (i think) If _GUICtrlListView_GetItemCount($LV) = 1 Then _GUICtrlListView_ClickItem($LV,0) :] just to insert first one Func _xxx() HotKeySet("{F2}") $var2 = _GUICtrlListView_GetSelectedIndices($LV) $asdf[$q] = _GUICtrlListView_InsertItem($LV, "Name "& $q, $var2 + 1) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "IS", 1) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "THIS", 2) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "WROKING", 3) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "RIGHT", 4) _GUICtrlListView_setItemSelected($LV, $asdf[$q], True) _GUICtrlListView_setItemSelected($LV, $asdf[$q] - 1, False) _GUICtrlListView_EnsureVisible($LV, $q) If _GUICtrlListView_GetItemCount($LV) = 1 Then _GUICtrlListView_ClickItem($LV,0) $q = $q + 1 HotKeySet("{F2}", "_xxx") EndFunc Edited April 26, 2020 by Verssuss Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 26, 2020 Moderators Share Posted April 26, 2020 Verssuss, I have just pointed you at some code which means you do not have to set any form of limit and can keep your variables at a sensible size and so save memory. Why not use it? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Verssuss Posted April 26, 2020 Author Share Posted April 26, 2020 (edited) coz i dont know how use it right or it is really needed i never before use redim but i know it is needed and its slowdown program ?? Func _xxx() ;~ HotKeySet("{F2}") If @extended Then $asdf[0] += 1 If UBound($asdf) <= $asdf[0] Then ReDim $asdf[UBound($asdf) * 2] EndIf $var2 = _GUICtrlListView_GetSelectedIndices($LV) $asdf[$q] = _GUICtrlListView_InsertItem($LV, "Name " & $q, $var2 + 1) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "IS", 1) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "THIS", 2) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "WROKING", 3) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "RIGHT", 4) _GUICtrlListView_SetItemSelected($LV, $asdf[$q], True) _GUICtrlListView_SetItemSelected($LV, $asdf[$q] - 1, False) _GUICtrlListView_EnsureVisible($LV, $q) If _GUICtrlListView_GetItemCount($LV) = 1 Then _GUICtrlListView_ClickItem($LV, 0) $q = $q + 1 ;~ HotKeySet("{F2}", "_xxx") EndFunc ;==>_xxx anyway it dont work yet Edited April 26, 2020 by Verssuss Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 26, 2020 Moderators Share Posted April 26, 2020 Verssuss, Here you go: expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <Array.au3> ; Just for the demonstration HotKeySet("{F2}", "_xxx") Global $asdf[3] ; Set a ridiculously low size - normally I would use at least 100 $q = 0 $GUI = GUICreate("gui", 670, 500) $ListView = GUICtrlCreateListView("Name|No Name|Surrname|Next Name|U cant do it name", 10, 200, 450, 250,$LVS_SHOWSELALWAYS) $LV = GUICtrlGetHandle($ListView) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; Sleep(10) ; Not needed - there is an automatic Sleep in GUIGetMsg WEnd Func _xxx() HotKeySet("{F2}") $var2 = _GUICtrlListView_GetSelectedIndices($LV) $asdf[$q] = _GUICtrlListView_InsertItem($LV,"Name "& $q, $var2 + 1) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "IS", 1) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "THIS", 2) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "WROKING", 3) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "RIGHT", 4) _GUICtrlListView_setItemSelected($LV, $asdf[$q], True) _GUICtrlListView_setItemSelected($LV, $asdf[$q] - 1, False) $q = $q + 1 ; Check if array needs resizing If $q = UBound($asdf) Then ReDim $asdf[$q * 2] ; Just to show you what is happening _ArrayDisplay($asdf, "", Default, 8) EndIf HotKeySet("{F2}", "_xxx") EndFunc M23 Verssuss 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Verssuss Posted April 26, 2020 Author Share Posted April 26, 2020 thanks expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <Array.au3> ; Just for the demonstration HotKeySet("{F2}", "_xxx") Global $asdf[10] ; Set a ridiculously low size - normally I would use at least 100 $q = 0 $GUI = GUICreate("gui", 670, 500) $ListView = GUICtrlCreateListView("Name|No Name|Surrname|Next Name|U cant do it name", 10, 200, 450, 250,$LVS_SHOWSELALWAYS) $LV = GUICtrlGetHandle($ListView) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch If $q = UBound($asdf) Then ReDim $asdf[$q +100] _ArrayDisplay($asdf, "", Default, 8) EndIf WEnd Func _xxx() HotKeySet("{F2}") $var2 = _GUICtrlListView_GetSelectedIndices($LV) $asdf[$q] = _GUICtrlListView_InsertItem($LV,"Name "& $q, $var2 + 1) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "IS", 1) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "THIS", 2) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "WROKING", 3) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "RIGHT", 4) _GUICtrlListView_setItemSelected($LV, $asdf[$q], True) _GUICtrlListView_setItemSelected($LV, $asdf[$q] - 1, False) $q = $q + 1 HotKeySet("{F2}", "_xxx") EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 26, 2020 Moderators Share Posted April 26, 2020 Verssuss, If you are concerned about performance - which your question about ReDim suggests you are - why have you moved the size check into the idle loop from the function? Now you are carrying out an If statement every few milliseconds rather then just once when you need it. I put the that check where I did for a reason. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Verssuss Posted April 26, 2020 Author Share Posted April 26, 2020 well. that stupid but i realy knew it.I gonna look for a way to insert this function from outside the xxx function also outside from main loop. just tested it is any working for now be sure m23 this wont be in main loop in later Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now