-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
The New-ActionButton function has a hidden dependency on the $toolTip variable, which is defined in the script's scope. This tight coupling makes the function less portable and harder to reason about in isolation. To improve encapsulation and reusability, consider passing the ToolTip component as an explicit parameter. You will need to update the calls to this function to pass $toolTip.
function New-ActionButton {
param(
[string]$Text,
[string]$TooltipText,
[System.Windows.Forms.ToolTip]$ToolTip
)
$btn = New-Object System.Windows.Forms.Button
$btn.Text = $Text
$btn.Width = 300
$btn.Height = 25
if ($TooltipText -and $ToolTip) {
$ToolTip.SetToolTip($btn, $TooltipText)
}
return $btn
}
Originally posted by @gemini-code-assist[bot] in #1 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels