ClassNN in multiple GUIs vs tooltip Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
BriHecato
Posts: 124
Joined: 18 Jul 2017, 07:17

ClassNN in multiple GUIs vs tooltip

12 May 2018, 15:24

How to set or change ClassNN of a control (Picture) in my custom Gui?

I've build 3 guis based on pictures (when clicked - gosub gPicLabel), simple kind of radial menu.
8x picuters in each GUI like that Gui, GUI1:Add, Picture, x y w Icon13 gGUI1Pic1Click, icons.dll

I'm displaying tooltips for them with

Code: Select all

Gui, Gui1:Show
OnMessage(0x200, "ttip")

ttip(wParam, lParam, Msg)
{
	MouseGetPos,,,, pichover
	IfEqual, pichover, Static1
		ttip:="pic1 tootip"
	...	
	ToolTip % ttip	
}
Now problem is this - when I'm spying on my menus my pictures ClassNN are:
in GUI1 from "Static1" to "Static8"
in GUI2 from "Static1" to "Static8"
in GUI3 from "Static1" to "Static8"

I need that those classes are like that:
in GUI1 from "Static1" to "Static8"
in GUI2 from "Static9" to "Static16"
in GUI3 from "Static17" to "Static24"
or in any other way different amongs GUIs

And due to this in GUI3 i get tooltips from GUI1
A_AhkUser
Posts: 1147
Joined: 06 Mar 2017, 16:18
Location: France
Contact:

Re: ClassNN in multiple GUIs vs tooltip

12 May 2018, 16:44

Hi BriHecato,

You can associate a variable with a control by specifying after the letter v a variable name in the control's options. GuiControlGet comes with an option that allows to retrieve this latter by means of the control's hwnd - which can be retrieved by the MouseGetPos command:

Code: Select all

i := 1
Loop, 3 {
	GUI, New
	Loop, 10 {
		Gui, Add, Picture, % "w32 h-1 icon" . a_index . " vmyIcons" . i++, imageres.dll
	}
	GUI, Show, % "w100 x" 300 + a_index * 120
}
OnMessage(WM_MOUSEMOVE:="0x200", "f")
return


f() {
MouseGetPos,,,, _hwnd
if (_hwnd) {
	GuiControlGet, _v, name, % _hwnd
	ToolTip % InStr(_v, "myIcons") ? _v : ""
} else ToolTip
}
my scripts
User avatar
BriHecato
Posts: 124
Joined: 18 Jul 2017, 07:17

Re: ClassNN in multiple GUIs vs tooltip  Topic is solved

13 May 2018, 01:27

Thanks for assistance but I'm not creating gui nor pictures in loop. And freshly removed all hVar from gui elemenst (with previously used routine If (CurrControl <> PrevControl and not InStr(CurrControl, " ")))
Was thinking how to differ guis and found that ahk_class and ahk_exe are unfortunately children of ahk ;)

So rechecked help and I've done it this way:
Change Gui, GUI1 +LastFound +AlwaysOnTop -Caption +ToolWindow to Gui, GUI1:New, +LastFound +AlwaysOnTop -Caption +ToolWindow, MyGUI1
Remove NoActivate from Gui show.
This way I could add IfWinActive, MyGUI1 for all three GUIs on top of tooltips:

Code: Select all

ttip(wParam, lParam, Msg)
{
IfWinActive, MyGUI1
	{
	MouseGetPos,,,, pichover
	IfEqual, pichover, Static1
		ttip:="pic1 tootip"
	...	
	}
IfWinActive, MyGUI2
	{
	..
	}
IfWinActive, MyGUI3
	{
	..
	}
	ToolTip % ttip	
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo and 231 guests