I've been doing some work lately in the newest version of SAPIEN's PrimalForms 2009. I like to make my scripts as user friendly as possible without forcing someone to read lengthy and boring documentation. One technique that I've started using is to use a ToolTip control and offer a short description or instruction when the mouse hovers over a control. Let me show you. This techinque should also work with the free PrimalForms Community Edition, although you'll need to take a few extra steps to add the necessary code.
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
I created a simple form with a few controls. I then grabbed the ToolTip control from the toolbox and dragged it on to the form. The ToolTip control isn't like other controls in that it doesn't have a user interface so PrimlForms will display it underneath the form in the design tab.
I select any control that I want to offer popup help, and in the property tab click the lightening bolt icon to switch to the Event view. In the Mouse section, find the MouseHover event and type in the name of the scriptblock that will display your help. My scriptblock is called ShowHelp.
I repeat for all the controls on my form. Now to create the scriptblock. I switch to the Script tab, or if using the Community Edition, export to a file and open in your script editor, and write a block of code like this:
$ShowHelp={
#display popup help
Switch ($this.name) {
"txtFoo" {$tip="Enter a foo value"}
"txtName" {$tip="Enter an item name"}
default {$tip="No help found for $($this.name)"}
}
$tooltip1.SetToolTip($this,$tip)
} #end ShowHelp
Here's what is going on. The special $this variable refers to the control that is tied to the fired event, such as $txtName, the name of one of my text box controls. The Name property will be the name that I entered in the Property panel for the control, ie, txtName. All I need is a simple Switch construct that evaluates the name of $this. For every control, I write a short bit of text that will be displayed as a tool tip using the ToolTip object's SetToolTip() method.
I've included a default message as well just in case I associate ShowHelp with a control and forget to define a tip. By the way, even if you have a lot of controls, defining the Switch statement isn't that tedious. I don't have to remember all the control names. All I need to do is start typing the name of an object, like $txtFoo, and PrimalForms will display a popup window and I can autocomplete. Remove the $ and add quotes and I'm done.
When I run the form, and hover the mouse over a control, I get a popup or tooltip message. When I move the mouse away, the tooltip disappears. Even if you leave the mouse alone, the tip disappears after 5 seconds, which should be long enough. If you're tip can't be read in 5 seconds, then it's probably too long for this technique and you'll need to find other mechanisms.
Let me know what you think and if you find this useful in your own PowerShell WinForm-based scripts.