Re: Showing hints on disabled dbeditboxes
Posted by webmaster Guido on September 09, 2002 at 20:22:03:
In Reply to: Showing hints on disabled dbeditboxes posted by Keith on September 06, 2002 at 14:48:06:
: How can I show hints on dbeditboxes when they are disabled but visible (for data display purposes)? There are quite a few of them. Thanks.
If you move the cursor over a "control" (visible component), its hint is not shown if that control's "Enabled" property is set to "False". And you can't solve the problem by looking at its OnMouseMove event for showing hint-info, because that event will not fire if the component is disabled.
This won't help you much if you want components that at all times show a hint when the cursor is over them, but sometimes you need them for data input, while at another time you just want to show the data (and the user is not allowed to change the data). Almost everything is possible in Delphi ;-) so...
...in that case, use TEdits for data entry, and use the same number of TStaticLabels to show the data. The TStaticLabels should have the same contents, location, and hints. Initially, the TStaticLabels are invisible (Visible := False). Next, instead of simply disabling the TEdits, hide them (Visible := False) and show the TStaticLabels. Afterwards, when necessary hide the TStaticLabels again and show the TEdits.
Tip: it saves a lot in programming code if you put all of the TEdits on a panel and
the TStaticLabels on another panel, both with the same dimensions and location. Now alternately
show one panel and hide the other one (Panel1.Visible := True /False).