AutoHotkey Community

It is currently May 27th, 2012, 12:36 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: December 16th, 2009, 12:20 pm 
Offline

Joined: April 15th, 2009, 12:05 am
Posts: 75
Location: Italy
EDIT (bumped up Dec 17th): are really there no AHK nerds able to answer to this? (even "no it aint possible!! stop whining around and bothering the forum!!" would do it..)

------------------

I've got 3 ListViews in a GUI.
How do I know (other than intrinsically knowing it because I set in in my code; "Gui, ListView, MyListView3" whereas MyListView1 and MyListView2 exist as well on the same GUI) from a common subroutine or function, for instance, which one is the current "default" ListView upon which to operate?
Note: in this script the caller cannot pass this info.

EDIT: I'm adding my latest msg here so whomever opens this thread for the 1st time hasn't got to read throughout all of it (and hopefully dont get it wrong...):

AHK Official Documentation wrote:
Built-in Functions for ListViews
All of the ListView functions operate upon the current thread's default GUI window (which can be changed via Gui, 2:Default). If the default window does not exist or has no ListView controls, all functions return zero to indicate the problem.

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.

Now: to do this AHK must keep the default-listview track somewhere... so the dry question is: is that place accessible, to read its contents at least?

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


Last edited by UncleScrooge on December 17th, 2009, 2:57 pm, edited 3 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 16th, 2009, 1:41 pm 
Code:
Gui, ListView, MyListView3

...please use correct parameters
Code:
Gui, Add, ListView, vMyListView3, ... 


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 16th, 2009, 2:04 pm 
Offline

Joined: May 12th, 2009, 2:37 pm
Posts: 640
Location: Gloucester UK
ControlGetFocus can tell you which control has focus
and ControlFocus can be used to set focus of a control


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 16th, 2009, 6:30 pm 
Offline

Joined: April 15th, 2009, 12:05 am
Posts: 75
Location: Italy
Anonymous wrote:
Code:
Gui, ListView, MyListView3

...please use correct parameters
Code:
Gui, Add, ListView, vMyListView3, ... 

please DO read my post... and above all: please read AHK documentation to be sure you are on track..
Code:
Gui, Add, ListView, vMyListView1
Gui, Add, ListView, vMyListView2
Gui, Add, ListView, vMyListView3
Gui, Add, Button, SomeAction
Gui, Show

SomeAction:
Gui, ListView, MyListView1 ; this set the 1st ListView as default

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


Last edited by UncleScrooge on December 17th, 2009, 9:18 am, edited 9 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 16th, 2009, 6:41 pm 
Offline

Joined: April 15th, 2009, 12:05 am
Posts: 75
Location: Italy
wooly_sammoth wrote:
ControlGetFocus can tell you which control has focus
and ControlFocus can be used to set focus of a control

doesnt help...
Code:
Gui, Add, ListView, vMyListView1
Gui, Add, ListView, vMyListView2
Gui, Add, ListView, vMyListView3
Gui, Add, Button, SomeAction
Gui, Show
......................
......................
ButtonSomeAction:
AddItem()     ; here the focus is on the button...
return           ; but I can think of plenty of other situations...


but above all wooly_sammoth: the default listview is set by the code and not by the user actions over a GUI... which means that even though MyListViewN has the focus, it's not necessarily the default ListView for the code's actions

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


Last edited by UncleScrooge on December 17th, 2009, 10:11 am, edited 4 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 9:28 am 
Offline

Joined: April 15th, 2009, 12:05 am
Posts: 75
Location: Italy
AHK Official Documentation wrote:
Built-in Functions for ListViews
All of the ListView functions operate upon the current thread's default GUI window (which can be changed via Gui, 2:Default). If the default window does not exist or has no ListView controls, all functions return zero to indicate the problem.

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.

Now: to do this AHK must keep the default-listview track somewhere... so the dry question is: is that place accessible, to read its contents at least?

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 4:26 pm 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
"no it aint possible!! stop whining around and bothering the forum!!" :wink:

You may add your support to the Wish List topic: A_ListView or A_CurrentListView.


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

Joined: April 15th, 2009, 12:05 am
Posts: 75
Location: Italy
jaco0646 wrote:
You may add your support to the Wish List topic: A_ListView or A_CurrentListView.

done

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


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], iDrug, Leef_me, Ohnitiel, rjgatito, Yahoo [Bot] and 20 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