Posts: 1,271
Threads: 399
Joined: Mar 2003
is there a way to move a qm toolbar with left mouse ?
maybe with a drag area around the other buttons ?
for most cases i can live with right mouse/move,
but for my dynamic toolbars with only one button,
simple left drag would be better.
Posts: 1,271
Threads: 399
Joined: Mar 2003
or should i use 'hello world' subsitudes (from samples 2) ?
if so, how to make areas available for left move window/dialog ?
Posts: 12,073
Threads: 140
Joined: Dec 2002
Posts: 1,271
Threads: 399
Joined: Mar 2003
no, thats not an option.
i have seen windows without caption which can be moved by hold left on an empty area.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Toolbar Toolbar12
;/hook TB_MoveLeftButton
button :mes 1
Function TB_MoveLeftButton
;/
function# hWnd message wParam lParam
def TB_HITTEST (WM_USER + 69)
int+ g_tb_move_htb g_tb_move_hfore
POINT+ g_tb_move_pos
POINT p
sel message
,case WM_SETCURSOR
,if(lParam=WM_LBUTTONDOWN<<16|HTCLIENT)
,,if(wParam=hWnd)
,,else if(GetDlgCtrlID(wParam)=9999)
,,,GetCursorPos &p; ScreenToClient wParam &p
,,,if(SendMessage(wParam TB_HITTEST 0 &p)>=0) ret ;;button
,,else ret
,,
,,GetCursorPos &g_tb_move_pos
,,g_tb_move_htb=hWnd
,,g_tb_move_hfore=win
,,act hWnd ;;for SetCapture
,,SetCapture hWnd
,
,case [WM_LBUTTONUP,WM_CANCELMODE]
,g_tb_move_htb=0
,SetCapture 0
,act g_tb_move_hfore; err
,
,case WM_MOUSEMOVE
,if(g_tb_move_htb=hWnd)
,,RECT r; GetWindowRect hWnd &r
,,GetCursorPos &p
,,mov r.left+p.x-g_tb_move_pos.x r.top+p.y-g_tb_move_pos.y hWnd
,,g_tb_move_pos=p
,,
,
Posts: 1,271
Threads: 399
Joined: Mar 2003
that should go to Resources !!!!
thanks.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Updated. Now restores active window.
Posts: 1,271
Threads: 399
Joined: Mar 2003
and how can i assign move toolbar to a button ?
would be handy when using a transparent toolbar.
thanks
Posts: 12,073
Threads: 140
Joined: Dec 2002
Needs only simple modification. SendMessage(wParam TB_HITTEST 0 &p) returns 1-based button index. If not on button, returns a negative value.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Also needs a delay because toolbar control steals mouse capture.
;/
function# hWnd message wParam lParam
def TB_HITTEST (WM_USER + 69)
int+ g_tb_move_htb g_tb_move_hfore
POINT+ g_tb_move_pos
POINT p
sel message
,case WM_SETCURSOR
,if(lParam=WM_LBUTTONDOWN<<16|HTCLIENT)
,,if(wParam=hWnd)
,,else if(GetDlgCtrlID(wParam)=9999)
,,,GetCursorPos &p; ScreenToClient wParam &p
,,,int i=SendMessage(wParam TB_HITTEST 0 &p)
,,,;if(i>=0) ret ;;button
,,,if(i>=0 and i!=2) ret ;;button, except button 2
,,else ret
,,PostMessage hWnd WM_APP 0 0
,,
,case WM_APP
,GetCursorPos &g_tb_move_pos
,g_tb_move_htb=hWnd
,g_tb_move_hfore=win
,act hWnd ;;for SetCapture
,SetCapture hWnd
,
,case [WM_LBUTTONUP,WM_CANCELMODE]
,g_tb_move_htb=0
,SetCapture 0
,act g_tb_move_hfore; err
,
,case WM_MOUSEMOVE
,if(g_tb_move_htb=hWnd)
,,RECT r; GetWindowRect hWnd &r
,,GetCursorPos &p
,,mov r.left+p.x-g_tb_move_pos.x r.top+p.y-g_tb_move_pos.y hWnd
,,g_tb_move_pos=p
,,
,
Posts: 1,271
Threads: 399
Joined: Mar 2003
one toolbar purpose is to have a toolbar on rightclick min button
in triggerwindow.
actually for me it will be triggerd on left min when the window is on second
screen.
the concept is quite simple:
hide window and show dynamic toolbar with window icon (GetWindowIcon),
on click the toolbar will be closed and window restored.
so the toolbar has only one button ( if(i!=1) ) and moving is fine,
but now i need a way to execute code when there has been no
WM_MOUSEMOVE.
currently i try a lot without a solution.
and is there a way to have the qm_button at x y 0 0 ?
btw. could you please extend DynamicToolbar to accept an own path ?
i cloned the function, but it would be better to have this in system.
thanks
Posts: 12,073
Threads: 140
Joined: Dec 2002
Please explain:
Quote:own path
Posts: 12,073
Threads: 140
Joined: Dec 2002
Quote:and is there a way to have the qm_button at x y 0 0 ?
Set button position in toolbar? No. Maybe it is possible to set toolbar control (id(9999 toolbar)) position.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Quote:but now i need a way to execute code when there has been no WM_MOUSEMOVE.
Try DragDetect function. Example is in one of recent posts. But then the toolbar probably must be activated.
Posts: 1,271
Threads: 399
Joined: Mar 2003
WM_MOUSEMOVE:
maybe the wrong term.
i can't execute the code which is on the toolbar.
my intension is do check if there has been a toolbar position change
on WM_LBUTTONUP when nothing else is possible.
own path:
DynamicToolbar2
;\
function# $text [$tempitemname] [hwndowner] [$folder]
;Shows toolbar created at run time.
;text - menu text. Same as in usual popup menus.
;tempitemname - name of temporary toolbar. Default: "temp_toolbar".
;,If toolbar with this name already exists, it is closed.
;hwndowner - owner window handle.
;folder - if set toolbar will be saved in custom folder
;Returns toolbar window handle.
;EXAMPLE
;*note:
;;you need a vaild folder path
;int hwnd=win(mouse)
;int icon=GetWindowIcon(hwnd)
;str code
;code.format(" /mov %i %i /siz 44 44 /isiz 32 32 /hook _thumb_min /ini ''$my qm$\Toolbars\thumb_min.ini''" xm ym)
;code.formata("[]huhu :out ''huhu'' *%i" icon)
;DynamicToolbar2(code "thumb_min" 0 "\mouse\rightclick\functions\tmp\")
;DestroyIcon(icon)
if(!len(tempitemname)) tempitemname="temp_toolbar"
if(!len(folder)) folder="\User\Temp"
str cmd; if(hwndowner) cmd=hwndowner
ret mac(newitem(tempitemname text "Toolbar" "" folder 1) cmd)
Posts: 1,271
Threads: 399
Joined: Mar 2003
Gintaras Wrote:Quote:and is there a way to have the qm_button at x y 0 0 ?
Set button position in toolbar? No. Maybe it is possible to set toolbar control (id(9999 toolbar)) position.
MoveWindow id(9999 win("THUMB_MIN" "QM_toolbar")) -4 -4 bcx bcy 1
Posts: 12,073
Threads: 140
Joined: Dec 2002
Use timer.
;/
function# hWnd message wParam lParam
def TB_HITTEST (WM_USER + 69)
int+ g_tb_move_htb g_tb_move_hfore
POINT+ g_tb_move_pos
POINT p
sel message
,case WM_SETCURSOR
,if(lParam=WM_LBUTTONDOWN<<16|HTCLIENT)
,,if(wParam=hWnd)
,,else if(GetDlgCtrlID(wParam)=9999)
,,,GetCursorPos &p; ScreenToClient wParam &p
,,,int i=SendMessage(wParam TB_HITTEST 0 &p)
,,,if(i!=1) ret
,,else ret
,,;PostMessage hWnd WM_APP 0 0
,,GetCursorPos &g_tb_move_pos
,,SetTimer hWnd 547 300 0
,,
,;case WM_APP
,;GetCursorPos &g_tb_move_pos
,;g_tb_move_htb=hWnd
,;g_tb_move_hfore=win
,;act hWnd ;;for SetCapture
,;SetCapture hWnd
,case WM_TIMER
,if(wParam=547)
,,KillTimer hWnd wParam
,,ifk (1) ;;still pressed, so lets drag
,,,g_tb_move_htb=hWnd
,,,g_tb_move_hfore=win
,,,act hWnd ;;for SetCapture. Try to remove this. On Vista works well anyway.
,,,SetCapture hWnd
,
,case [WM_LBUTTONUP,WM_CANCELMODE]
,g_tb_move_htb=0
,SetCapture 0
,act g_tb_move_hfore; err
,
,case WM_MOUSEMOVE
,if(g_tb_move_htb=hWnd and GetCapture=hWnd)
,,RECT r; GetWindowRect hWnd &r
,,GetCursorPos &p
,,mov r.left+p.x-g_tb_move_pos.x r.top+p.y-g_tb_move_pos.y hWnd
,,g_tb_move_pos=p
,,
Posts: 1,271
Threads: 399
Joined: Mar 2003
Posts: 12,073
Threads: 140
Joined: Dec 2002
Quote:extend DynamicToolbar to accept an own path
Ok, tempitemname will accept full path, eg "\folder\temp_tb".
Posts: 5
Threads: 1
Joined: Jun 2007
Hello I have read this topic and has helped me in some forms that I have made I have the toolbar to be able to stick to each indavidual window but I can't get the actions to operate seperate windows the macros aperate both windows at the same time. What im trying to do here is make the toolbar operate 2 or more windows using seperate comands. Is there some code I can put in the trigger or does it have to be in the function window in which the toolbar is writen?
|