Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to automatically capitalize the first letter of every word when typing in th Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
05-Nov-02
Category
VCL-General
Language
Delphi All Versions
Views
38
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How to automatically capitalize the first letter of every word when typing in the 
field of a TStringGrid

Answer:

Solve 1:
1   
2   procedure TForm1.StringGrid1KeyPress(Sender: TObject; var Key: Char);
3   var
4     s: string;
5     c: Byte;
6   begin
7     with StringGrid1 do
8       s := Cells[Col, Row];
9     if Length(s) = 0 then
10    begin
11      if Key in ['a'..'z'] then
12      begin
13        c := Ord(Key) - 32;
14        Key := Chr(c);
15      end;
16      exit;
17    end;
18    if s[Length(s)] = ' ' then
19      if Key in ['a'..'z'] then
20      begin
21        c := Ord(Key) - 32;
22        Key := Chr(c);
23      end;
24  end;



Answer 2:

In an onKeyPress event, do this:

25  if length(field.text) = 0 then
26    key := upCase(key);


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC