How to detect ALT-C or Control-C?
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by cor.
#C_Code=100
The following is in the event menu
AddkeyboardShortCut(0, #PB_ShortCut_C, #C_Code)
It's working if I press C key, but how to detect CTRL-C?
AddkeyboardShortCut(0, #PB_ShortCut_C | #PB_ShortCut_Control, #C_Code) does not work.
Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
#C_Code=100
The following is in the event menu
AddkeyboardShortCut(0, #PB_ShortCut_C, #C_Code)
It's working if I press C key, but how to detect CTRL-C?
AddkeyboardShortCut(0, #PB_ShortCut_C | #PB_ShortCut_Control, #C_Code) does not work.
Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fweil.
Hello cor,
Don't know how you coded it in your test but the following works fine ...
As I use Debug to display result, do not forget to select the window back itself after program's start.
;==========================================
WEvent.l
EventMenu.l
Quit.l
Quit = #FALSE
If OpenWindow(0, 0, 0, 320, 240, 0, "")
AddKeyboardShortcut(0, #PB_Shortcut_Escape, 99)
AddKeyboardShortcut(0, #PB_ShortCut_C, 100)
AddKeyboardShortcut(0, #PB_ShortCut_C | #PB_ShortCut_Control, 101)
AddKeyboardShortcut(0, #PB_ShortCut_C | #PB_Shortcut_Alt, 102)
AddKeyboardShortcut(0, #PB_ShortCut_C | #PB_ShortCut_Control | #PB_Shortcut_Alt, 103)
Repeat
WEvent = WaitWindowEvent()
Select WEvent
Case #PB_EventMenu
EventMenu = EventMenuID()
Select EventMenu
Case 99
Quit = #TRUE
Case 100
Debug "C"
Case 101
Debug "CTRL-C"
Case 102
Debug "ALT-C"
Case 103
Debug "ALT-CTRL-C"
Default
EndSelect
Default
EndSelect
Until Quit
EndIf
End
;==========================================
Francois Weil
14, rue Douer
F64100 Bayonne
Hello cor,
Don't know how you coded it in your test but the following works fine ...
As I use Debug to display result, do not forget to select the window back itself after program's start.
;==========================================
WEvent.l
EventMenu.l
Quit.l
Quit = #FALSE
If OpenWindow(0, 0, 0, 320, 240, 0, "")
AddKeyboardShortcut(0, #PB_Shortcut_Escape, 99)
AddKeyboardShortcut(0, #PB_ShortCut_C, 100)
AddKeyboardShortcut(0, #PB_ShortCut_C | #PB_ShortCut_Control, 101)
AddKeyboardShortcut(0, #PB_ShortCut_C | #PB_Shortcut_Alt, 102)
AddKeyboardShortcut(0, #PB_ShortCut_C | #PB_ShortCut_Control | #PB_Shortcut_Alt, 103)
Repeat
WEvent = WaitWindowEvent()
Select WEvent
Case #PB_EventMenu
EventMenu = EventMenuID()
Select EventMenu
Case 99
Quit = #TRUE
Case 100
Debug "C"
Case 101
Debug "CTRL-C"
Case 102
Debug "ALT-C"
Case 103
Debug "ALT-CTRL-C"
Default
EndSelect
Default
EndSelect
Until Quit
EndIf
End
;==========================================
Francois Weil
14, rue Douer
F64100 Bayonne
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Fangbeast.
AddkeyboardShortCut(0, #PB_ShortCut_Control | #PB_ShortCut_C, #C_Code)
I have many keyboard shorcuts through most of my apps since I learned how to use it properly (I can hear Paul laghing at me now) and that's the right way around.
@Francois, I don't see how yours can work backwards like that, it isn't logical, sounds like my normal mode of thinking!! (grin)
Fangles
Hello Cor, hope you don't mind me saying that I can see that you had it backwards, the control key check must come first, then the key or'ed with it.Originally posted by cor
#C_Code=100
The following is in the event menu
AddkeyboardShortCut(0, #PB_ShortCut_C, #C_Code)
It's working if I press C key, but how to detect CTRL-C?
AddkeyboardShortCut(0, #PB_ShortCut_C | #PB_ShortCut_Control, #C_Code) does not work.
AddkeyboardShortCut(0, #PB_ShortCut_Control | #PB_ShortCut_C, #C_Code)
I have many keyboard shorcuts through most of my apps since I learned how to use it properly (I can hear Paul laghing at me now) and that's the right way around.
@Francois, I don't see how yours can work backwards like that, it isn't logical, sounds like my normal mode of thinking!! (grin)
Fangles
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Fangbeast.
As for Paul, he was teaching me native Canadian sarcasm
:)
Just remembering from 18 years ago that alot of the P'code and interpreted languages used a strictly first in-first out logic for tests (unlike multi-pass and single pass assembly compilers of today) so that Control and then C was the way it was tested and not the other way around
Does anyone remember the Sharp handheld, the Sega and the Exidy Sorcerer computers?? Their Basics were great
:)
Didn't know about the order, I supposed it was a FIFO storage buffer.Originally posted by Danilo
Hehe... "#PB_ShortCut_Control | #PB_ShortCut_C"
is a simple bitwise OR, so the order doesnt
make any difference.
Did Paul teach you that ??
cya,
...Danilo
(registered PureBasic user)
As for Paul, he was teaching me native Canadian sarcasm
Just remembering from 18 years ago that alot of the P'code and interpreted languages used a strictly first in-first out logic for tests (unlike multi-pass and single pass assembly compilers of today) so that Control and then C was the way it was tested and not the other way around
Does anyone remember the Sharp handheld, the Sega and the Exidy Sorcerer computers?? Their Basics were great
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by cor.
Thanks for the responses.
My first code was ok. There was something wrong with the event handling. Its working now.
Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
Thanks for the responses.
My first code was ok. There was something wrong with the event handling. Its working now.
Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Fangbeast.
Everyone should download Paul's PB chat program and have some live fun
:)
Fangles
Look at Danilo's smiley character and my ":):)" and if you think that smiling is scary, you should hear the way Paul and I stir each other, it's very funnyOriginally posted by fweil
Allright ... This allowed to learn that Canadian sarcasm exist ...
Easy guys. I love this forum and discussions we have.
Francois Weil
14, rue Douer
F64100 Bayonne
Fangles
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm