Topic: Capitalizing First Letter of Words in a Text Field

Is there a function or anyway to capitalize the first letter of each word in a text field? ie names and addresses.

Re: Capitalizing First Letter of Words in a Text Field

Hello EHWagner,
Something like this might do the trick for you -
procedure Form1_Edit1_OnExit (Sender: string);
begin
   form1.edit1.text := namecase(form1.edit1.text);
end;
Derek.

Re: Capitalizing First Letter of Words in a Text Field

Hello Dmitry,
Could NameCase be added as a new option to the CHARCASE object property for text fields (in addition to ecLowerCase, ecNormal and ecUpperCase) instead of having to do it by script?
Thanks,
Derek.

Re: Capitalizing First Letter of Words in a Text Field

Hello Derek and Dmitry

NameCase works fine with event Form1.Button1.OnExit (so does it also with Form1.Button1.Click);

But curiously, when placed behind events OnChange or OnKeyPress, text enterd in EditBox is inverted
(Hello World becomes Dlrow Olleh)

Any explanation about this anomaly ?

JB

Re: Capitalizing First Letter of Words in a Text Field

Perfect. Thank you Derek. Yes it definitely needs to be added as a property.