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 

Which one is the current "default" ListView?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
UncleScrooge



Joined: 14 Apr 2009
Posts: 75
Location: Italy

PostPosted: Wed Dec 16, 2009 11:20 am    Post subject: Which one is the current "default" ListView? Reply with quote

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 Thu Dec 17, 2009 1:57 pm; edited 3 times in total
Back to top
View user's profile Send private message AIM Address
Guest






PostPosted: Wed Dec 16, 2009 12:41 pm    Post subject: Reply with quote

Code:
Gui, ListView, MyListView3

...please use correct parameters
Code:
Gui, Add, ListView, vMyListView3, ... 
Back to top
wooly_sammoth



Joined: 12 May 2009
Posts: 634
Location: Gloucester UK

PostPosted: Wed Dec 16, 2009 1:04 pm    Post subject: Reply with quote

ControlGetFocus can tell you which control has focus
and ControlFocus can be used to set focus of a control
Back to top
View user's profile Send private message Visit poster's website
UncleScrooge



Joined: 14 Apr 2009
Posts: 75
Location: Italy

PostPosted: Wed Dec 16, 2009 5:30 pm    Post subject: Reply with quote

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 Thu Dec 17, 2009 8:18 am; edited 9 times in total
Back to top
View user's profile Send private message AIM Address
UncleScrooge



Joined: 14 Apr 2009
Posts: 75
Location: Italy

PostPosted: Wed Dec 16, 2009 5:41 pm    Post subject: Reply with quote

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 Thu Dec 17, 2009 9:11 am; edited 4 times in total
Back to top
View user's profile Send private message AIM Address
UncleScrooge



Joined: 14 Apr 2009
Posts: 75
Location: Italy

PostPosted: Thu Dec 17, 2009 8:28 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message AIM Address
jaco0646



Joined: 07 Oct 2006
Posts: 3113
Location: MN, USA

PostPosted: Thu Dec 17, 2009 3:26 pm    Post subject: Reply with quote

"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.
Back to top
View user's profile Send private message Visit poster's website
UncleScrooge



Joined: 14 Apr 2009
Posts: 75
Location: Italy

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

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
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help 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