View Full Version : addkeylistener problem

11 Dec 2007, 2:23 PM
i have built a dialog box and added the following buttons:

dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton('Cancel', dialog.hide, dialog);
dialog.addButton('Select', selQuote, dialog);
dialog.setDefaultButton(dialog.addButton('Search', SearchQuote, dialog));
dialog.addKeyListener(13, SearchQuote, dialog);

i have 2 problems:

1) i want that when the user press "Enter/CR" search operation will happen.
it calls the search routine but also closes the dialog, which i don't want to happen

2) in the selQuote i also added a line of "dialog.hide" and still after it enters the routine it doesn't close the dialog.

how can i make it behave well

11 Dec 2007, 2:44 PM
RE 2:
dialog.hide(); // don't forget the ()

12 Dec 2007, 3:27 PM