CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

CGJQEdit OnKeyPress

by loufeliz » 10 May 2013 06:41

Hello,

I would like to submit my form when user presses enter in a specific field. This should be the OnKeyPress event, but I need to only perform the action for the Enter Key. Can someone offer me a hint or an example.

Thank you.


- Lou
loufeliz
 
Posts: 61
Joined: 01 Dec 2012 04:39

by loufeliz » 10 May 2013 06:52

Never mind.... I did some googling and found sometime that helped...

I wound up doing this and it seems to work fine...so far.

if ( EventParams.Values['which'] = '13' ) then
begin
btnFindCJQButtonOptionsClick(Sender,EventParams);
end;
loufeliz
 
Posts: 61
Joined: 01 Dec 2012 04:39

by Jorge Sousa » 10 May 2013 09:48

Hi Lou

I would strongly advise you to use

JQEdit.JQEvents.OnKeyDown.Script:= 'e.which==13'

and

JQEdit.JQEvents.OnKeyDown.OnEvent

This way the server is called only when the user presses the return / enter key, and not on every keystroke, and this makes an huge difference in performance.

Regards

cgdevtools
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by loufeliz » 17 May 2013 03:27

Thanks for the tip.. I tried but it did not work. My first use of javascript in an IW app is a fail :(.... I will revisit this later.

- Lou
loufeliz
 
Posts: 61
Joined: 01 Dec 2012 04:39

by Jorge Sousa » 17 May 2013 09:46

Hi Lou

I'm really sorry is not .Script is .Condition

JQEdit.JQEvents.OnKeyDown.Condition:= 'e.which==13'

Best Regards

cgdevtools
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by O.Germeau » 16 Oct 2013 09:27

In JQEdit.JQEvents.OnKeyDown, how can retrieve the key value ?
In the Event Params, i have e=[object object]
O.Germeau
 
Posts: 50
Joined: 13 Sep 2013 12:32

by Jorge Sousa » 16 Oct 2013 14:25

Hi Germeau

Use BrowserParams - JQEdit.JQEvents.OnKeyDown.BrowserParams

Add any value for BrowserParams[i].ServerName, this is the name you'll get in the AParams parameter of the event handled

And set BrowserParams[i].BrowserScript:= 'e.which'

The best way to check what you can bring from browser, is debugging in browser (better setting ServerController.JavaScriptOptions.Debug = True)

More Info:

http://www.cgdevtools.com/cgforum/viewtopic.php?f=5&t=22

Best Regards
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by Alexander Bulei » 16 Oct 2013 16:46

Hello,

Check this topic: viewtopic.php?f=101&t=828

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by O.Germeau » 16 Oct 2013 18:06

Thanks, it's perfect
O.Germeau
 
Posts: 50
Joined: 13 Sep 2013 12:32

by O.Germeau » 17 Oct 2013 09:01

I have another question.
In my code, I use Events.OnKeyDown with multiple key.
For the F1 to F12 key, i want trap the keys with this event and disable F1 to F12 keys for the browser.
What is the best way for this ?
O.Germeau
 
Posts: 50
Joined: 13 Sep 2013 12:32

Next

Return to JQEdit

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.