Refreshing ListView breaks scrolling Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
AlleyArtwork
Posts: 30
Joined: 09 Jun 2015, 21:08

Refreshing ListView breaks scrolling

06 Apr 2017, 21:27

I created a proof of concept gui for the intended use of our HelpDesk to manage and communicate amongst themselves priority/severity incidents.
Eventually I want this to feed into another app (as read only) that our operations uses so they can see any priority/severity tickets the helpdesk is coordinating.

The first load works fine. The listview is scrollable.
After the listview refreshes (10 seconds to start) 2 odd things happen that i can't figure out why:
* The Gui size gets slightly larger, just a little bit, one time, both in width and height
* The ListView is no longer scrollable

Any idea why?

below is the Proof of concept.
Warning: Running this script will create a TEMP folder on your C drive and create a TEST.CSV with some generic data for use in the test in that directory
(only if you choose Yes at the msgbox prompt).

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



and a bonus question if anyone knows.. is there a way to omit the first column which indicates the line# of the file being read? it's actually been useful for testing, but I don't think it needs to be in the final version of what I want (like reading row 500 after a year or two of tickets being escalated etc.)
loop {
MsgBox, Life is like an Infinite Message Box of chocolates.`nThere are %a_index% chocolates in this box.
}
just me
Posts: 5459
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Refreshing ListView breaks scrolling

07 Apr 2017, 01:08

You're not refreshing the ListView. You're creating additional ListView and Text controls each time the Gui is updated.

I suggest to create the whole Gui (including all controls) only once when the script is started. After that, only refresh the controls:
Alternatively, destroy your Gui and recreate it.
User avatar
AlleyArtwork
Posts: 30
Joined: 09 Jun 2015, 21:08

Re: Refreshing ListView breaks scrolling

07 Apr 2017, 22:06

Thanks Just Me!
I'm definitely doing it wrong. I can get it to work with a button, using LV_Delete() and LV_Add() in the loop that reads the file, but I can't seem to put the function of what the button does into an automation/loop. Below I've done what you suggested in part, by creating the whole gui first, though it's the controls for the listview i'm still struggling with.

I'm assuming you add the GuiControl inside of a loop instead, but i'm not sure how to get it to write to the complete looped contents of the LV_Add() to the listview properly, since the loop is adding it 1 line at a time as it reads through the CSV file.
At one point, I sort of had the automatic refresh working but it would only add in 4 lines of the file at a time (not sure why 4 lines at a time instead of only 1. well, obviously bad scripting is why)

Updated: Here's the clickable working version with the button for refreshing, but the end goal is to have what the "datagrab" (refresh button) subroutine is doing when clicked, to instead automatically run every xSeconds so that when the CSV file is altered and saved, the listview automatically shows the changes.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

loop {
MsgBox, Life is like an Infinite Message Box of chocolates.`nThere are %a_index% chocolates in this box.
}
just me
Posts: 5459
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Refreshing ListView breaks scrolling  Topic is solved

08 Apr 2017, 02:04

Hi Alley,

that's what I would try to do in this case (see comments):

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Edit1: Changed datagrab:.

Edit2: In case I misunderstood your puspose, here's another version of datagrab: always processing the whole file:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
AlleyArtwork
Posts: 30
Joined: 09 Jun 2015, 21:08

Re: Refreshing ListView breaks scrolling

08 Apr 2017, 08:38

Thanks again Just Me!
The second option is what I need. I misunderstood you the first time and was trying to add a guicontrol do the ListView itself (unsuccessfully of course).
I'm let me explain a little of the purpose of what I am building into part of a larger toolset.

Basically, there's a helpdesk team that manages communication of outages/severities/priorities (different places call them different things), to the business, mostly affecting our various call centers in different locations.
-- the "Arch!ve" was not a typo, it was a way to tag a particular line as no longer required to display in the listview but allows keeping the data if the helpdesk wanted to keep all data tracked directly in the CSV file. Hind sight this is probably not required.

I already have an app built for our operations that does a bunch of other things; In a new tab on this app I was going to include this data/dashboard.
The Helpdesk can update a master file with their currently running outages, and all of operations can see the status through the dashboard which is running on their desktops.
This will help reduce call and ticket volume since known issues will be instantly communicated with a side benefit of internal awareness to the helpdesk themselves (people come in late/didn't get the memo etc.).

side note:
One of those tabs is a user-customizable hotkeys creation though it's extremely limited. (only 5 customizable hotkeys though limited by size of gui... trying to squeeze in more by adding a scrollable window inside of a tab but it doesn't seem possible. If you were interested in looking at another working example of what that particular section looks like, I posted it here: https://autohotkey.com/boards/viewtopic ... 54#p140154
Maybe i'm trying to do this wrong too.

Either way, thank you so much! this was extremely helpful and I learned a new way to parse something! i'll have to read up on it to understand it better, but that's fine with me!
loop {
MsgBox, Life is like an Infinite Message Box of chocolates.`nThere are %a_index% chocolates in this box.
}

Return to “Ask For Help”

Who is online

Users browsing this forum: 2X7W, RobbieWilkes, s-ve-n and 82 guests