Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying Editbox 1

Status
Not open for further replies.

yomyom

Programmer
Dec 23, 2002
119
GB
I would like the textr in my edit box to be right justified.
I would also like to be able to enter floating point values
in a manner similar to specifying a picture in clipper e.g
',999,999.99'.
I attempted maskedit but could not make head or tail of the masks.
I'm also not strong enough to mess with creating a new component based on tedit that would behave how I want.
So I turn to you - All that know better - to please help.
Please, if you want 2 suggest creating a component, then please give me the step by step. I never seem to get it to work.
yom yom.
 
hi TonHu,
I did what you said (torre.net) and I found a piece of code that can be adapted to my purpose. The code makes the enter key behave like a tab key. This gives the type of data entry capability that a user would understand.
The code is as follows:
procedure TForm1.FormKeyPress(Sender: TObject; var Key: char);
begin
if Key = #13 Then
begin
Key := #0;
//check if shift key is pressed
if GetKeyState(VK_Shift) and $8000 <> 0 then
PostMessage(Handle, WM_NEXTDLGCTL,1,0)
else
PostMessage(Handle, WM_NEXTDLGCTL,0,0);
end;
end;
The above code assumes that the form's key preview is on.
To adapt it to a right justified edit box, I used a Tmemo and sized it to show only one line of text. I set it to right justified and set its keypressed event to the above code. Now when you enter a line of text and press enter, the focus moves to the next control on the form.
yomyom.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top