Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
icons in PopupMenu
#1
i trigger a windowlist menu with a mouse stroke

Code:
Copy      Help
str titles exe

GetWindowList &titles "" 1|2|4
ARRAY(str) arr = titles
for(int'i 0 arr.len)
,int hwnd=arr[i]
,exe.getwinexe(arr[i] 1)

int p=PopupMenu(titles 0 0)

is there a way to use icons in PopupMenu ?

i tried using DynamicMenu, but have problems when the window text is a path or contains colon/s like here in the forum.

thanks.
pi
#2
No, but you can escape : and ", and use DynamicMenu.

Code:
Copy      Help
str titles exe
ARRAY(int) handles
GetWindowList &titles "" 1|2|4 0 0 handles
ARRAY(str) arr = titles

for(int'i 0 arr.len)
,int hwnd=handles[i]
,exe.getwinexe(hwnd 1)
,
,arr[i].escape(1) ;;escape "
,arr[i].findreplace(":" "[91]58]") ;;escape :
,arr[i].formata(" : * %s" exe)
,
titles=arr

int p=DynamicMenu(titles "" 1)
if(p) act handles[p-1]

;This is not perfect. Should get icon with GetWindowIcon instead, but icon handles are not supported in menus (until QM 2.1.8).
#3
how about saving GetWindowIcon to a .ico file ?
that would be nice, because windows explorer launched in bblean shell
has bblean as exename, so my menu shows the wrong icon.
pi
#4
Good idea, but I don't know a function to save icon files.
#5
is it not possible to use the drag icon preview function from the icon editor ?
pi
#6
i have a workaround.

Code:
Copy      Help
ClearOutput
str titles exe
ARRAY(int) handles
GetWindowList &titles "" 1|2|4 0 0 handles
ARRAY(str) arr = titles

for(int'i 0 arr.len)
,int hwnd=handles[i]
,exe.getwinexe(hwnd 1)
,if _s.getfilename(exe 0)=="blackbox"
,,exe = "explorer.exe *0"
,if arr[i]=="QM Help"
,,exe = "c:\windows\hh.exe *1"
,arr[i].findreplace(":" " ") ;;escape :
,arr[i].escape(1) ;;escape "
,arr[i].formata(" : * %s" exe)
,
titles=arr

int p=DynamicMenu(titles "" 1)
if(p) act handles[p-1]

it also shows the help icon for qm help.

btw. i think its not necessary to close qm help on qm close.
what is the reason for doing so ?
pi


Forum Jump:


Users browsing this thread: 1 Guest(s)