Get me pointed in the right direction

Talk about anything
sumotide
Posts: 10
Joined: 15 Apr 2014, 18:49

Get me pointed in the right direction

08 Jul 2014, 14:12

Hello,
I was wondering if an experienced AHK coder would be so kind as to direct me toward documentation regarding ListView function of AHK and what it I can do with it. I have looked online but as usual there are links from "other" forum topics that are either offline or not what I was looking for. I am not new to AHK, but I am new to using ListView and technically I am a noob in that area. I have learned what I know about AHK by asking questions and ACTUALLY implenting what was taught to me.

As it is right now, my project requires how I learn to get individual fields in ListView into Edit box's on a GUI. I learned how to create a ListView box on the GUI and I learned how to populate the ListView from the Edit box on the GUI. So essentially I can populate a ListView but I do not know how to populate the Edit boxes located on the GUI from the ListView. I can get it there but I can't get it back.

Thank you for you help in advance.
User avatar
joedf
Posts: 8959
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Get me pointed in the right direction

08 Jul 2014, 14:28

Post some code in "Ask for help"
People including me will gladly help you with that. ;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
tank
Posts: 3122
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: Get me pointed in the right direction

08 Jul 2014, 15:05

i have an unfortunate amount of experience with list views.

forunately i think the help file gets us very very close

Code: Select all

; Create the ListView with two columns, Name and Size:
Gui, Add, ListView, r20 w700 gMyListView, Name|Size (KB)

; Gather a list of file names from a folder and put them into the ListView:
Loop, %A_MyDocuments%\*.*
    LV_Add("", A_LoopFileName, A_LoopFileSizeKB)

LV_ModifyCol()  ; Auto-size each column to fit its contents.
LV_ModifyCol(2, "Integer")  ; For sorting purposes, indicate that column 2 is an integer.

; Display the window and return. The script will be notified whenever the user double clicks a row.
Gui, Show
return

MyListView:
if A_GuiEvent = DoubleClick
{
    LV_GetText(RowText, A_EventInfo)  ; Get the text from the row's first field.
    ToolTip You double-clicked row number %A_EventInfo%. Text: "%RowText%"
}
return

GuiClose:  ; Indicate that the script should exit automatically when the window is closed.
ExitApp
lets look closer at LV_GetText(RowText, A_EventInfo) ; Get the text from the row's first field. accepts a 3rd optional parameter of column so if i used LV_GetText(RowText, A_EventInfo, 2) ; Get the text from the row's Second field

ok so now we know how to get a specific column
what about selected and then a button
same example with some additions

Code: Select all

; Create the ListView with two columns, Name and Size:
Gui, Add, ListView, r20 w700 gMyListView, Name|Size (KB)
Gui, Add, button,section gMyListViewSelectFile,  File
Gui, Add, button, section gMyListViewSelectSize,  Size

; Gather a list of file names from a folder and put them into the ListView:
Loop, %A_MyDocuments%\*.*
    LV_Add("", A_LoopFileName, A_LoopFileSizeKB)

LV_ModifyCol()  ; Auto-size each column to fit its contents.
LV_ModifyCol(2, "Integer")  ; For sorting purposes, indicate that column 2 is an integer.

; Display the window and return. The script will be notified whenever the user double clicks a row.
Gui, Show
return


MyListViewSelectSize:
	column = 2
MyListViewSelectFile:
	{
    LV_GetText(RowText, LV_GetNext("Selected" ), column)  ; Get the text from the row's first field.
    ToolTip You double-clicked row number %A_EventInfo%. Text: "%RowText%"
	}
	column = 1
return
MyListView:
if A_GuiEvent = DoubleClick
{
    LV_GetText(RowText, A_EventInfo)  ; Get the text from the row's first field.
    ToolTip You double-clicked row number %A_EventInfo%. Text: "%RowText%"
}
return

GuiClose:  ; Indicate that the script should exit automatically when the window is closed.
ExitApp
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: Get me pointed in the right direction

08 Jul 2014, 15:17

tank, unfortunately, like the other forum, colors don't seem to be working within codeboxes:
tank wrote:

Code: Select all

[color=#FF0000]MyListViewSelectSize:
	column = 2
MyListViewSelectFile:
	{
    LV_GetText(RowText, LV_GetNext("Selected" ), column)  ; Get the text from the row's first field.
    ToolTip You double-clicked row number %A_EventInfo%. Text: "%RowText%"
	}
	column = 1
return[/color]

User avatar
fincs
Posts: 527
Joined: 30 Sep 2013, 14:17
Location: Seville, Spain
Contact:

Re: Get me pointed in the right direction

08 Jul 2014, 15:49

Colors inside codeboxes do not work either in the other forum. They used to work, though; but poly broke it by introducing extremely broken PHP syntax highlighting.
fincs
Windows 11 Pro (Version 22H2) | AMD Ryzen 7 3700X with 32 GB of RAM | AutoHotkey v2.0.0 + v1.1.36.02
Get SciTE4AutoHotkey v3.1.0 - [My project list]
sumotide
Posts: 10
Joined: 15 Apr 2014, 18:49

Re: Get me pointed in the right direction

08 Jul 2014, 16:19

Thank you for your responses. I didn't want to start a redundant post in the help section as that would probably frustrate those who moderate the forums.

@Tank: Funny thing is I read the help file. I just didn't fully understand it. Thank you for explaining it to me. I do believe that I understand it better now or at least enough to start implementing for my project. I do believe you may have connected the dots. Thanks again! Is it Ok that I PM as I learn or have questions?
Morpheus
Posts: 119
Joined: 04 Oct 2013, 05:09

Re: Get me pointed in the right direction

08 Jul 2014, 18:40

Personally, I think it is better to post your questions so that others may learn from them.
User avatar
tank
Posts: 3122
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: Get me pointed in the right direction

08 Jul 2014, 19:34

wow never noticed ill fix that very soon
I do not respond to PM's for help
keep it in the forum where everyone can learn from it.
the only exceptions i make is if you need to share confidential information via PM
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
User avatar
joedf
Posts: 8959
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Get me pointed in the right direction

08 Jul 2014, 19:46

Lol me neither, ... Ok ok... It's true I'm colorblind.. :P
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
codybear
Posts: 42
Joined: 25 Feb 2014, 04:28

Re: Get me pointed in the right direction

14 Jul 2014, 04:07

joedf wrote: It's true I'm colorblind.. :P
My friend from high school (like 5+ years ago) is color blind.
Many years ago for his birthday, I bought him a Rubik's cube.

Needless to say, I got punched for that one. Worth it. :D
User avatar
joedf
Posts: 8959
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Get me pointed in the right direction

14 Jul 2014, 12:06

You meanie! >:(
Lol good one though, I would have probably done the same haha!
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Return to “Off-topic Discussion”

Who is online

Users browsing this forum: No registered users and 62 guests