How to resolve the algorithm Keyboard macros step by step in the BBC BASIC programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Keyboard macros step by step in the BBC BASIC programming language
Table of Contents
Problem Statement
Show how to link user defined methods to user defined keys. An example of this is the facility provided by emacs for key bindings. These key bindings may be application-specific or system-wide; state which you have done.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Keyboard macros step by step in the BBC BASIC programming language
Source code in the bbc programming language
*KEY 1 |!|A
*KEY 2 |!|B
REPEAT
key% = INKEY(1)
CASE key% OF
WHEN &81: PROCmethod1
WHEN &82: PROCmethod2
ENDCASE
UNTIL FALSE
END
DEF PROCmethod1
PRINT "You pressed F1"
ENDPROC
DEF PROCmethod2
PRINT "You pressed F2"
ENDPROC
FVIRTKEY = 1
VK_F1 = &70
VK_F2 = &71
nsc% = 2
DIM accel{(nsc%-1) fVirt&, pad&, key{l&,h&}, cmd{l&,h&}}
accel{(0)}.fVirt& = FVIRTKEY : accel{(1)}.fVirt& = FVIRTKEY
accel{(0)}.key.l& = VK_F1 : accel{(0)}.cmd.l& = &81
accel{(1)}.key.l& = VK_F2 : accel{(1)}.cmd.l& = &82
SYS "CreateAcceleratorTable", accel{(0)}, nsc% TO haccel%
@haccel% = haccel%
@hwacc% = @hwnd%
ON SYS PROCsys(@wparam%) : RETURN
REPEAT
WAIT 1
UNTIL FALSE
END
DEF PROCsys(W%)
CASE W% AND &FFFF OF
WHEN &81: PROCmethod1
WHEN &82: PROCmethod2
ENDCASE
ENDPROC
DEF PROCmethod1
PRINT "You pressed F1"
ENDPROC
DEF PROCmethod2
PRINT "You pressed F2"
ENDPROC
You may also check:How to resolve the algorithm Greatest element of a list step by step in the ActionScript programming language
You may also check:How to resolve the algorithm Multiplication tables step by step in the Batch File programming language
You may also check:How to resolve the algorithm File input/output step by step in the Scala programming language
You may also check:How to resolve the algorithm Accumulator factory step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Carmichael 3 strong pseudoprimes step by step in the Go programming language