Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QmRegisterDropTarget; Toolbar drag drop, button double click
#1
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
pi
#2
Example. If dropped on topmost 20 pixels (client), inserts button. If below, displays path(s).

Function tb_hook_dd
Code:
Copy      Help
;/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
Code:
Copy      Help
;/hook tb_hook_dd

case WM_SIZE ret 1 prevents autoresizing tb control when resizing toolbar.
#3
i have to try it at home ...
do we now have drop support also for qm buttons on toolbars ?

Code:
Copy      Help
;/hook tb_hook_dd
testbutton1 :out "huhu 1" *any_icon.ico
testbutton2 :out "huhu 2" *any_icon2.ico
pi
#4
To be notified when dropped on a button?
#5
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
pi
#6
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?
#7
my deskbar has buttons for each drive,
leftclick opens an expanded menu and on doubleclick the drive itself
will be opened in explorer.
pi
#8
Function TbFolderMenu
Code:
Copy      Help
;/
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
Code:
Copy      Help
C: :TbFolderMenu "C:\" * "C:\"
Q: :TbFolderMenu "Q:\" * "Q:\"
#9
here is a simple solution to identify the button where a file has been dropped on

Code:
Copy      Help
case WM_QM_DRAGDROP
     Acc a=acc(mouse)
     sel a.Name
        case "Firefox"
           .....
pi
#10
or

sel a.elem
,case 2
,...
#11
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
pi
#12
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.
#13
i need it, but i thought the menu will show only on single click.
it would be also helpful for other scripts too.
pi
#14
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?
#15
Gintaras Wrote:But single click is part of double click.
but how is for example powerpro managing to have single and doubleclick
actions ?
pi
#16
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.
#17
acc can't be used in exe, so how do i get the ToolbarWindow32 button
where a file has been dropped on ?

thanks
pi
#18
Quote:acc can't be used in exe

Why?
#19
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:
pi
#20
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.
#21
2.
i added TBSTYLE_TOOLTIPS to your Explorer-style dialog.
i get no tooltips.
Code:
Copy      Help
SetWinStyle htb TBSTYLE_FLAT|TBSTYLE_TOOLTIPS 1
pi
#22
Also need to process TBN_GETINFOTIP in DEX_Dialog.

Code:
Copy      Help
,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
#23
Gintaras Wrote:Get id when you know index?

well until now i even had no index.

Code:
Copy      Help
,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.
pi
#24
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) ?
pi
#25
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.


Forum Jump:


Users browsing this thread: 1 Guest(s)