keyboard led status & LED demo
keyboard led status & LED demo
2 questions:
1) how can I get the status of the keybord leds? :-?
I want to display the Num ans Caps state on the status
bar of my application
2)How can I get the LED demo to work with the new compiler. :-?
I would like to use the LED routine on the status bar also
1) how can I get the status of the keybord leds? :-?
I want to display the Num ans Caps state on the status
bar of my application
2)How can I get the LED demo to work with the new compiler. :-?
I would like to use the LED routine on the status bar also
keyboard led status & LED demo
I figured out the keyboard status routine figured out - just cannot get initial status` to show up when the application is started. ????
I seams that record does not support complex variables such as:
record led as image
end record
"expecting as but got image"
or
record led
dim led as image
end record
"expecting simple variable but got image"
record led
dim led as integer
sub paint()
I seams that record does not support complex variables such as:
record led as image
end record
"expecting as but got image"
or
record led
dim led as image
end record
"expecting simple variable but got image"
record led
dim led as integer
sub paint()
keyboard led status & LED demo
Did not look into it yet but two remarks:
Image is a windows object, not a (real) data type as integer.
Using a record name and the same var name is not allowed?
Image is a windows object, not a (real) data type as integer.
Using a record name and the same var name is not allowed?
keyboard led status & LED demo
Hi, there is no type statement within the new fnxbasic yet.
The old example will not work.
record is only for nummeric and string types.
best regards
The old example will not work.
record is only for nummeric and string types.
best regards
keyboard led status & LED demo
:( I guess i`ll sit and twiddle my thumbs.
keyboard led status & LED demo
part one :)
Const VK_Capital = &H14
Const VK_Numlock = &H90
Const VK_Scroll = &H91
declare ledstate as "GetKeyState" of "user32"
vkkey as integer
result as integer
end declare
function getstate(key as integer) as boolean
ledstate.vkkey=key
ledstate.execute
result=ledstate.result
end function
if getstate(vk_capital)=true then print "capslock is activated"
if getstate(vk_numlock)=true then print "numlock is activated"
if getstate(vk_scroll)=true then print "scrollock is activated"
showmessage "check consolescreen"
i hope this will help a bit
best regards
Const VK_Capital = &H14
Const VK_Numlock = &H90
Const VK_Scroll = &H91
declare ledstate as "GetKeyState" of "user32"
vkkey as integer
result as integer
end declare
function getstate(key as integer) as boolean
ledstate.vkkey=key
ledstate.execute
result=ledstate.result
end function
if getstate(vk_capital)=true then print "capslock is activated"
if getstate(vk_numlock)=true then print "numlock is activated"
if getstate(vk_scroll)=true then print "scrollock is activated"
showmessage "check consolescreen"
i hope this will help a bit
best regards
keyboard led status & LED demo
That solution looks a bit simpler than the one i wrote. Thanks. :)
Now if I could JUST figure out how to draw an "LED" on the status bar for those states! :-?
Now if I could JUST figure out how to draw an "LED" on the status bar for those states! :-?
keyboard led status & LED demo
here is a little program that produces leds:
`=====MAIN LED ROUTINES==============
`=COLORS: RED GREEN AND BLUE =
`=METHODS: LEDON(IMAGE.CANVAS,COLOR)=
`= LEDOFF(IMAGE.CANVAS) =
`====================================
const blue=rgb(0,0,255)
const green=rgb(0,200,0)
const red=rgb(255,0,0)
sub led
dim bmp as bitmap
dim effect as integer
dim c as integer,size as byte
dim on as boolean
size=8
if on=false then effect=rgb(120,120,120)
bmp.width=size*2
bmp.height=size*2
bmp.transparentcolor=&hffffff
bmp.transparent=true
bmp.canvas.circle(size,size,size,0)
bmp.canvas.fill(size,size,effect,0)
for c=size-4 to size
bmp.canvas.line(c/2,c,c,c/2,&hffffff)
next c
end sub
sub ledon(s as canvas,effect as integer)
led.effect=effect
led.on=true
led
s.draw(0,0,led.bmp)
end sub
sub ledoff(s as canvas)
led.on=false
led
s.draw(0,0,led.bmp)
end sub
`=======Example prograM======
object myform as form
object led1 as image
left=10
top=10
transparent=true
end object
object led2 as image
left=10
top=30
transparent=true
end object
end object
ledon(led1.canvas,red)
ledoff(led2.canvas)
myform.showmodal
best regards marco
`=====MAIN LED ROUTINES==============
`=COLORS: RED GREEN AND BLUE =
`=METHODS: LEDON(IMAGE.CANVAS,COLOR)=
`= LEDOFF(IMAGE.CANVAS) =
`====================================
const blue=rgb(0,0,255)
const green=rgb(0,200,0)
const red=rgb(255,0,0)
sub led
dim bmp as bitmap
dim effect as integer
dim c as integer,size as byte
dim on as boolean
size=8
if on=false then effect=rgb(120,120,120)
bmp.width=size*2
bmp.height=size*2
bmp.transparentcolor=&hffffff
bmp.transparent=true
bmp.canvas.circle(size,size,size,0)
bmp.canvas.fill(size,size,effect,0)
for c=size-4 to size
bmp.canvas.line(c/2,c,c,c/2,&hffffff)
next c
end sub
sub ledon(s as canvas,effect as integer)
led.effect=effect
led.on=true
led
s.draw(0,0,led.bmp)
end sub
sub ledoff(s as canvas)
led.on=false
led
s.draw(0,0,led.bmp)
end sub
`=======Example prograM======
object myform as form
object led1 as image
left=10
top=10
transparent=true
end object
object led2 as image
left=10
top=30
transparent=true
end object
end object
ledon(led1.canvas,red)
ledoff(led2.canvas)
myform.showmodal
best regards marco
keyboard led status & LED demo
Thanks - This routine helped me understand how it works.