AutoHotkey / AutoHotkeyDocs

Documentation for AutoHotkey
https://autohotkey.com/
375 stars 746 forks source link

Update Gui.htm #697

Closed iPhilip closed 3 months ago

iPhilip commented 3 months ago

As currently implemented in the documentation page, the example works but fails to demonstrate the value of setting the window to be the last found window. If the last found window is set, the second parameter in the WinSetTransColor is not necessary.

Below is a test script for reference.


#Requires AutoHotkey v2.0

CustomColor := 'Red'

MyGui := Gui()
MyGui.MarginX := MyGui.MarginY := 0
MyGui.Add('Progress', 'w150 h300 c' CustomColor, 100)
MyGui.Add('Progress', 'x+0 yp w150 h300 cBlue', 100)
MyGui.Show()

F3::
{
   MsgBox WinExist() '`n' MyGui.Hwnd
   MyGui.Opt("+LastFound")  ; Sets MyGui as the last found window.
   WinSetTransColor(CustomColor " 150")
   ; WinSetTransColor(CustomColor " 150", MyGui)
   MsgBox WinExist() '`n' MyGui.Hwnd
}