AutoHotkey Community

It is currently May 25th, 2012, 4:09 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: September 20th, 2007, 1:22 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8657
Location: Salem, MA
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" )
}

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2007, 2:12 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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)

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 1:24 am 
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. :cry:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 5:07 pm 
Offline

Joined: April 15th, 2009, 12:05 am
Posts: 75
Location: Italy
Absolutely agreed.
not forgetting (btw):
A_TreeView

_________________
Intel Centrino @ 2.8GHz
4 GB RAM
WIN XP SP3


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 21st, 2010, 7:54 pm 
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.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group