Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QM toolbars: how to drag and drop a button
#8
Toolbar
Code:
Copy      Help
;/hook tb_drag_drop_hook
qm.exe :run "$qm$\qm.exe"
My QM :run "$my qm$"
Winamp :run "$program files$\Winamp\winamp.exe"

Function tb_drag_drop_hook
Code:
Copy      Help
;/tb_drag_drop
function# hWnd message wParam lParam

sel message
,case WM_INITDIALOG
,int htb=wParam
,QmRegisterDropTarget(htb hWnd 16)
,
,case WM_DESTROY
,case WM_QM_DRAGDROP
,;get button
,str buttonText
,if(!TB_GetDragDropButton(hWnd buttonText)) ret
,out "dropped on '%s':" buttonText
,
,;get files
,QMDRAGDROPINFO& di=+lParam
,str s
,foreach(s di.files) out s

Function TB_GetDragDropButton
Code:
Copy      Help
;/
function# hWnd [str&tbLabel] [str&tbLine]

;Call this function on WM_QM_DRAGDROP in toolbar hook function.
;Gets some info about the button on which dropped.
;Returns toolbar line index. Returns 0 if dropped not on a button.

;hWnd - hWnd.
;tbLabel - receives button text. Can be 0.
;tbLine - receives button line text. Can be 0.


;button index
int htb=id(9999 hWnd)
POINT p; xm p htb 1
int b=SendMessage(htb TB_HITTEST 0 &p)
if(b<1) ret

;label
if(&tbLabel)
,tbLabel.all
,Acc a=acc("" "TOOLBAR" htb "" "" 0x1000)
,a.elem=b+1; tbLabel=a.Name; err

;line
if(&tbLine)
,tbLine.all
,str s.getwintext(hWnd)
,s.getmacro(s); err goto gr
,tbLine.getl(s b)

;gr
ret b


Messages In This Thread

Forum Jump:


Users browsing this thread: 12 Guest(s)