Page 1 of 1

Scite4AutoHotkey how to Switch toolbar buttons icon?

Posted: 26 Jan 2023, 09:09
by cgx5871
I want to set this buttons,
change V1 and V2 by clicking, and display the corresponding icon at the same time.

when i click this buttons Change V1.ico or V2.ico
Image

Code: Select all

; Toolbar event handler
OnToolbar(hToolbar, pEvent, pTxt, pPos, pId)
{
	global
	Critical
	if (pPos=2){
	
		IconFile:="C:\Users\Enigma\Desktop\ahkV2.ico"
		SwitchAhkVersion(hToolbar, pEvent, pTxt, pPos, pId,IconFile)
	} else if pEvent = click
		RunTool(pPos)
}
SwitchAhkVersion(hToolbar, pEvent, pTxt, pPos, pId,IconFile){
	if pEvent = click
	{
		hIcon := DllCall("LoadImage", uint, 0, str, IconFile, uint, 1, int, 0, int, 0, uint, LR_LOADFROMFILE:=0x10)
			if (!hIcon)
				Throw "Icon file missing or invalid in `nChangeWindowIcon(" IconFile ", " WinSpec ")`n`n"
		SendMessage, 0x80, 0, hIcon,, ahk_id %hToolbar%
		SendMessage, 0x80, 1, hIcon,, ahk_id %hToolbar%
	}
}
image.png
image.png (10.29 KiB) Viewed 903 times
image.png
image.png (7.47 KiB) Viewed 842 times

Re: Scite4AutoHotkey how to Switch toolbar buttons icon?

Posted: 02 Feb 2023, 14:35
by cgx5871
I have fixed it myself,
Left click, switch version
Right click, pop-up version selection menu

by file structure
Put it directly into the Scite directory
toolicon.icl is the icon file.