Posts: 8
Threads: 2
Joined: Mar 2011
Hello QM Forum,
I have run into a problem I have never encountered before. For some reason out of the blue, my toolbar has stopped hiding when I minimize the hwnd it's attached to. Ive tried reinstalling QM, making a whole new QM file in case the old one was corrupted, cleaning the QM registry for the toolbar, and changing the flags multiple times without any success. The trigger I am using to set the toolbar isn't on the toolbar macro it self, but on a function that calls the toolbar, because it does more then one thing when opening the toolbar. Here is the code example of what I'm working with.
Toolbar Toolbar
;/mov 0 0 /siz 94 22 /set 0x525 0xFCFF /transp "" b
Text :mac "TO_Text" * $qm$\text.ico
Keys :mac "TO_Keys" * $qm$\keyboard.ico
Function Set_Toolbar
Trigger !cv"Notepad" "Notepad"
int hwnd=val(_command)
mac "Toolbar" id(15 hwnd)
Posts: 12,140
Threads: 142
Joined: Dec 2002
id(15 hwnd) is a child window. QM toolbars cannot be attached to child windows. Should be mac "Toolbar" hwnd
Posts: 8
Threads: 2
Joined: Mar 2011
OK it still works being attached to the hwnd, but is what you mean by it wont work is that it wont have full functionality?
Posts: 8
Threads: 2
Joined: Mar 2011
Can a child window be given permissions of a parent window? So then if the toolbar is attached to said child window the "child window" acts as if it is a top level parent window?
Posts: 12,140
Threads: 142
Joined: Dec 2002
No. Later I'll try to find or create a function that attaches a toolbar to a child window.
Posts: 8
Threads: 2
Joined: Mar 2011
OK thank's, will be waiting.
Posts: 576
Threads: 97
Joined: Aug 2007
Can you use another function with Acc objects trigger to tell when window is minimized and from there hide the toolbar?
As shown below...
Function Function47
Trigger $a 22 0 "" "Notepad"
function hwnd idObject idChild
out "Notepad minimized"
hid "toolbarfunction"
;...rest of code
Use Menu > Tools > Output > Log > Acc. Trigger Events to grab Acc trigger info
Will be noted as follows for example above,
16. MINIMIZESTART, WINDOW, 0
ow: class="Notepad", text="Untitled - Notepad"
ao: role=WINDOW, state=0x168000, name="Untitled - Notepad"
Posts: 8
Threads: 2
Joined: Mar 2011
Hello Gintaras,
I have found a way to simulate what I wanted to do before, but for some reason the toolbar keeps reappearing after hiding it. Here is the code I'm using.
Macro Macro
hid win("Notepad_Toolbar" "QM_toolbar")
What I would like to do is have the toolbar disappear when the window its attached to is minimized and have it reappear when the window is restored back to its original state. I have already figured out the triggers for this to happen, but I'm not too sure on how to complete the hiding/reappearing of the toolbar effectively as normal hid+ & hid- codes aren't working properly. Any ideas?
Posts: 12,140
Threads: 142
Joined: Dec 2002
Create this function.
Function th_attach_to_child
;/
function# hWnd message wParam lParam
sel message
,case WM_INITDIALOG
,SetTimer hWnd -1 200 0
,
,case WM_TIMER
,sel wParam
,,case -1
,,int w=GetToolbarOwner(hWnd)
,,int wa=GetAncestor(w 2)
,,if(w=wa) ret
,,if !IsWindow(w)
,,,clo hWnd
,,else if min(wa) or hid(wa)
,,,if(!hid(hWnd)) hid w; hid hWnd
,,else
,,,if(hid(hWnd)) hid- w; hid- hWnd
err+
First line of toolbar:
Toolbar Toolbar
;/hook th_attach_to_child /mov 0 0 /siz 94 22 /set 0x525 0xFCFF /transp "" b
Posts: 8
Threads: 2
Joined: Mar 2011
WOW! Thank you very much Gintaras!
|