Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing button depending on Status
#3
See also:

change macro? (toolbar check button that controls a macro)

It shows how to check a toolbar button.

----

Also found this:

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

def TB_GETIMAGELIST (WM_USER + 49)
def TB_CHANGEBITMAP (WM_USER + 43)
dll user32 #UpdateWindow hWnd
type TBBLINK htb iic is

int i hil hic button icon
TBBLINK* p

button=2 ;;toolbar button index. This is line index, including comments.
icon=0 ;;real button index (not including comments)

sel message
,case WM_CREATE
,;PostMessage hWnd WM_APP 1 0
,SetProp hWnd "p" p._new
,case WM_DESTROY
,p=+GetProp(hWnd "p"); p._delete
,
,case WM_APP
,p=+GetProp(hWnd "p")
,if(!p.htb)
,,p.htb=id(9999 hWnd)
,,hil=SendMessage(p.htb TB_GETIMAGELIST 0 0)
,,hic=GetIcon("$qm$\mouse.ico")
,,p.iic=ImageList_ReplaceIcon(hil -1 hic)
,,DestroyIcon hic
,if(wParam) SetTimer hWnd 0 300 0; p.is=0; goto g1
,else KillTimer hWnd 0; p.is=1; goto g1
,
,case WM_TIMER
,;g1
,p=+GetProp(hWnd "p")
,p.is^1
,SendMessage p.htb TB_CHANGEBITMAP button iif(p.is p.iic icon)
,UpdateWindow p.htb
,
,

Toolbar Toolbar8
Code:
Copy      Help
;/hook Toolbar8Proc
-
Macro15 :mac "Macro15"

Macro Macro15
Code:
Copy      Help
int h=win("TOOLBAR8" "QM_Toolbar")
PostMessage h WM_APP 1 0
5
PostMessage h WM_APP 0 0

It shows how to change toolbar button icon at run time. Create function, toolbar and macro. Run toolbar. Click the button or run the macro to see how it works.

----

And this:

Can a menu/toolbar item's text-title be a string variable?

Function that changes button text.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)