Subject Re: Shortcut for a Pushbutton
From Mervyn Bick <invalid@invalid.invalid>
Date Fri, 14 Aug 2020 16:02:30 +0200
Newsgroups dbase.getting-started
Attachment(s) test_accelerator.wfm

On 2020-08-14 15:22, Mustansir Ghor wrote:
> Dear All
>
> we can put & before a character in a text of pushbutton to make it shorcut accessible.  When I run the form and selecting the ALt key + character that I specified, the onclick event does not get triggered.
>
> I am missing out something.
>
> Regards
> Mustansir
>

It works for me with dBASE 2019.  A little example is attached.

Make sure the speedBar property of your pushbutton is not set to true as
this will prevent the Alt key accelerator from working.

Mervyn.




** END HEADER -- do not remove this line
//
// Generated on 2020-08-14
//
parameter bModal
local f
f = new test_acceleratorForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class test_acceleratorForm of FORM
   with (this)
      height = 16.0
      left = 51.0
      top = 3.1364
      width = 40.0
      text = ""
   endwith

   this.PUSHBUTTON1 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON1)
      onClick = class::PUSHBUTTON1_ONCLICK
      height = 1.0909
      left = 13.5714
      top = 5.1818
      width = 15.2857
      text = "Push&button1"
   endwith


   function PUSHBUTTON1_onClick()
      msgbox('Pushbutton clicked','',64)
      return

endclass