![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 9 of 9 total |
![]() |
Tue, Feb 26 2013 6:14 PM | Permanent Link |
Alvaro | Hi all:
I have problems with FF, when I do a validation in a TEdit. When I want to validate with fc: TForm1.Edit1KeyPress (...) the "enter" key (# 13), not find a way to detect it. In IE9, Opera, Chrome and Safari, it works well. I found some forum-related issue, but with IE8, but can not find a solution to this problem. If it was clarified in the forum please suggest me how to find it. On the Internet, I read that some points about FF not tolerated in certain objects on the page, the "enter" key. In short: do not quite understand if the problem is FF, or am I doing something wrong. The routine is as follows: if (key = # 13) then begin Button1.SetFocus; result: = true; end; Works well with other keys. Thanks in advance. Alvaro |
Wed, Feb 27 2013 12:37 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Alvaro,
<< I found some forum-related issue, but with IE8, but can not find a solution to this problem. If it was clarified in the forum please suggest me how to find it. >> This may be a bug in the EWB framework. Try this in the WebCtrls unit of the framework: function TControl.KeyPressHandler(event: TKeyEvent): Boolean; var TempChar: Char; TempCode: Integer; begin { Prevents IE from firing a keypress event on an element that never got the keydown event to start with } if FKeyDown then begin if (not isNaN(event.charCode)) and (event.charCode <> 0) then // Modified line - added the charCode <> 0 test Does that fix the issue for you ? Thanks, Tim Young Elevate Software www.elevatesoft.com |
Wed, Feb 27 2013 2:12 PM | Permanent Link |
Alvaro | Tim:
The aggregate worked well. I tried it with IE9, FF, Safari, Chrome and Opera. In Opera, in TEdit, typing Enter, not give focus to Button1. Executes the procedure is written in the Button1 directly. It seems that "skip" a keystroke. (a Tedit Enter to exit and another to press the Button1.) Recently I test and verify more in detail at night. thanks Alvaro |
Wed, Feb 27 2013 4:18 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Alvaro,
<< The aggregate worked well. I tried it with IE9, FF, Safari, Chrome and Opera. In Opera, in TEdit, typing Enter, not give focus to Button1. >> Are you sure that Opera is getting the keystroke and that Button1.SetFocus is getting called ? Some of the browsers are nightmarish when it comes to focus handling, though, so it wouldn't surprise me that it wasn't working correctly. Thanks, Tim Young Elevate Software www.elevatesoft.com |
Wed, Feb 27 2013 6:30 PM | Permanent Link |
Alvaro | Hi Tim:
Confirmed. In Opera takes a single keystroke over TEdit and performs the procedure of TButton. In FF, the key validation put in fc: TForm1.Edit1KeyPress (...), now operates "more" strictly. Editing keys: backspace, arrow keys, Ins, Del, and Esc, are also filtered by the function TForm1.Edit1KeyPress (..) and if they are not defined as valid, the fc returns false. I copied the routine that validates: function TForm1.Edit1KeyPress(Sender: TObject; Key: Char; ShiftKey, CtrlKey, AltKey: Boolean): Boolean; begin if (key = #13) then begin Button1.SetFocus; // Opera does not work with Button1.SetFocus result:=true; Exit; end; if (Key<>chr(48)) and (Key<>chr(49)) and (Key<>chr(50)) and Key<>chr((51)) and (Key<>chr(52)) and (Key<>chr(53)) and (Key<>chr(54)) and (Key<>chr(55)) and (Key<>chr(56)) and (Key<>chr(57)) and (Key<>chr(45)) then ShowMessage('Tecla no válida.') // for validate date format (yyyy-mm-dd) else result:=true; end; // This would be no problem because I can add them to the list so that they are validated and consistent across all browsers. With Opera I'll try with other components to see how it works. That's all for now thanks Alvaro |
Thu, Feb 28 2013 12:31 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Alvaro,
<< In FF, the key validation put in fc: TForm1.Edit1KeyPress (...), now operates "more" strictly. Editing keys: backspace, arrow keys, Ins, Del, and Esc, are also filtered by the function TForm1.Edit1KeyPress (..) and if they are not defined as valid, the fc returns false. >> Okay, I'm going to have to revert that change back to the original - I can't have it breaking existing code. Have you tried just using the OnKeyDown/Up event handlers for dealing with non-printable keys ? It may be easier, and may get around some of the focus issues because browsers tend to auto-focus edit controls when keypress events occur, and this can screw things up if you want to move to the next control. Thanks, Tim Young Elevate Software www.elevatesoft.com |
Thu, Feb 28 2013 2:23 PM | Permanent Link |
Alvaro | Tim:
I add the control of the backspace key and it works perfect. The issue with the Opera browser, also is "fixable". While shooting the TButton procedure directly, the result is as expected. In this way (with the "added" in WebCtrls), works well with all browsers. I'll try OnKeyDown / Up event handlers and see how I handle it. Tell you later. Alvaro |
Thu, Feb 28 2013 2:52 PM | Permanent Link |
Alvaro | Tim:
In both situations, I think I'll stick with the modification of the framework. Having control of the enter key in FF without major drawbacks in the other browsers I think is better. Even considering that we have to type a bit more code to handle the event. It's a suggestion. Alvaro |
Tue, Mar 5 2013 12:26 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Alvaro,
<< I add the control of the backspace key and it works perfect. The issue with the Opera browser, also is "fixable". While shooting the TButton procedure directly, the result is as expected. In this way (with the "added" in WebCtrls), works well with all browsers. >> Thanks for the update. I'll have to do some more looking into this. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, August 14, 2024 at 07:31 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |