AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A_ListView or A_CurrentListView

 
Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Thu Sep 20, 2007 12:22 am    Post subject: A_ListView or A_CurrentListView Reply with quote

ListView wrote:

If the window has more than one ListView control, by default the functions operate upon the one most recently added. To change this, specify Gui, ListView, ListViewName, where ListViewName is the name of the ListView's associated variable or its ClassNN as shown by Window Spy. Once changed, all existing and future threads will use the indicated ListView.


It would be nice if this command updates a variable such as A_ListView (global) with the Hwnd of the current ListView so that I can do something like this (based on code from Skan):


Code:

;Lib\LV.ahk
LV_GetCol(Column=1, parameter="width"){
  If (parameter = "width)
  {
      SendMessage, (LVM_GETCOLUMNWIDTH := 0x101D), (Column-1),0,, ahk_id %A_ListView%
      Return ErrorLevel
  }

}


I am slowly building a StdLib compatible collection of LV functions, and it would be nice to not have to pass the HWND, since all the built-in LV functions do not need it. (keeps the style nice), though I suppose for now I will do it the same way as the excellent LV Color changing script, which is alread in my library.

Code:

LV_ColorInitiate(Index_Column=1,Gui_Number=1, Control="SysListView321") ; initiate listview color change procedure
{
  global hw_LV_ColorChange, LV_Index_Column
  LV_Index_Column := Index_Column
  Gui, %Gui_Number%:+Lastfound
  Gui_ID := WinExist()
  ControlGet, hw_LV_ColorChange, HWND,, %Control%, ahk_id %Gui_ID%
  OnMessage( 0x4E, "WM_NOTIFY" )
}

_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Sun Sep 23, 2007 1:12 pm    Post subject: Reply with quote

I agree.

I would preferable add another optional parameter to LV functions and frends, so I can say which ListView control is in question.

This is indeed very anoying aspect of AHK.

Acctually, it would be good v2 solve this general ahk problem about design that is practical or possible only for 1 control of particular class (Tab to be the worst case)
_________________
Back to top
View user's profile Send private message
Guest






PostPosted: Thu Feb 26, 2009 12:24 am    Post subject: Reply with quote

I agree whole-heartedly. The LV functions should accept a parameter indicating which listview in the script to operate on.

for instance, I propose:

LV_ADD("vMyListview","Value 1","Value 2")

instead of:

GUI, LISTVIEW, MyListview
LV_ADD("","Value 1","Value 2")

using the "global listview pointer" via gui,listview,mylistview is a serious headache for scripts that have settimers operating on many different listviews! you have to use critical on/off to guarantee that the "global listview pointer" does not get changed unexpectedly by another thread before the LV operations are complete. Crying or Very sad
Back to top
UncleScrooge



Joined: 14 Apr 2009
Posts: 75
Location: Italy

PostPosted: Thu Dec 17, 2009 4:07 pm    Post subject: Reply with quote

Absolutely agreed.
not forgetting (btw):
A_TreeView
_________________
Intel Centrino @ 2.8GHz
4 GB RAM
WIN XP SP3
Back to top
View user's profile Send private message AIM Address
Guest






PostPosted: Wed Apr 21, 2010 6:54 pm    Post subject: Reply with quote

Up...

And, as a compromise to the thread-interrupt whatnot, I'll wish for:
Code:
lv_hwnd := LV_GetHandle()

, which puts the issue into a similar context as the other LV_*() functions.
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group