Posts: 795
Threads: 136
Joined: Feb 2009
Hi Gintaras, hi all
i use massively the routine to act with firefox tabs. i use one that gives a popupmenu from opened tabs names, and the currently selected tab has it's menu item bold.
I failed trying to autoselect it when menu pops.
Can you help?
Thanks
Function
FirefoxUrlFromTabName
type NAMEURL str'name str'url
ARRAY(NAMEURL) m
MenuPopup p
NAMEURL& r=m[]
for int'i 0 names.len
,if(empty(urls[i])) continue
,r.name=names[i]
,r.url=urls[i]
,p.AddItems(r.name i+1)
;;
p.SetBold(selectedTab+1)
int ii=p.Show-1; if(ii<0) ret
;int hwnd=win("" "#32768")
s=urls[ii]
Posts: 12,051
Threads: 140
Joined: Dec 2002
What is "autoselect" here?
Posts: 795
Threads: 136
Joined: Feb 2009
Well, the menu item in bold (default) should be autoselected so i don't have to navigate with mouse/keyboard to go to it, and I could launch it directly with enter key.
Clearer?
Posts: 12,051
Threads: 140
Joined: Dec 2002
Need a hook or other thread.
Also will need Show(0 0 1) to activate the menu to enable keyboard.
Posts: 12,051
Threads: 140
Joined: Dec 2002
Function
FirefoxUrlFromTabName
MenuPopup p.AddItems("1a[]2bold[]3c")
p.SetBold(2)
mac "menu_autoselect" "" 2
int ii=p.Show(0 0 1)-1; if(ii<0) ret
;int hwnd=win("" "#32768")
out ii
Function
menu_autoselect
;\
function n
int hwnd=wait(5 WV win("" "#32768"))
rep n
,PostMessage hwnd WM_KEYDOWN VK_DOWN 0
Posts: 795
Threads: 136
Joined: Feb 2009
Was almost ther, except the outside function to make it work.
Tweaked with +1 added to item number to have the right one chosen, and voilà, another solved problem.
TY Gintaras