01-12-2009, 05:50 PM
Toolbar tb_drag_select
Function tb_drag_select_f
Trigger #Lh1 0x1 /WORDPAD /FF_tb_drag_select
Function FF_tb_drag_select (this is filter function. Set it in Properties)
On mouse left button down in client area of a WORDPAD window, runs FF_tb_drag_select. Edit it. ret -2 if it is wrong window or wrong child window. On button up, runs tb_drag_select_f. It measures drag distance, checks whether there is selected text, and if all ok launches the toolbar or moves it to mouse position.
Function tb_drag_select_f
Trigger #Lh1 0x1 /WORDPAD /FF_tb_drag_select
;is drag distance >=4 pixels?
POINT+ g_tbds
POINT p; xm p
if(_hypot(p.x-g_tbds.x p.y-g_tbds.y)<4) ret
;is text selection?
str s.getsel
if(!s.len) ret
int h=win("TB_DRAG_SELECT" "QM_Toolbar")
if(h) mov xm-10 ym+10 h
else mac "tb_drag_select"
Function FF_tb_drag_select (this is filter function. Set it in Properties)
;/
function# iid FILTER&f
;if(!childtest(f.hwnd2 ...)) ret -2
POINT+ g_tbds
xm g_tbds
ret iid
;ret iid - run the macro.
;ret macro - run other macro. Here 'macro' is its id or name.
;ret 0 - don't run any macros.
;ret -1 - don't run any macros but eat the key. Eg if the filter function started a macro using mac.
;ret -2 - don't run this macro. Other macros with the same trigger can run.
On mouse left button down in client area of a WORDPAD window, runs FF_tb_drag_select. Edit it. ret -2 if it is wrong window or wrong child window. On button up, runs tb_drag_select_f. It measures drag distance, checks whether there is selected text, and if all ok launches the toolbar or moves it to mouse position.