Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently September 28th, 2024, 1:11 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: "Enter" key is pressed
PostPosted: May 28th, 2005, 2:47 am 
Offline

Joined: May 23rd, 2005, 1:22 pm
Posts: 10
I am creating a browser such that when the enter key is pressed while the url address text area is in focus.

typeArea.RegisterEventHandler("keydown",this.typeArea_KeyDown)
function typeArea_KeyDown(property){
if(property.key=="Enter")
myBrowser.Navigate("http://www.google.com.sg")
}


Qn: I just want this keydown event to be activated when typeArea object (text object) is in focus, and enter key is down. However, the above event is always triggered when the focus is on other place(not typeArea object), which is not what I want

Qn: What is the difference between keydown and keypress. Help file say
keydown a key was pressed down.
keyup a key was released.
keypress a key was pressed generating a character
But I still dont get it.

Qn:When the user press any key and hold it there, I want the keydown event to be generated only once. I try using autorepeat, but doesnt seem to work

Any one can help me? Thanks.


For this message hanct2002 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: May 30th, 2005, 2:21 pm 
Offline

Joined: May 23rd, 2005, 1:22 pm
Posts: 10
anyone can answer my questions? Or am I asking a very stupid questions:(


For this message hanct2002 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Possible Solution?
PostPosted: May 31st, 2005, 7:46 pm 
Offline

Joined: November 3rd, 2004, 2:11 pm
Posts: 323
Maybe I am misunderstanding something but couldn't you just put a keypress trigger on your textbox? I tried it out and it seemed to work like you wished. The way I tried it was I set up two textboxes with one to receive focus after six seconds. While the first textbox had focus and I pushed Enter, the browser went to a specific site. Once the focus was off that textbox, pushing Enter had no effect.

I am hoping I did not misunderstand you. I think a lot of times in Opus, keeping it simpler (actions not scripting) is the better way to go unless you know your way around scripting. I always try actions first and then scripting second.

Hope this helps.


For this message bwpatric has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: June 1st, 2005, 2:14 pm 
Offline

Joined: May 23rd, 2005, 1:22 pm
Posts: 10
Thank you very very much! I finally have a reply...keke

I agree to what u say. However, because I am a programmer, and will always prefer to use the scripting method to do. Thats y. I know that by using the action method, its very easy. But however, I prefer programming instead...Hehe...

Anyway...still hope someone can answer my questions....


For this message hanct2002 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: June 1st, 2005, 2:34 pm 
Offline
User avatar

Joined: October 25th, 2004, 10:33 am
Posts: 257
Location: UK
Opus: Pro 8
OS: Windows 7 Professional x64
System: Dell XPS15 i7x4 2.1Ghz 6GB 128GB SSD
Just use a trigger with a script action to call your function. Either that or you'll need to do something clever to keep track of what has the focus.

Keypress is different because of the repeat. If you hold down a key, you'll only get one keydown (and one key up when you release it), but you will get lots of keypress triggers.


For this message Dave Emberton has been thanked by : mackavi


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group