Code: Select all
ControlFocus(_ThisControl)
{
ControlGetFocus, _Focus
Return _Focus = _ThisControl ? True : False
}
Thanks
Code: Select all
ControlFocus(_ThisControl)
{
ControlGetFocus, _Focus
Return _Focus = _ThisControl ? True : False
}
Code: Select all
Return _Focus = _ThisControl ? True : False
Code: Select all
Return _Focus = _ThisControl
How do I implement InStr into my function?boiler wrote: ↑08 Aug 2022, 00:36You can InStr() to check if the contents of one variable are contained within another. There is no “SetMatchMode” for things other than window titles.
By the way, this line doesn’t need the ternary operator:It returns True or False like this:Code: Select all
Return _Focus = _ThisControl ? True : False
Code: Select all
Return _Focus = _ThisControl
The way you have it, you’re saying “If True, return True, else return False” rather than just returning the True or False result.
Code: Select all
ControlFocus(_ThisControl)
{
ControlGetFocus, _Focus, A
Return InStr(_Focus, _ThisControl)
}
Code: Select all
Return SubStr(_Focus, 1, 5) = _ThisControl