 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Leo Saguisag (Borland) Guest
|
Posted: Tue Aug 05, 2003 3:45 pm Post subject: Re: How do I change the Decimal Separator in the numeric pad |
|
|
| Quote: | But what I really want is that when a user presses the "." in the Numeric
Key Pad, it shows a "," in the screen, as Excel does.
In Excel, when I press the "." in the Numeric Key Pad, it shows in the
screen the Decimal Separator that I had choosen in the Control Panel
Regional Settings. But in our application it shows always the "."
character
nevertheless the regional settings are.
|
Hmmm... I can't think of a way you can modify this in the OS so you would
probably have to write a custom keyboard handler for your application then.
What you'd want the keyboard handler to do is read the system regional
settings (specifically, the decimal separator) and then catch the "." in the
numeric key pad and replace the character with the decimal separator from
the regional settings.
Try looking at the "DemosToolsApiEditor Keybinding" demo in Delphi to see
how you can trap keystrokes.
HTH.
|
|
| Back to top |
|
 |
Leo Saguisag (Borland) Guest
|
Posted: Tue Aug 05, 2003 11:54 pm Post subject: Re: How do I change the Decimal Separator in the numeric pad |
|
|
| Quote: | But what I really want is that when a user presses the "." in the Numeric
Key Pad, it shows a "," in the screen, as Excel does.
In Excel, when I press the "." in the Numeric Key Pad, it shows in the
screen the Decimal Separator that I had choosen in the Control Panel
Regional Settings. But in our application it shows always the "."
character
nevertheless the regional settings are.
|
I found this as I was poking around the MS Global Dev site earlier:
http://www.eu.microsoft.com/globaldev/tools/msklc.mspx
It's a Keyboard Layout Creator. I haven't tried using this myself but you
may want to try this and see if it is of any use to you.
HTH.
-- Leo
|
|
| Back to top |
|
 |
Alexandre Duran Mertens - Guest
|
Posted: Wed Aug 06, 2003 8:54 am Post subject: Re: How do I change the Decimal Separator in the numeric pad |
|
|
Create a TApplicationEvents on your main form.
Add this code to the OnMessage event for the TApplicationEvents.
procedure TVMG.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
var
CodigoBarrido: DWord;
TeclaVirtual: UInt;
begin
if ((Msg.message = wm_keydown) or (Msg.message = wm_keyup)) and
(Msg.wParam = VK_DECIMAL)
then begin
CodigoBarrido := OemKeyScan(ord(','));
TeclaVirtual := MapVirtualKey( CodigoBarrido, 1);
Msg.wParam := TeclaVirtual; //188
Msg.lParam := Msg.lParam and $FF00FFFF or (CodigoBarrido shl 16);
//51
Handled := false;
end
end;
|
|
| Back to top |
|
 |
Igor Siticov Guest
|
Posted: Wed Aug 06, 2003 12:55 pm Post subject: Re: How do I change the Decimal Separator in the numeric pad |
|
|
Hi,
You can try the following code:
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage := AppMessage;
end;
procedure TForm1.AppMessage(var Msg: TMsg; var Handled: Boolean);
begin
inherited;
if (Msg.message = WM_KEYDOWN) and (ActiveControl = Edit1) then
case Msg.WParam of
VK_DECIMAL:
begin // DECIMAL KEY pressed
SendMessage(Edit1.Handle, WM_CHAR, Ord(DecimalSeparator), 0);
Handled := True;
end;
end;
end;
--
Best regards
Igor Siticov
SiComponents home page: http://www.sicomponents.com
"Oswaldo Hitti" <OswHitti (AT) Hotmail (DOT) com> wrote
| Quote: | Hi,
In our application, the Decimal Separator is ",".
How do I change the "." of the Numeric Key Pad to "," for more confort of
the users?
Thanks in advance,
Oswaldo Hitti.
|
|
|
| Back to top |
|
 |
Oswaldo Hitti Guest
|
Posted: Thu Aug 07, 2003 11:56 am Post subject: Re: How do I change the Decimal Separator in the numeric pad |
|
|
Thanks for responding my message,
I solved the problem with your ideas,
Thanks again,
Oswaldo Hitti.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|