Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

F4 key to open upa listbox

Status
Not open for further replies.

maxpower1

Programmer
Jul 29, 2001
488
US
good afternoon,

when a listbox has a focus and you press F4, the listbox will pop up open automatically. How can I simulate this. In short, instead of using F4, I want to use F1 to open up a box. I understand that you need to cancel out the predefined event by the document object --> document.onHelp. I manage to "silence" this action already by adding return false to the event.keycode event so that when a user presses F1, help window won't come up.

Again, how can I use F1 to "simulate" the F4 key.

thanks
 
max,

I'm not saying there aren't some ways you might be able to get this thing working (though I have been programming in JS for 8+ years and never found a reason to figure out if it was possible) but what I will say is this :

Javascript is a language that was created to provide added functionalities to a web site or web application. When designing an interface on the web you have to realize that the browser is the container and what it does should not be touched unless you have a very good reason for it.

For example some people remove the right-click from fear that people will steal their precious code or images. This in essence is ludicrous, if the person can see it on their browser it means it is already downloaded to their computer - gaining access to files on your computer is just a few click away. What makes it even more ludicrous is that right click provides easy way to bookmark a page, print it and send the link to the page by email. Removing the right click feature throws people off and annoys people without adding any benefit to the end user.

I'm warning you that the F4 option is something that a few people might use. In some browsers F4 does certain things differently. In some browsers the F4 key is configurable by the user. These function keys were not meant to be used by Javascript programmers, but by applications such as browsers and office applications.

Before you start a journey to do something that is not an easy technical task and probably would only work in very specific enviroments (kiosk mode IE, Mozilla XUL App), maybe your first concern should be on making your application work, then put efforts to make it more usable without doing anything that can throw people off.

I hope my insight helps you out in some constructive way. Gary Haran
 
thanks for the reply. This is for an intranet application. The users have been using F1 to show the values in the listbox for the last 10 years. Hence, I cannot just change it to F4. I am so close right now to getting this to work at the document level except "simulating" the open listbox function.

End of journey is near. Thanks for the opinion. I appreciate it :)
 
Instead of using a listbox, could you put the contents inside a layer (<div>) tag? You could use css to simulate the appearance of a regular listbox, and use the visibility style to show/hide the contents on the press of a key. You might even be able to find some fancy script that moves the div and simulates the sliding of a listbox?
 
this is my response from other questions. Using Function keys I just pop up a window with selections. Once they hit Return, I return the value back to the parent window. xutopia is right; it's not easy to do this in a browser. I however found a way to overwrite function keys, i.e. F1, and customize them accordingly to make them work with my industrial app.

--------------------------------------
I found it
for those who wonder:-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top