Scite4AutoHotkey how to Switch toolbar buttons icon?

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

Scite4AutoHotkey how to Switch toolbar buttons icon?

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 904 times
image.png
image.png (7.47 KiB) Viewed 843 times
Attachments
image.png
image.png (4.93 KiB) Viewed 907 times
cgx5871
Posts: 317
Joined: 26 Jul 2018, 14:02

Re: Scite4AutoHotkey how to Switch toolbar buttons icon?

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 66 times

Return to “SciTE4AutoHotkey”

Who is online

Users browsing this forum: No registered users and 2 guests