Jump to content

ListView corresponding with an array?


Recommended Posts

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?

Link to comment
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.
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...