HelpProvider show HelpString on button press

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 11 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
jpbruckler
Posts: 3
Last visit: Fri Mar 08, 2013 5:19 pm

HelpProvider show HelpString on button press

Post by jpbruckler »

I have a button that would ideally display a help popup string when pressed. I seem to be missing just how I would go about doing that.

I've set the help string on the button, and it fires when the button has focus and a user presses F1. However, I'd like to have the popup text displayed when the button is pushed.

I've also tried setting HelpButton to true on the main form, but there doesn't appear to be a help button.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: HelpProvider show HelpString on button press

Post by jvierra »

Hi jp

Sorry but there is no such setting. The popup help text only shows due to hovering. You can use [msgbox] to display a message box in the buttons click event.
[msgbox]::Show('my message')
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: HelpProvider show HelpString on button press

Post by jvierra »

It just hit me that you might be asking how to use code to displaly a 'tooltip' which is what ew call the popup that appears when you hover a control.

Use the tooltip control.

$tooltip1.Show('some help message',$button1)
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: HelpProvider show HelpString on button press

Post by davidc »

The Form control has a property named HelpButton which will do what you ask. If you set HelpButton to True and hide the Maximize and Minimize buttons, you will get a question mark button on the top right of the window. When the user presses the question mark, it will change the cursor to a question mark and the user can click on the control to see the help message.

If you want the message to trigger on a hover, then I recommend the ToolTip control instead.

David
David
SAPIEN Technologies, Inc.
User avatar
jpbruckler
Posts: 3
Last visit: Fri Mar 08, 2013 5:19 pm

Re: HelpProvider show HelpString on button press

Post by jpbruckler »

David - that answers why I couldn't get the help button to display - thanks for that.

jvierra - guess that would explain why I couldn't find out how to do it :) The tooltip would accomplish exactly what I was trying to do.
This topic is 11 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked