Posts: 1,271
Threads: 399
Joined: Mar 2003
can you please post the hook procedure you do mention in
Dll functions exported by QM ?
the page is missing in the chm and on the help page.
http://www.quickmacros.com/help/User/IDH_EXTOOLBAR.html
thanks
Posts: 12,140
Threads: 142
Joined: Dec 2002
Example. If dropped on topmost 20 pixels (client), inserts button. If below, displays path(s).
Function tb_hook_dd
;/Toolbar23
function# hWnd message wParam lParam
sel message
,case WM_INITDIALOG
,siz 0 20 id(9999 hWnd) 1; err
,;QmRegisterDropTarget(wParam hWnd 16)
,QmRegisterDropTarget(hWnd 0 16)
,
,case WM_SIZE
,ret 1
,
,case WM_DESTROY
,case WM_QM_DRAGDROP
,QMDRAGDROPINFO& di=+lParam
,str s
,foreach(s di.files) out s
Toolbar Toolbar23
case WM_SIZE ret 1 prevents autoresizing tb control when resizing toolbar.
Posts: 1,271
Threads: 399
Joined: Mar 2003
i have to try it at home ...
do we now have drop support also for qm buttons on toolbars ?
;/hook tb_hook_dd
testbutton1 :out "huhu 1" *any_icon.ico
testbutton2 :out "huhu 2" *any_icon2.ico
Posts: 12,140
Threads: 142
Joined: Dec 2002
To be notified when dropped on a button?
Posts: 1,271
Threads: 399
Joined: Mar 2003
yes and without adding a new button ...
like a firefox button where i drop html files on.
btw.
do you have a working example for using doubleclick on a toolbar button ?
thanks
Posts: 12,140
Threads: 142
Joined: Dec 2002
Quote:yes and without adding a new button
Use QmRegisterDropTarget(wParam hWnd 16) instead.
Quote:do you have a working example for using doubleclick on a toolbar button ?
What do you want to do on double click?
Posts: 1,271
Threads: 399
Joined: Mar 2003
my deskbar has buttons for each drive,
leftclick opens an expanded menu and on doubleclick the drive itself
will be opened in explorer.
Posts: 12,140
Threads: 142
Joined: Dec 2002
Function TbFolderMenu
;/
function $path [$path2]
int+ g_tbclicktime
int t=GetTickCount
if(t-g_tbclicktime>500)
,str s sp(path)
,if(len(path2)) sp.formata("'' ''%s" path2)
,s.format(" /expandfolders[]. ''%s''" sp)
,DynamicMenu s
else run path
g_tbclicktime=t
Toolbar example
C: :TbFolderMenu "C:\" * "C:\"
Q: :TbFolderMenu "Q:\" * "Q:\"
Posts: 1,271
Threads: 399
Joined: Mar 2003
here is a simple solution to identify the button where a file has been dropped on
case WM_QM_DRAGDROP
Acc a=acc(mouse)
sel a.Name
case "Firefox"
.....
Posts: 12,140
Threads: 142
Joined: Dec 2002
or
sel a.elem
,case 2
,...
Posts: 1,271
Threads: 399
Joined: Mar 2003
i am sorry to say, but your example is not working as expected,
because single click will always executed too(menu always shows up).
how to prevent this ?
thanks
Posts: 12,140
Threads: 142
Joined: Dec 2002
I thought you need it. It works like when you double click icon on window title bar. If no, remove DynamicMenu s and 3 lines before it.
Posts: 1,271
Threads: 399
Joined: Mar 2003
i need it, but i thought the menu will show only on single click.
it would be also helpful for other scripts too.
Posts: 12,140
Threads: 142
Joined: Dec 2002
But single click is part of double click. Would it be better to show menu after double click timeout, which is 500 ms by default?
Posts: 1,271
Threads: 399
Joined: Mar 2003
Gintaras Wrote:But single click is part of double click. but how is for example powerpro managing to have single and doubleclick
actions ?
Posts: 12,140
Threads: 142
Joined: Dec 2002
Don't have PowerPro.
I see only these possibilities:
1. Run macro only on click.
2. Run macro only on double click.
3. Run macro on click (immediately) AND on double click.
4. Run macro on click (after some time, eg 500 ms) OR on double click.
Posts: 1,271
Threads: 399
Joined: Mar 2003
acc can't be used in exe, so how do i get the ToolbarWindow32 button
where a file has been dropped on ?
thanks
Posts: 12,140
Threads: 142
Joined: Dec 2002
Quote:acc can't be used in exe
Why?
Posts: 1,271
Threads: 399
Joined: Mar 2003
doh :oops:
i thought it read it some time ago.
anyways, is it possible to get the toolbar button id ?
another question:
can the CToolTip class be used to add tooltips to toolbar buttons too ?
or do i have something like in this code:
here, use this function i wrote, it will help you create a toolbar to ur window:
Posts: 12,140
Threads: 142
Joined: Dec 2002
Quote:is it possible to get the toolbar button id
Get id when you know index? Don't remember, see in MSDN library. There should be some message that begins with TB_. Probably TB_GETBUTTON.
Quote:can the CToolTip class be used to add tooltips to toolbar buttons too
I think no.
Toolbar control automatically displays tooltips if created with TBSTYLE_TOOLTIPS style.
Posts: 1,271
Threads: 399
Joined: Mar 2003
2.
i added TBSTYLE_TOOLTIPS to your Explorer-style dialog.
i get no tooltips.
SetWinStyle htb TBSTYLE_FLAT|TBSTYLE_TOOLTIPS 1
Posts: 12,140
Threads: 142
Joined: Dec 2002
Also need to process TBN_GETINFOTIP in DEX_Dialog.
,case 3 ;;toolbar
,sel nh.code
,,case TBN_GETINFOTIP
,,NMTBGETINFOTIP* tt=+lParam
,,str-- stt
,,stt.format("tooltip text of button %i" tt.iItem)
,,tt.pszText=stt
Posts: 1,271
Threads: 399
Joined: Mar 2003
Gintaras Wrote:Get id when you know index?
well until now i even had no index.
,case WM_QM_DRAGDROP
,,QMDRAGDROPINFO& di=+lParam
,,POINT pp; xm(pp htb)
,,int btn_index=SendMessage(htb TB_HITTEST 0 &pp)
,,out btn_index
but id is not so important, because i have all relevant button infos stored in an array.
Posts: 1,271
Threads: 399
Joined: Mar 2003
Gintaras Wrote:Quote:yes and without adding a new button
Use QmRegisterDropTarget(wParam hWnd 16) instead.
how do i enable my buttons to accept also text (on a qm toolbar) ?
Posts: 12,140
Threads: 142
Joined: Dec 2002
Don't remember exactly. When you get QMDRAGDROPINFO variable di, look in di.formats for a clipboard format you need, probably CF_TEXT, and then extract text using di.dataObj.GetData(...). More about it in MSDN library. Search for IDataObject::GetData.
|