Beep on ALT-key

Beep on ALT-key

Postby Enrico Maria Giordano » Sun Oct 18, 2020 5:17 pm

I'm trying to trap ALT-key. It works, but I hear a sound. How can I avoid it?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Beep on ALT-key

Postby karinha » Mon Oct 19, 2020 12:34 am

For Example?

Regards.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7804
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Beep on ALT-key

Postby Enrico Maria Giordano » Mon Oct 19, 2020 7:23 am

Just press ALT-letter on any dialog.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Beep on ALT-key

Postby karinha » Mon Oct 19, 2020 12:56 pm

Button, Listbox, combo, Where? Do you have a test code?

Regards.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7804
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Beep on ALT-key

Postby karinha » Mon Oct 19, 2020 1:08 pm

Normal.

Master, see if you haven't connected anything in the windows settings.

Code: Select all  Expand view

// Testing NON-Modal Dialog Boxes - \SAMPLES\TESTDLGN.PRG

#include "fivewin.ch"

Static MainWnd

Function Main()

   DEFINE WINDOW MainWnd FROM 1, 1 TO 22, 75 ;
      TITLE "Test" ;
      MENU BuildMenu() ;
      COLOR "W/B"
     
   ACTIVATE WINDOW MainWnd MAXIMIZED ;
      VALID MsgYesNo( "Want to end ?" )
   
Return NIL

Function BuildMenu()

   local oMenu

   MENU oMenu
      MENUITEM OemToAnsi( "&Try" ) ACTION Try( )

      MENUITEM "E&xit" ACTION MainWnd:End()
   ENDMENU
   
Return oMenu

Function Try()

   Local oDlg

   DEFINE DIALOG oDlg TITLE "Non modal dialog"
   
   @ 2, 2 BUTTON "&End" OF oDlg ACTION oDlg:End( )
   
   /*
   ACTIVATE DIALOG oDlg CENTERED NOWAIT ;
      VALID MsgYesNo( "Want to close it ?" )
   */


   ACTIVATE DIALOG oDlg CENTERED

Return NIL
 


Regards.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7804
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Beep on ALT-key

Postby Enrico Maria Giordano » Mon Oct 19, 2020 1:18 pm

Yes, as I want to handle the ALT-key combination through bKeyDown not with a menu item.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Beep on ALT-key

Postby karinha » Mon Oct 19, 2020 2:03 pm

Master:

En wBrowse.prg o Dialog.prg haga esto:

In wBrowse.prg or Dialog.prg...

Code: Select all  Expand view


   DATA   bAltKey

    // Para Acionamento da Tecla Alt+++...
    METHOD SysCommand( nType, nLoWord, nHiWord )

en:

METHOD Syscommand( nType, nLowOrd, nHiWord ) Class TWBrowse  //Era TcBrowse

    Local oFolder, nItem, nButton
    Local hCtrl

    DO CASE

    Case nType == SC_KEYMENU   // Alt+...

       If ::bAltKey != Nil
          Eval( ::bAltKey, nLoWord )
       Endif

    ENDCASE

Return Super:SysCommand( nType, nLoWord, nHiWord )


    // En el modulo:

    // Para Acionar a Tecla ALT, Dentro da ListBox(wBrowse.Prg)
    oLbx:bAltKey  := { | nKey, nFlags | TESTE_KEY( nKey, aGetVenda,  oLbx,   ;
                                                     oDlgVendas, DbClientes, ;
                                                     DbEstoque,  DbPedidos,  ;
                                                     DbFornece, oSaida ) }


// Para Usar Tecla ALT+Letra
STATIC FUNCTION Teste_Key( nKey, aGetVenda,  oLbx, oDlgVendas, DbClientes, ;
                                 DbEstoque,  DbPedidos,  DbFornece, oSaida )

   LOCAL cKey := CHR( nKey )
   LOCAL X, oCtrl, oMeter, oText, lEnd, DeOndeVem, DbSangria

   MEMVAR nValorCompra, aSaysMoveis, nTelefone, cNomeClien, nCodigoProd
   MEMVAR NNUMEROTEL

   IF GetKeyState( VK_CONTROL ) .AND. ;
      GetKeyState( VK_SHIFT )

      //MsgInfo( " CONTROL + SHIFT + " + cKey )

   ELSEIF GetKeyState( VK_CONTROL )

      //MsgInfo( " ALT + CONTROL + " + cKey )

   ELSEIF GetKeyState( VK_SHIFT )

      //MsgInfo( " ALT + SHIFT + " + cKey )

   ELSEIF GetKeyState( VK_MENU )                    // alt key

      //MsgInfo( " ALT + " + cKey + " ACIONADA " )

   ENDIF

   cKey := Upper( cKey )

   IF  cKey == "I"            // Alt+I

      // MsgInfo( " INCLUIR" )

   ELSEIF cKey == "A"    // Alt+A

      // MsgInfo( " ALTERAR" )

   ELSEIF cKey == "C"    // Alt+C

      // Se a ListBox dos Produtos Tiver Ötens...
      SELECT ( DbPedidos:cAlias )
      GO TOP

      IF EOF()

         lLigaCliente := .T.  //-> Liga o Get dos Clientes

         aSaysMoveis[1]:Show()

         aGetVenda[1]:Show()
         aGetVenda[2]:Show()

         XFOCUS( aGetVenda[3] )

         RETURN( .T. )
      ELSE

         nCodigoProd  := SPACE( 13 )

         aGetVenda[3]:VarPut( nCodigoProd )
         aGetVenda[3]:Refresh()

         XFOCUS( aGetVenda[3] )

         RETURN( .F. )
      ENDIF

   ELSEIF cKey == "E"    // Alt+E

      //MsgInfo( " EXCLUIR" )

   ELSEIF cKey == "F"    // Alt+F FORNECEDORES

      // Se a ListBox dos Produtos Tiver Ötens...
      SELECT ( DbPedidos:cAlias )
      GO TOP

      IF EOF()

         lLigaCliente := .T.  //-> Liga o Get dos Clientes

         aSaysMoveis[1]:Show()

         aGetVenda[1]:Show()
         aGetVenda[2]:Show()

         XFOCUS( aGetVenda[3] )

         RETURN( .T. )

      ELSE

         nCodigoProd  := SPACE( 13 )

         aGetVenda[3]:VarPut( nCodigoProd )
         aGetVenda[3]:Refresh()

         XFOCUS( aGetVenda[3] )

         RETURN( .F. )

      ENDIF

   ELSEIF cKey == "P"    // Alt+P

      IF lPesqFone .AND. nValorCompra <= 0

         //MsgInfo( " ULTIMOS PEDIDOS DO CLIENTE" )
         ULTIMOS_PEDIDOS( nKey, aGetVenda,  oLbx, oDlgVendas, DbClientes, ;
                                DbEstoque,  DbPedidos, oSaida )
      ELSE

         RETURN( .F. )

      ENDIF

   ELSEIF cKey == "R"    // Alt+R

      //MsgInfo( OemToAnsi( " RELATàRIOS" ) )

      //-> Reservada Para a VALOR NO CAIXA DO DIA -> VALORNCX.PRG
   ELSEIF cKey == "V"  //-> ALT+V

      IF NVALORCOMPRA <= 0

         VALORNCX( DbPedidos, DbSangria, oLbx, DeOndeVem := 1,             ;
            oMeter, oText, lEnd )

      ELSE

         // mensa

      ENDIF

      SELECT ( DbPedidos:cAlias )
      DbPedidos:SetOrder( 1 )
      GO TOP

      //-> Codigo do Produto
      nCodigoProd  := SPACE( 13 )
      aGetVenda[3]:VarPut( nCodigoProd )
      aGetVenda[3]:Refresh()
      XFOCUS( aGetVenda[3] )

      //-> Reservada Para a Calculadora - At+X na ListBox dos Produtos
   ELSEIF cKey == "X"  //-> Chamar a Calculadora

      CALCULAD( 0, X, oCtrl )

   ENDIF

RETURN( nKey )
 


Regards,
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7804
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Beep on ALT-key

Postby Enrico Maria Giordano » Mon Oct 19, 2020 2:09 pm

Thank you, but I don't want to change FWH sources.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Beep on ALT-key

Postby karinha » Mon Oct 19, 2020 2:18 pm

ok. ahora, és con el maestro Cristóbal. Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7804
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Beep on ALT-key

Postby cnavarro » Mon Oct 19, 2020 2:23 pm

Enrico, I believe that this characteristic is changed in the configuration of the Operating System.
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Beep on ALT-key

Postby Enrico Maria Giordano » Mon Oct 19, 2020 2:47 pm

So, it cannot be disabled programmatically?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Beep on ALT-key

Postby Otto » Mon Oct 19, 2020 4:59 pm

Enrico, I will remember that we changed for a similar case
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TControl
case nMsg == WM_SYSCOMMAND
return ::SysCommand( nWParam, nLoWord( nLParam ), nHiWord( nLParam ) )
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6322
Joined: Fri Oct 07, 2005 7:07 pm

Re: Beep on ALT-key

Postby Enrico Maria Giordano » Mon Oct 19, 2020 5:17 pm

I don't want to alter the FWH source code. Anyway, I tried with OVERRIDE command and it didn't work (the program didn't start).

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Beep on ALT-key

Postby James Bott » Tue Oct 20, 2020 4:08 pm

Enrico,

You don't have to modify the source, you can subclass instead.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Beep on ALT-key

Postby Enrico Maria Giordano » Tue Oct 20, 2020 4:52 pm

Subclass TControl? Don't think that class is thought for subclassing.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 23 guests