Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #12503 > unrolled thread

Hotkey Button

Started byFrank M <frank_muessner@gmx.de>
First post2019-06-06 01:15 -0700
Last post2019-06-11 00:29 -0700
Articles 9 — 4 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Hotkey Button Frank M <frank_muessner@gmx.de> - 2019-06-06 01:15 -0700
    Re: Hotkey Button "Jamal" <nospam@example.com> - 2019-06-07 17:00 -0400
      Re: Hotkey Button "Jamal" <nospam@example.com> - 2019-06-07 17:13 -0400
    Re: Hotkey Button Frank M <frank_muessner@gmx.de> - 2019-06-08 08:25 -0700
      Re: Hotkey Button "Jamal" <nospam@example.com> - 2019-06-09 03:46 -0400
        Re: Hotkey Button Franz Rachbauer <office@rachbauer.org> - 2019-06-11 14:01 +0200
          Re: Hotkey Button "Jamal" <noooospam@example.com> - 2019-06-11 17:08 -0400
          Re: Hotkey Button "Jamal" <noooospam@example.com> - 2019-06-11 22:16 -0400
    Re: Hotkey Button Frank M <frank_muessner@gmx.de> - 2019-06-11 00:29 -0700

#12503 — Hotkey Button

FromFrank M <frank_muessner@gmx.de>
Date2019-06-06 01:15 -0700
SubjectHotkey Button
Message-ID<f90474eb-9600-4e16-9c91-48d104b88a3a@googlegroups.com>
Hello, 
i have noticed that when have a Button with Hotkey (in this sample ALT+P)

HyperLabel{#PushButton1,_chr(38)+"Push",NULL_STRING,NULL_STRING}

i have only to add Cation from Button '&Push' 

That work when click ALT+P 

But that work with only Clicking P , too ? 

I this a normal behavior? I want that only the Hotkey work with ALT+Key,  not that only click Key (P) without ALT work. 

VO2.8 2838

Regards, Frank  


[toc] | [next] | [standalone]


#12509

From"Jamal" <nospam@example.com>
Date2019-06-07 17:00 -0400
Message-ID<qdej91$n0k$1@gioia.aioe.org>
In reply to#12503
Hi Frank,

I tested it and it seems weird! I suggest using create a menu then add a 
menu item with an accelerator key combination.

Jamal

"Frank M"  wrote in message 
news:f90474eb-9600-4e16-9c91-48d104b88a3a@googlegroups.com...

Hello,
i have noticed that when have a Button with Hotkey (in this sample ALT+P)

HyperLabel{#PushButton1,_chr(38)+"Push",NULL_STRING,NULL_STRING}

i have only to add Cation from Button '&Push'

That work when click ALT+P

But that work with only Clicking P , too ?

I this a normal behavior? I want that only the Hotkey work with ALT+Key, 
not that only click Key (P) without ALT work.

VO2.8 2838

Regards, Frank

[toc] | [prev] | [next] | [standalone]


#12510

From"Jamal" <nospam@example.com>
Date2019-06-07 17:13 -0400
Message-ID<qdek1j$qdo$1@gioia.aioe.org>
In reply to#12509
It's been a long day! I should have said:

I tested it and it seems weird! I suggest you create a menu then add a
menu item with an accelerator key combination.

Of course, can go the hard route and create a Dispatch method for the owner 
window and handle the keys, but I think the "accelerator" option is easier!

Jamal

"Jamal"  wrote in message news:qdej91$n0k$1@gioia.aioe.org...

Hi Frank,

I tested it and it seems weird! I suggest using create a menu then add a
menu item with an accelerator key combination.

Jamal

"Frank M"  wrote in message
news:f90474eb-9600-4e16-9c91-48d104b88a3a@googlegroups.com...

Hello,
i have noticed that when have a Button with Hotkey (in this sample ALT+P)

HyperLabel{#PushButton1,_chr(38)+"Push",NULL_STRING,NULL_STRING}

i have only to add Cation from Button '&Push'

That work when click ALT+P

But that work with only Clicking P , too ?

I this a normal behavior? I want that only the Hotkey work with ALT+Key,
not that only click Key (P) without ALT work.

VO2.8 2838

Regards, Frank

[toc] | [prev] | [next] | [standalone]


#12511

FromFrank M <frank_muessner@gmx.de>
Date2019-06-08 08:25 -0700
Message-ID<cb76027a-d091-4c76-9261-8e844524aa11@googlegroups.com>
In reply to#12503
Am Donnerstag, 6. Juni 2019 10:15:23 UTC+2 schrieb Frank M:
> Hello, 
> i have noticed that when have a Button with Hotkey (in this sample ALT+P)
> 
> HyperLabel{#PushButton1,_chr(38)+"Push",NULL_STRING,NULL_STRING}
> 
> i have only to add Cation from Button '&Push' 
> 
> That work when click ALT+P 
> 
> But that work with only Clicking P , too ? 
> 
> I this a normal behavior? I want that only the Hotkey work with ALT+Key,  not that only click Key (P) without ALT work. 
> 
> VO2.8 2838
> 
> Regards, Frank


Hi Jamal,
thank you for testing. 

It is a lot of work to provide all windows with a menu. Does everyone have the same behavior that is performed on the single key function? There must be a solution for it :-(

[toc] | [prev] | [next] | [standalone]


#12512

From"Jamal" <nospam@example.com>
Date2019-06-09 03:46 -0400
Message-ID<qdidh2$1dha$1@gioia.aioe.org>
In reply to#12511
As I said in my previous message, you can also use the dispatch() option and 
handle the Alt key and any key pressed.

Here is a working example:

METHOD Dispatch ( oEvent ) CLASS  HotKeyDialog

   LOCAL lAltOn as logic


   lAltOn := LOGIC(_cast, _and(GetKeyState(VK_MENU), SHORT(_cast, 0x8000)))


   IF oEvent:message ==  WM_SYSKEYUP .and. lAltOn

     if CHR(oEvent:wparam) == "P"

              ? "Alt + P Pressed"
               // call your method
              RETURN 1L
     endif

     if CHR(oEvent:wparam) == "S"
              ? "Alt + S Pressed"
              RETURN 1L
     endif
   ENDIF


   RETURN SUPER:Dispatch ( oEvent )


Jamal

"Frank M"  wrote in message 
news:cb76027a-d091-4c76-9261-8e844524aa11@googlegroups.com...

Am Donnerstag, 6. Juni 2019 10:15:23 UTC+2 schrieb Frank M:
> Hello,
> i have noticed that when have a Button with Hotkey (in this sample ALT+P)
>
> HyperLabel{#PushButton1,_chr(38)+"Push",NULL_STRING,NULL_STRING}
>
> i have only to add Cation from Button '&Push'
>
> That work when click ALT+P
>
> But that work with only Clicking P , too ?
>
> I this a normal behavior? I want that only the Hotkey work with ALT+Key, 
> not that only click Key (P) without ALT work.
>
> VO2.8 2838
>
> Regards, Frank


Hi Jamal,
thank you for testing.

It is a lot of work to provide all windows with a menu. Does everyone have 
the same behavior that is performed on the single key function? There must 
be a solution for it :-( 

[toc] | [prev] | [next] | [standalone]


#12516

FromFranz Rachbauer <office@rachbauer.org>
Date2019-06-11 14:01 +0200
Message-ID<qdo57h$11r3$1@gioia.aioe.org>
In reply to#12512
Hi Jamal,
I tried your dispatch in a dialog win but I don't get WM_SYSKEYUP 
message. What could be wrong?

Franz

Am 09.06.2019 um 09:46 schrieb Jamal:
> As I said in my previous message, you can also use the dispatch() option 
> and handle the Alt key and any key pressed.
> 
> Here is a working example:
> 
> METHOD Dispatch ( oEvent ) CLASS  HotKeyDialog
> 
>    LOCAL lAltOn as logic
> 
> 
>    lAltOn := LOGIC(_cast, _and(GetKeyState(VK_MENU), SHORT(_cast, 0x8000)))
> 
> 
>    IF oEvent:message ==  WM_SYSKEYUP .and. lAltOn
> 
>      if CHR(oEvent:wparam) == "P"
> 
>               ? "Alt + P Pressed"
>                // call your method
>               RETURN 1L
>      endif
> 
>      if CHR(oEvent:wparam) == "S"
>               ? "Alt + S Pressed"
>               RETURN 1L
>      endif
>    ENDIF
> 
> 
>    RETURN SUPER:Dispatch ( oEvent )
> 
> 
> Jamal
> 
> "Frank M"  wrote in message 
> news:cb76027a-d091-4c76-9261-8e844524aa11@googlegroups.com...
> 
> Am Donnerstag, 6. Juni 2019 10:15:23 UTC+2 schrieb Frank M:
>> Hello,
>> i have noticed that when have a Button with Hotkey (in this sample ALT+P)
>>
>> HyperLabel{#PushButton1,_chr(38)+"Push",NULL_STRING,NULL_STRING}
>>
>> i have only to add Cation from Button '&Push'
>>
>> That work when click ALT+P
>>
>> But that work with only Clicking P , too ?
>>
>> I this a normal behavior? I want that only the Hotkey work with 
>> ALT+Key, not that only click Key (P) without ALT work.
>>
>> VO2.8 2838
>>
>> Regards, Frank
> 
> 
> Hi Jamal,
> thank you for testing.
> 
> It is a lot of work to provide all windows with a menu. Does everyone 
> have the same behavior that is performed on the single key function? 
> There must be a solution for it :-(

[toc] | [prev] | [next] | [standalone]


#12517

From"Jamal" <noooospam@example.com>
Date2019-06-11 17:08 -0400
Message-ID<qdp58t$iof$1@news.albasani.net>
In reply to#12516
Hi Franz,

The code I posted was tested with other controls on the dialog.

It does not work well. So, I modified the code based on Karl Heinz post:

https://groups.google.com/forum/?nomobile=true#!searchin/comp.lang.clipper.visual-objects/__RegisterHotkeys%7Csort:date/comp.lang.clipper.visual-objects/nwcaIY0Cddw/3iH-x7dTCQAJ

Additional links that you may find useful:

https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-registerhotkey
https://docs.microsoft.com/en-us/windows/desktop/inputdev/virtual-key-codes

Add the following to dialog class. You can subclass the :

METHOD Activate(oEvent) CLASS HotKeyDialog

       SUPER:Activate(oEvent)

       self:__RegisterHotkeys( true )

    RETURN nil


METHOD Deactivate(oEvent) CLASS HotKeyDialog

    SUPER:Deactivate(oEvent)

    self:__RegisterHotkeys( FALSE )

    RETURN nil

METHOD __RegisterHotkeys ( lRegister ) CLASS HotKeyDialog

   // RegisterHotKey in Win32 API:

   // _dll FUNCTION RegisterHotKey(hwnd as ptr, id as int, sfsModifiers as 
DWORD, vk as DWORD) as LOGIC PASCAL:USER32.RegisterHotKey

    IF lRegister
        RegisterHotKey(self:Handle(), 100, 0 , VK_F9)         // F9

        RegisterHotKey(self:Handle(), 101, MOD_ALT, 0x50)     // ALT + P
        RegisterHotKey(self:Handle(), 102, MOD_ALT, 0x53)     // ALT + S

        RegisterHotKey(self:Handle(), 103, MOD_CONTROL, 0x54)  // CTRL + T

        RegisterHotKey(self:Handle(), 104, MOD_SHIFT, 0x58)  // SHIFT + X

    ELSE

        UnregisterHotKey(self:Handle(), 100)
        UnregisterHotKey(self:Handle(), 101)
        UnregisterHotKey(self:Handle(), 102)
        UnregisterHotKey(self:Handle(), 103)
        UnregisterHotKey(self:Handle(), 104)
    ENDIF


    RETURN self

METHOD Dispatch( oEvent ) CLASS  HotKeyDialog

    DO CASE

    CASE oEvent:message == WM_HOTKEY
            self:OnHotKey( oEvent:wparam )
    ENDCASE

    RETURN
SUPER:Dispatch ( oEvent )

METHOD OnHotKey( dwKey ) CLASS HotKeyDialog


    DO CASE
    CASE dwKey == 100
        self:oDCKeyPressedFixedText:Value :=  "F9"
        // call your methods
    case dwKey == 101
        self:oDCKeyPressedFixedText:Value := "ALT + P"
        // call your methods
    case dwKey == 102
        self:oDCKeyPressedFixedText:Value := "ALT + S"
        // call your method of parent class
         IF IsMethodUsual(SELF:owner, #SAVEBUTTON)
                Send(SELF:owner, #SAVEBUTTON)
         ENDIF
    case dwKey == 103
        self:oDCKeyPressedFixedText:Value := "CTRL + T"
        // call your methods
    case dwKey == 104
        self:oDCKeyPressedFixedText:Value := "SHIFT + X"
        // call your methods
    ENDCASE

    RETURN self

Jamal


"Rachbauer"  wrote in message news:qdo57h$11r3$1@gioia.aioe.org...

Hi Jamal,
I tried your dispatch in a dialog win but I don't get WM_SYSKEYUP
message. What could be wrong?

Franz

Am 09.06.2019 um 09:46 schrieb Jamal:
> As I said in my previous message, you can also use the dispatch() option 
> and handle the Alt key and any key pressed.
>
> Here is a working example:
>
> METHOD Dispatch ( oEvent ) CLASS  HotKeyDialog
>
>    LOCAL lAltOn as logic
>
>
>    lAltOn := LOGIC(_cast, _and(GetKeyState(VK_MENU), SHORT(_cast, 
> 0x8000)))
>
>
>    IF oEvent:message ==  WM_SYSKEYUP .and. lAltOn
>
>      if CHR(oEvent:wparam) == "P"
>
>               ? "Alt + P Pressed"
>                // call your method
>               RETURN 1L
>      endif
>
>      if CHR(oEvent:wparam) == "S"
>               ? "Alt + S Pressed"
>               RETURN 1L
>      endif
>    ENDIF
>
>
>    RETURN SUPER:Dispatch ( oEvent )
>
>
> Jamal
>
> "Frank M"  wrote in message 
> news:cb76027a-d091-4c76-9261-8e844524aa11@googlegroups.com...
>
> Am Donnerstag, 6. Juni 2019 10:15:23 UTC+2 schrieb Frank M:
>> Hello,
>> i have noticed that when have a Button with Hotkey (in this sample ALT+P)
>>
>> HyperLabel{#PushButton1,_chr(38)+"Push",NULL_STRING,NULL_STRING}
>>
>> i have only to add Cation from Button '&Push'
>>
>> That work when click ALT+P
>>
>> But that work with only Clicking P , too ?
>>
>> I this a normal behavior? I want that only the Hotkey work with ALT+Key, 
>> not that only click Key (P) without ALT work.
>>
>> VO2.8 2838
>>
>> Regards, Frank
>
>
> Hi Jamal,
> thank you for testing.
>
> It is a lot of work to provide all windows with a menu. Does everyone have 
> the same behavior that is performed on the single key function? There must 
> be a solution for it :-( 

[toc] | [prev] | [next] | [standalone]


#12518

From"Jamal" <noooospam@example.com>
Date2019-06-11 22:16 -0400
Message-ID<qdpnap$h35$1@news.albasani.net>
In reply to#12516
The following works for DataWindow, BUT I like HOTKEYS method (see my other 
example) as it more flexible and works flawlessly with all kinds of key 
combinations published by Microsoft.

METHOD Dispatch( oEvent ) CLASS  MyDataWindow

LOCAL cChar as STRING
   LOCAL lAltOn as logic

   lAltOn := LOGIC(_cast, _and(GetKeyState(VK_MENU), SHORT(_cast, 0x8000)))

   IF lAltOn
       cChar := Upper(CHR(oEvent:wparam))
     if cChar == "P"
              ? "Alt + P Pressed"
              RETURN 1L
     elseif cChar == "S"
              ? "Alt + S Pressed"
              RETURN 1L
     endif
   endif


   RETURN SUPER:Dispatch ( oEvent )

Jamal
"Franz Rachbauer"  wrote in message news:qdo57h$11r3$1@gioia.aioe.org...

Hi Jamal,
I tried your dispatch in a dialog win but I don't get WM_SYSKEYUP
message. What could be wrong?

Franz

Am 09.06.2019 um 09:46 schrieb Jamal:
> As I said in my previous message, you can also use the dispatch() option 
> and handle the Alt key and any key pressed.
>
> Here is a working example:
>
> METHOD Dispatch ( oEvent ) CLASS  HotKeyDialog
>
>    LOCAL lAltOn as logic
>
>
>    lAltOn := LOGIC(_cast, _and(GetKeyState(VK_MENU), SHORT(_cast, 
> 0x8000)))
>
>
>    IF oEvent:message ==  WM_SYSKEYUP .and. lAltOn
>
>      if CHR(oEvent:wparam) == "P"
>
>               ? "Alt + P Pressed"
>                // call your method
>               RETURN 1L
>      endif
>
>      if CHR(oEvent:wparam) == "S"
>               ? "Alt + S Pressed"
>               RETURN 1L
>      endif
>    ENDIF
>
>
>    RETURN SUPER:Dispatch ( oEvent )
>
>
> Jamal
>
> "Frank M"  wrote in message 
> news:cb76027a-d091-4c76-9261-8e844524aa11@googlegroups.com...
>
> Am Donnerstag, 6. Juni 2019 10:15:23 UTC+2 schrieb Frank M:
>> Hello,
>> i have noticed that when have a Button with Hotkey (in this sample ALT+P)
>>
>> HyperLabel{#PushButton1,_chr(38)+"Push",NULL_STRING,NULL_STRING}
>>
>> i have only to add Cation from Button '&Push'
>>
>> That work when click ALT+P
>>
>> But that work with only Clicking P , too ?
>>
>> I this a normal behavior? I want that only the Hotkey work with ALT+Key, 
>> not that only click Key (P) without ALT work.
>>
>> VO2.8 2838
>>
>> Regards, Frank
>
>
> Hi Jamal,
> thank you for testing.
>
> It is a lot of work to provide all windows with a menu. Does everyone have 
> the same behavior that is performed on the single key function? There must 
> be a solution for it :-( 

[toc] | [prev] | [next] | [standalone]


#12513

FromFrank M <frank_muessner@gmx.de>
Date2019-06-11 00:29 -0700
Message-ID<61d703c5-4bd9-4212-8934-a7e3c4b70b7a@googlegroups.com>
In reply to#12503
Am Donnerstag, 6. Juni 2019 10:15:23 UTC+2 schrieb Frank M:
> Hello, 
> i have noticed that when have a Button with Hotkey (in this sample ALT+P)
> 
> HyperLabel{#PushButton1,_chr(38)+"Push",NULL_STRING,NULL_STRING}
> 
> i have only to add Cation from Button '&Push' 
> 
> That work when click ALT+P 
> 
> But that work with only Clicking P , too ? 
> 
> I this a normal behavior? I want that only the Hotkey work with ALT+Key,  not that only click Key (P) without ALT work. 
> 
> VO2.8 2838
> 
> Regards, Frank

Hi Jamal, 

thank you, i will try that. 

Regards, Frank

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web