Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
make toolbar movable
#1
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.
pi
#2
or should i use 'hello world' subsitudes (from samples 2) ?

if so, how to make areas available for left move window/dialog ?
pi
#3
Only if you add caption.

Code:
Copy      Help
;/style 0xc00000 0x80
#4
no, thats not an option.
i have seen windows without caption which can be moved by hold left on an empty area.
pi
#5
Toolbar Toolbar12
Code:
Copy      Help
;/hook TB_MoveLeftButton
button :mes 1

Function TB_MoveLeftButton
Code:
Copy      Help
;/
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
,,
,
#6
[Image: wahooo.gif]

that should go to Resources !!!!

thanks.
pi
#7
Updated. Now restores active window.
#8
and how can i assign move toolbar to a button ?
would be handy when using a transparent toolbar.

thanks
pi
#9
Needs only simple modification. SendMessage(wParam TB_HITTEST 0 &p) returns 1-based button index. If not on button, returns a negative value.
#10
Also needs a delay because toolbar control steals mouse capture.

Code:
Copy      Help
;/
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
,,
,
#11
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
pi
#12
Please explain:

Quote:own path
#13
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.
#14
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.
#15
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
Code:
Copy      Help
;\
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)
pi
#16
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.

Code:
Copy      Help
MoveWindow id(9999 win("THUMB_MIN" "QM_toolbar")) -4 -4 bcx bcy 1
pi
#17
Use timer.

Code:
Copy      Help
;/
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
,,
#18
amazing !!!
pi
#19
Quote:extend DynamicToolbar to accept an own path

Ok, tempitemname will accept full path, eg "\folder\temp_tb".
#20
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?


Forum Jump:


Users browsing this thread: 1 Guest(s)