TRzDBEdit TextHint

Components on the Raize Edits palette: edits, button edits, date-time edits, spin edits, color edits, memos, track bars, etc.

TRzDBEdit TextHint

Postby rhcarpenter » Tue Apr 17, 2012 11:19 am

I am having problems with the TextHint property when my program runs under XP. Works fine when running under W7.

When I open my form, the first TRzDBEdit control gets focus. On W7, the TextHint is visible. Works great. When I run the program under XP, the TextHint is not visible until/unless I exit the control without entring any data into the control. So, to re-state, the TextHint does not become visible until I exit the control without entering data.

Please help. This is a feature my customer really wants. And I can't tell him to install W7 on all his machines just to get this feature.
rhcarpenter
 
Posts: 22
Joined:
Thu Apr 14, 2011 12:49 pm

Re: TRzDBEdit TextHint

Postby rhcarpenter » Tue Apr 17, 2012 11:27 am

In my prior post I forgot to indicate which version I'm using. Sorry.

I am using version Raize Components v5.3 using Delphi 2010. Developing on a Windows 7 machine.
rhcarpenter
 
Posts: 22
Joined:
Thu Apr 14, 2011 12:49 pm

Re: TRzDBEdit TextHint

Postby Raize Support » Tue Apr 17, 2012 3:59 pm

Unfortunately, the TextHint functionality comes from the underlying Windows controls and was introduced in Windows Vista.

To do something like this for XP, you would have to custom code it. We can look at adding this functionality to the control but that would be a future release.

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 442
Joined:
Fri Mar 25, 2011 9:04 pm

Re: TRzDBEdit TextHint

Postby rhcarpenter » Wed Apr 18, 2012 7:40 pm

Ray,

I found a clunky way to add this functionality to XP. In a nutshell, what I did was overlay my TRzDBEdit control with a TRzEdit control.

I set the Visible property of my TRzEdit1 control to False. Then.....

In the OnEnter event of my TRzDbEdit1 control I set the following properties of the TRzEdit1:

Color, FocusColor, ReadOnlyColor to same colors of the TRZDBEdit1
Left to TRzDBEdit1.Left +4
Height to := TRzDBEdit1.Height - 4;
Top to TRzDBEdit1.Top + 2;
Width to TRzDBEdit1.Width - 6;
Visible to True if TRzDBEdit1.Text = ''

In the OnExit event of my TRzDbEdit1 control I set the following properties of the TRzEdit1:

if TRzDBEdit1.Text = '' then
TRzEdit1.Color := TRzDBEdit1.Color
else
TRzEdit1.Visible := False;

In the OnChange event of my TRzDbEdit1 control I set the following properties of the TRzEdit1:

if TRzDBEdit1.Text = '' then
TRzEdit1.Visible := True
else
TRzEdit1.Visible := False;

In the OnEnter event of my >> TRzEdit1 << control I set the following properties of the TRzEdit1:

TRzEdit1.Color := TRzDBEdit1.FocusColor;
TRzEdit1.FocusColor := TRzDBEdit1.FocusColor;
TRzEdit1.ReadOnlyColor := TRzEdit1.FocusColor;
ActiveControl := TRzDBEdit1;

This was necessary for those times when the user clicked on what appears to be the TRzDBEdit1 control (since TRzEdit1 is actually on top of TRzDBEdit1).


Also in the FormResize event I added the following (when the form is resized I resize the controls by a specific ratio).

TRzEdit1.Left := TRzDBEdit1.Left + 4;
TRzEdit1.Height := TRzDBEdit1.Height - 4;
TRzEdit1.Top := TRzDBEdit1.Top + 2;
TRzEdit1.Width := TRzDBEdit1.Width - 6;


I wanted to try to componetize this. I tried but I'm not a component writer. I created a new component based on your TRzDBedit component. I added a new property named EmbeddedHint. This property holds the hint to display. But I was not successful at completing the component. So I'll use my clunky solution for now. It works great on XP, Vista, and W7.

I'm sure you could develop an elegant solution in a single component. Maybe in a future release...
rhcarpenter
 
Posts: 22
Joined:
Thu Apr 14, 2011 12:49 pm

Re: TRzDBEdit TextHint

Postby Raize Support » Thu Apr 19, 2012 3:27 am

Thanks for posting your findings and solution.

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 442
Joined:
Fri Mar 25, 2011 9:04 pm


Return to Edits

Who is online

Users browsing this forum: No registered users and 1 guest