Re: [fpc-pascal] Pause Key

2023-04-16 Thread James Richters via fpc-pascal
It occurs to me that since Pause is independent of keypressed,  I could 
actually us it as an extra modifier key if I wanted to... 
"Pause-A" could be different than "A", and also different than "CRTL-A" or 
"ALT-A",  in fact I could do "Pause-CTRL-ALT-A" and have that be different than 
"CTRL-ALT-A"

I could have all kinds of secret command key combinations and no one would ever 
discover them because almost nobody ever pushes the pause key anymore, and even 
if they do, even fewer people would ever uses it as a modifier.

Fun!

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Pause Key

2023-04-15 Thread Dennis Lee Bieber via fpc-pascal
On Sat, 15 Apr 2023 14:23:12 +0300, Nikolay Nikolov via fpc-pascal
 declaimed
the following:

>Actually, the Linux console (but not X11!) uses Scroll Lock to pause the 
>console output, pretty much the same way DOS and BIOS used the Pause 
>key. Why didn't Linus Torvalds use the Pause key is beyond me.
>

Why didn't either use the long established X-on/X-off /
convention?

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Pause Key

2023-04-15 Thread Nikolay Nikolov via fpc-pascal


On 4/14/23 20:38, Virgo Pärna via fpc-pascal wrote:

On Thu, 13 Apr 2023 20:53:09 -0400, Travis Siegel via fpc-pascal 
 wrote:

I know of no way to obtain the pause key status under windows.  I can

Considering, that only Caps Lock, Scroll Lock and Num Lock keys
have status lights on keyboard I would suspect, that there is not such
thing as Pause status on PC keyboard.


There is such a thing under DOS, because the BIOS treats the Pause key 
in a special way. When you press it, the BIOS enters a loop and stops 
execution of your program, until you press Pause again. This is done, so 
that you can pause the output to the console, in case it is scrolling 
too fast, so that you can examine it. For this purpose, there's a flag 
in the BIOS data area, which is documented here:


http://www.techhelpmanual.com/58-keyboard_shift_status_flags.html

Bit 3 (mask 08h) at 0040h:0018h contains the Pause status. However, I 
don't think there's such an equivalent under Windows and Linux. 
Actually, the Linux console (but not X11!) uses Scroll Lock to pause the 
console output, pretty much the same way DOS and BIOS used the Pause 
key. Why didn't Linus Torvalds use the Pause key is beyond me.


Nikolay

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Pause Key

2023-04-15 Thread Virgo Pärna via fpc-pascal
On Thu, 13 Apr 2023 20:53:09 -0400, Travis Siegel via fpc-pascal 
 wrote:
> I know of no way to obtain the pause key status under windows.  I can 

Considering, that only Caps Lock, Scroll Lock and Num Lock keys
have status lights on keyboard I would suspect, that there is not such
thing as Pause status on PC keyboard.

-- 
Virgo Pärna 
virgo.pa...@mail.ee

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Pause Key

2023-04-14 Thread James Richters via fpc-pascal
>> ... I wouldn't be surprised that James's program is a console one, not
using TForm nor any windows message loop to process WM_ messages, but I may
be wrong.

Indeed you are correct, it is a very extensive console application which
uses PTCGraph.   I do accept keyboard input on both the Console window and
the PTCGraph window.  I have a keytest function that I can run in my
application that reports the returned keycodes every time a key is pressed
in either window, but pushing the Pause key is the same as doing nothing, it
does not trigger keypressed.  

However I was already  doing:
isShiftDown := GetAsyncKeyState(VK_Shift);   
because I want to know if shift was held down, I can't rely on just if I get
a capital or lower case letter because caps lock might be on, and I want my
key command to work the same regardless of caps lock. 

So I just added a new function that does:
isPausePushed := GetAsyncKeyState(VK_PAUSE);

and check the pause key every time I check for keypressed  (instead of
inside keypressed) and if it finds it, it executes my Pause routine. 

It's working GREAT!  So Thank you for the help getting it to work in my
console program!

Pause is Back!!  Now I can use F12 for something more useful.

James


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Pause Key

2023-04-14 Thread Jean SUZINEAU via fpc-pascal
... I wouldn't be surprised that James's program is a console one, not 
using TForm nor any windows message loop to process WM_ messages, but I 
may be wrong.


It can be more tricky in this case.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Pause Key

2023-04-14 Thread Alexey Torgashin via fpc-pascal

if Key=VK_PAUSE then
begin
 do_something;
 Key:=0;
end;


Yes. And I tested the Pause/Break key in the Lazarus program CudaText. I 
can assign the key to any action (in the Command Palette, press F9), and 
it works then. E.g. action "toggle statusbar" works then.


ShortcutToText() for this key shows "Break".
Alex
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Pause Key

2023-04-13 Thread Martin Wynne via fpc-pascal

On 14/04/2023 01:31, James Richters via fpc-pascal wrote:

Does anyone know what's up with the Pause key in Windows?
Is there some way to tell if it was pushed?


Hi James,

//

Tform.FormKeyDown(Sender:TObject; var Key:Word; Shift:TShiftState);

begin

if Key=VK_PAUSE then
begin
 do_something;
 Key:=0;
end;

end;
//_

cheers,

Martin.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Pause Key

2023-04-13 Thread DougC via fpc-pascal
I think any function where you provide the key code value and obtain the status 
of the key should work.



>From the Linux Documenation Project:

The two keys 
PrintScrn/SysRq and Pause/Break are special in that they have two 
keycodes: the former has keycode 84 when Alt is pressed simultaneously, 
and keycode 99 otherwise; the latter has keycode 101 when Ctrl is pressed 
simultaneously, and keycode 119 otherwise.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Pause Key

2023-04-13 Thread Travis Siegel via fpc-pascal
I know of no way to obtain the pause key status under windows.  I can 
get the scroll lock status, but not the pause key, never did figure that 
one out.  Windows uses it though, I don't know if it's a standard thing, 
or something I have installed, (though if it is an installed program, I 
haven't a clue which one).  When I hit the pause key, it brings up the 
screen snippet dialog.


Since the scroll lock key is readable though, you could use that for a 
pause function.  Almost nobody uses that key, so interference should be 
minimal.



On 4/13/2023 8:31 PM, James Richters via fpc-pascal wrote:

Does anyone know what's up with the Pause key in Windows?
Is there some way to tell if it was pushed?
I have a need for the user to pause execution of my Freepascal program, I
have a pause key.. seems like there should be some way to use it.

James

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Pause Key

2023-04-13 Thread James Richters via fpc-pascal
Does anyone know what's up with the Pause key in Windows?   
Is there some way to tell if it was pushed?
I have a need for the user to pause execution of my Freepascal program, I
have a pause key.. seems like there should be some way to use it.

James

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal