Posts: 116
Threads: 19
Joined: Nov 2006
i am having troubles with a code of mine, it works if u can see the list item but if the list item isnt visible it wont work. The window is active and visible when i try to make the macro highlight the Object. i have used accesible objects from the toolbar, and it works fine but my problem is i can not make it work if the text of the ID isnt visible. here is the code that i have bro, i hope it helps. if you dont understand what i mean then i will send a screen shot. all i wana do is make it so that the macro high lights the list item in a scroll bar but if the scroll bar is scrolled all the way down and the list item is at the top then it will not work, and send me an error, but if there both at the top and visible then it wont send me an error and it will work. ty bro so kindly i will be back on later to see if you have replied till then i have to go to work
gota work 2 shifts. peace and ty
Posts: 1,769
Threads: 410
Joined: Feb 2003
Quote: here is the code that i have bro, i hope it helps
where?
Posts: 12,092
Threads: 142
Joined: Dec 2002
If it is SysListView32 control or inherited from it, you can send LVM_ENSUREVISIBLE message to make an item visible (scroll to it). Example:
int hwnd=child("FolderView" "SysListView32" win("" "ExploreWClass") 0x1)
int index=60
def LVM_ENSUREVISIBLE 0x00001013
SendMessage hwnd LVM_ENSUREVISIBLE index 0
Posts: 116
Threads: 19
Joined: Nov 2006
can i use id instead of child? and ty bro for the reply.
Posts: 12,092
Threads: 142
Joined: Dec 2002
Yes.
Functions id and child are just two different ways to get child window handle.
Posts: 116
Threads: 19
Joined: Nov 2006
ok bro i found it out, but this is the thing now. i show the code.
str s.getwintext(id(6"Search"));err
Acc a=acc("Excel 810" "LISTITEM" "Excel" "SysListView32" "" 0x1031);err
a.Select(SELFLAG_TAKEFOCUS|SELFLAG_TAKESELECTION)
what i want to do now is i type the # into a dialog then hit search, then i wana use getwintext so that when i run the macro it gets the text from the dialog then searches for it. instead of having to type it in the Macro itself. i was wondoring if you could help me out and that is my last question i have besides how you make dialog timer count like 00:00:00:00 in minutes and hours and seconds. what i want is the # 810 to equal string s. so that when i change the # in dialog it will change in the code.
Posts: 20
Threads: 8
Joined: Mar 2007
Regarding the LVM_ENSUREVISIBLE statement, I'm trying to use it, but my window often scrolls horizontally instead of vertically. Is there a way to specify the direction?
Posts: 12,092
Threads: 142
Joined: Dec 2002
No. I tried with Explorer and Winamp, and never scrolls horizontally.
Posts: 20
Threads: 8
Joined: Mar 2007
I played around with it a bit more and it looks like it scrolls horizontally when the item is wider than what can be displayed on the screen. In that case, it tries to display the center of the item, scrolling horizontally part of the way. Thanks for trying.
Posts: 12,092
Threads: 142
Joined: Dec 2002
Insert this after
def SB_LEFT 6
SendMessage hwnd WM_HSCROLL SB_LEFT 0