Sign in to follow this  
Followers 0
LoWang

ListView corresponding with an array?

3 posts in this topic

I have a multidimensional array for storing time, formatted time to display and description text. Then I have a ListView where I display these columns:

formatted time (without the date string), calculated time until alarm, description text

This way I create listview items:

$alarms[$a][0]=GUICtrlCreateListViewItem($alarm_dispcas&"||"&$alarm_text,$listview1)
   $alarms[$a][1]=$alarm_setcas
   $alarms[$a][2]=$alarm_dispcas
   $alarms[$a][3]=$alarm_text

Calculated time does not need to be in the array, because it's just being continuously updated in the second column of listview.

In the first index of the array, I store listview item handle, but I am not sure if it is of any use, because I need to somehow get array and listview synchronised while deleting items. When I delete an item, there is no way of getting it's handle which GUICtrlCreateListViewItem function returns, so there is no easy way to find what to delete in the array! I have the index of currently deleted listview item, but after deleting, the rest will no longer correspond with the array indexes. Is there any other way then to shift all the array indexes after deleting the listview item to keep them synchronised?

Share this post


Link to post
Share on other sites



I have a multidimensional array for storing time, formatted time to display and description text. Then I have a ListView where I display these columns:

formatted time (without the date string), calculated time until alarm, description text

This way I create listview items:

$alarms[$a][0]=GUICtrlCreateListViewItem($alarm_dispcas&"||"&$alarm_text,$listview1)
   $alarms[$a][1]=$alarm_setcas
   $alarms[$a][2]=$alarm_dispcas
   $alarms[$a][3]=$alarm_text

Calculated time does not need to be in the array, because it's just being continuously updated in the second column of listview.

In the first index of the array, I store listview item handle, but I am not sure if it is of any use, because I need to somehow get array and listview synchronised while deleting items. When I delete an item, there is no way of getting it's handle which GUICtrlCreateListViewItem function returns, so there is no easy way to find what to delete in the array! I have the index of currently deleted listview item, but after deleting, the rest will no longer correspond with the array indexes. Is there any other way then to shift all the array indexes after deleting the listview item to keep them synchronised?

Can't you just shift all the array elements up one from the deletd item onwards?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Can't you just shift all the array elements up one from the deletd item onwards?

OMG There has to be an eaiser way :whistle: I tried _ArrayDelete, but it does not work with multidimensional arrays so I will have to write some crazy function for this and I am really tired right now :P

Edited by LoWang

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