Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unpinned Toolbar Timeout?
#1
I have created a Toolbar. I don’t want to pin it to a specific window or app. I created it on the areas of desktop, can I have it close (timeout) after a number of seconds?
#2
simplest way is to create a hook function for the toolbar

Function ToolbarSelfClose
Code:
Copy      Help
;/
function# hWnd message wParam lParam

;OutWinMsg message wParam lParam ;;uncomment to see received messages
int-- t
sel message
,case WM_INITDIALOG
,SetTimer hWnd 1 1000 0
,case WM_TIMER
,sel wParam
,,case 1
,,if t =10;; close toolbar after 10 seconds(change number to how many seconds you want it to autoclose)
,,,KillTimer hWnd 1
,,,clo hWnd    
,,t+1
,case WM_DESTROY

then add the function to the toolbar properties
   
#3
Thanks for the reply and help. This is super Smile
#4
Hi, this function worked only once. I can see it counting when I use the message part, but it will not close. Thanks
#5
for some reason, not sure why the counter variable is not being reset when the toolbar closes

use this code instead 

Function ToolbarSelfClose
Code:
Copy      Help
function# hWnd message wParam lParam
type MYTOOLBARVARS
MYTOOLBARVARS* v=+GetProp(hWnd "v") ;;retrieve (required)
;OutWinMsg message wParam lParam ;;uncomment to see received messages

sel message
,case WM_INITDIALOG
,v._new; SetProp(hWnd "v" v) ;;create (required)
,v.a=1;
,SetTimer hWnd 1 1000 0
,case WM_TIMER
,sel wParam
,,case 1
,,out v.a
,,if v.a >=10;; close toolbar after 10 seconds(change number to how many seconds you want it to autoclose)
,,,KillTimer hWnd 1
,,,clo hWnd
,,v.a+1
,case WM_DESTROY
,v._delete; RemoveProp(hWnd "v") ;;destroy (required)
#6
Super as well, that one does the trick. I am really happy to see an example that helps understand how timers in QM work. This also helps a bunch with my Toolbar! Thanks so much Smile
#7
I redid  the  toolbar hookfunction after thinking about it and checking qm help.

This is the proper way to do it. Should not use thread variables in qm toolbar hook functions
Code corrected in post above
#8
I think you are saying that the first version uses thread variables and that the second version is a better way not using thread variables. OK, help me to understand which is a thread variable in the first one. This super cool I am on my way to being like you someday Wink. Chris
#9
a thread variable is the first two examples is int-- t or int- t 

read 
http://www.quickmacros.com/help/Language...ABLES.html

for more info
 also read
http://www.quickmacros.com/help/QM_Help/...OLBAR.html

for more info regarding toolbar hook functions  i adapted the example there for the function above

Gintaras has put a lot of time and effort into creating and making the QM help. It's an invaluable resource.

QM help is available online or directly in qm

   


Forum Jump:


Users browsing this thread: 1 Guest(s)