1. buttons
- Posted by George Walters <gwalters at sc.rr.com> Aug 01, 2001
- 456 views
I have several buttons on panels like: leftButtonText = {"E&XIT","&NEXT","&PREV","&FIND","&ADD","&SETTAB"} and 'alt letter' like 'alt x' will activate the EXIT button's process. I would also like to just press the letter 'x' (upper or lower) and not have to press the alt as well. Is their a way to do this? ...george
2. Re: buttons
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 01, 2001
- 419 views
Here is some same code that might do what you need... ---------------- include win32lib_full.ew without warning integer win, ExitBtn, NextBtn, SB win = create(Window, "Test Btns", 0, 0, 0, 400, 300, 0) SB = create(StatusBar, "", win, 0, 0, 0, 0, 0) ExitBtn = create(Button, "E&XIT", win, 5, 10, 80, 30, 0) NextBtn = create(Button, "&NEXT", win, 5, 50, 80, 30, 0) procedure onClick_Exit() setText(SB, "Exit") end procedure procedure onClick_Next() setText(SB, "Next") end procedure onClick[ExitBtn] = routine_id("onClick_Exit") onClick[NextBtn] = routine_id("onClick_Next") procedure onKeyPress_Screen(integer keycode, integer shift) if find(keycode, "xX") then onClick_Exit() elsif find(keycode, "nN") then onClick_Next() end if end procedure onKeyPress[Screen] = routine_id("onKeyPress_Screen") WinMain(win, Normal) ---------------- ----- Original Message ----- From: "George Walters" <gwalters at sc.rr.com> To: "EUforum" <EUforum at topica.com> Sent: Thursday, August 02, 2001 1:03 AM Subject: buttons > > I have several buttons on panels like: > > leftButtonText = {"E&XIT","&NEXT","&PREV","&FIND","&ADD","&SETTAB"} > > and 'alt letter' like 'alt x' will activate the EXIT button's process. I > would also like to just press the letter 'x' (upper or lower) and not have > to press the alt as well. Is their a way to do this? > > ...george >
3. Re: buttons
- Posted by George Walters <gwalters at sc.rr.com> Aug 01, 2001
- 429 views
thanks Derick, I'll try it.... ..george ----- Original Message ----- From: "Derek Parnell" <ddparnell at bigpond.com> To: "EUforum" <EUforum at topica.com> Subject: Re: buttons > > Here is some same code that might do what you need... > ---------------- > include win32lib_full.ew > without warning > > integer win, ExitBtn, NextBtn, SB > > win = create(Window, "Test Btns", 0, 0, 0, 400, 300, 0) > SB = create(StatusBar, "", win, 0, 0, 0, 0, 0) > ExitBtn = create(Button, "E&XIT", win, 5, 10, 80, 30, 0) > NextBtn = create(Button, "&NEXT", win, 5, 50, 80, 30, 0) > > procedure onClick_Exit() > setText(SB, "Exit") > end procedure > > procedure onClick_Next() > setText(SB, "Next") > end procedure > > onClick[ExitBtn] = routine_id("onClick_Exit") > onClick[NextBtn] = routine_id("onClick_Next") > > procedure onKeyPress_Screen(integer keycode, integer shift) > if find(keycode, "xX") then > onClick_Exit() > elsif find(keycode, "nN") then > onClick_Next() > > end if > end procedure > onKeyPress[Screen] = routine_id("onKeyPress_Screen") > > WinMain(win, Normal) > ---------------- > > ----- Original Message ----- > From: "George Walters" <gwalters at sc.rr.com> > To: "EUforum" <EUforum at topica.com> > Sent: Thursday, August 02, 2001 1:03 AM > Subject: buttons > > > > > > I have several buttons on panels like: > > > > leftButtonText = {"E&XIT","&NEXT","&PREV","&FIND","&ADD","&SETTAB"} > > > > and 'alt letter' like 'alt x' will activate the EXIT button's process. I > > would also like to just press the letter 'x' (upper or lower) and not have > > to press the alt as well. Is their a way to do this? > > > > ...george > > > > > > >
4. Re: buttons
- Posted by Irv Mullins <irvm at ellijay.com> Aug 01, 2001
- 418 views
On Wednesday 01 August 2001 11:03, George Walters wrote: > > I have several buttons on panels like: > > leftButtonText = {"E&XIT","&NEXT","&PREV","&FIND","&ADD","&SETTAB"} > > and 'alt letter' like 'alt x' will activate the EXIT button's process. I > would also like to just press the letter 'x' (upper or lower) and not have > to press the alt as well. Is their a way to do this? I was wondering when you were going to ask ;) You can set a key trap on a control using the onKeyPress event. For example, my main window has a row of buttons like the above. So, my code to trap key presses while the main window has the focus is: procedure MainWindow_onKeyPress ( int keyCode, int shift ) KeyDispatch(keyCode) end procedure onKeyPress[MainWindow] = routine_id("MainWindow_onKeyPress") Now, whenever a key is pressed, the keycode is sent to a routine I named KeyDispatch(), which looks like: -------------------------------- procedure KeyDispatch(object k) -- responds to keys C, D, T or X -------------------------------- k = upper(k) if k = 'C' then ReadCustomerFile() CurrentFoundSet = Customers openWindow(CustomerWindow,Normal) elsif k = 'D' then ReadDriverFile() openWindow(DriverWindow,Normal) elsif k = 'T' then ReadTicketFile() CurrentTicketSet = Tickets openWindow(TicketWindow,Normal) elsif k = 'X' then if message_box("Are you sure?","Exit this program", MB_ICONSTOP+MB_YESNO)= IDYES then closeWindow(MainWindow) end if end if end procedure Regards, Irv