Scite4AutoHotkey how to Switch toolbar buttons icon?

The popular SciTE-based AutoHotkey Script Editor
cgx5871
Posts: 315
Joined: 26 Jul 2018, 14:02

Scite4AutoHotkey how to Switch toolbar buttons icon?

Post by cgx5871 » 26 Jan 2023, 09:09

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 849 times
image.png
image.png (7.47 KiB) Viewed 788 times
Attachments
image.png
image.png (4.93 KiB) Viewed 852 times

cgx5871
Posts: 315
Joined: 26 Jul 2018, 14:02

Re: Scite4AutoHotkey how to Switch toolbar buttons icon?

Post by cgx5871 » 02 Feb 2023, 14:35

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.
Attachments
SciTE4AHK.rar
(84.04 KiB) Downloaded 46 times

Post Reply

Return to “SciTE4AutoHotkey”