mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2008
Posts: 44
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Mar 2008
Posts: 44
hi

am unable to display a popup menu loaded from a file using a toolbar button

This is the line..
Code:
  toolbar -az3u Settings Settings %button.path "C:\popupfilename.txt"

I tried using a.mrc file as the popup file too

the below code works proper
Code:
  toolbar -az3u Settings Settings %button.path 


Thanks
-------

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Insert a /command before the popupfile (called "/alias" in the helpfile).
Although you have to use the slash for the command in a /toolbar definition, the /command parameter seems to be required if you specify a popupfile, because the different parameters are separated by space (in contrast to e.g. the syntax of the newer $tip() where you can "omit" parameters, as they are separated by commas).

If you don't want to execute any command on icon-leftclick, having your popup open on icon-rightclick, add "/noop" as the command.

Example:
/toolbar -az3u Settings Settings %button.path /noop "C:\popupfilename.txt"

Joined: Mar 2008
Posts: 44
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Mar 2008
Posts: 44
Horst, once again, thanks.
just tried it, & it works fine :thumbsup:

is it possible to get the menu on a left click itself ?

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Afaik it's not possible ...at least not without third party dlls; and as I never did something with a dll related to the toolbar I can't provide a clue what dll to look for, sorry.

Joined: Jul 2003
Posts: 40
H
Ameglian cow
Offline
Ameglian cow
H
Joined: Jul 2003
Posts: 40
With DLL it's possible.

Exemple with cwnd.dll:
Code:
;Start: /tool
;Stop:  /tool stop

alias tool {
  if (!$1) {
    cwnd subclass tool $dll(cwnd.dll,findWindowEx,$window(-2).hwnd > > mIRC_ToolBar) 0 tool
    cwnd block tool 1 LBUTTONUP
  }
  elseif ($1 == stop) cwnd sfree tool
  elseif ($2 == LBUTTONUP) { 
    var %parms = $5-6
    var %i = 0, %a = 1, %x = $3, %y = $4, %handle = $cwnd(getInfo,tool handle)
    while (%i < 34) {
      tokenize 32 $tool_coords(%i)
      if (!$1- || $3 == 1) { 
        inc %i
        continue
      }
      if ($inrect(%x,%y,$1,$2,$3,$4)) {
        ;%a = Nth Button of the toolbar
        if (%a != 5) {
          cwnd callWindowProc tool LBUTTONUP %parms
        }
        else cwnd callWindowProc tool RBUTTONUP 0 $calc(%x + %y * 65536)
        break
      }
      inc %i
      inc %a
    }
  }
}
alias -l tool_coords {
  cwnd newStruct rect 16
  if (!$cwnd(sendMessage,$cwnd(findWindowEx,$window(-2).hwnd > > mIRC_ToolBar) 1053 $1 $cwnd(getStructInfo,rect pointer))) return 0
  var %s $cwnd(getStructInfo,rect dword 0) $cwnd(getStructInfo,rect dword 4) $&
  $calc($cwnd(getStructInfo,rect dword 8) - $cwnd(getStructInfo,rect dword 0)) $& 
  $calc($cwnd(getStructInfo,rect dword 12) - $cwnd(getStructInfo,rect dword 4))
  cwnd delStruct rect
  return %s
}
alias -l cwnd {
  if ($isid) {
    var %res = $dll($scriptdircwnd.dll,$1,$2-)
    if ($prop != $null) return $gettok(%res,$prop,32)
    return %res
  }
  dll " $+ $scriptdircwnd.dll" $1-
}
But it's not complete, a mouseover bug occurs when the left click (as a right click) is performed on the choosen button (in this example: mse) frown

Last edited by HadS; 20/06/09 03:04 AM.

Link Copied to Clipboard