Recent

Author Topic: BitBtn Oddity  (Read 302 times)

Petrus Vorster

  • Full Member
  • ***
  • Posts: 248
BitBtn Oddity
« on: July 07, 2026, 10:26:37 am »
Hi All

I have app that requires a lot of manual input and a Bitbutton which then process the saving of the info.
It works great and you just tap the space bar when you are on speed instead of letting go of the keyboard to go fetch the mouse.

Its very repetitive, but at some point, around 20 entries, the space bar simply stops working as a trigger for the button but the mouse still works.

This is on Windows 10.

I have encountered this a number of times now.

Anyone has any ideas why this is happening?

-Peter

 

Zvoni

  • Hero Member
  • *****
  • Posts: 3430
Re: BitBtn Oddity
« Reply #1 on: July 07, 2026, 10:52:54 am »
Has the button lost focus?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Petrus Vorster

  • Full Member
  • ***
  • Posts: 248
Re: BitBtn Oddity
« Reply #2 on: July 07, 2026, 11:37:02 am »
Hi

No, its the weird part.
I follow the sequence of capturing and the clear blue focus rectangle is around it.
Its usually after around 20 - 25 times when it starts occurring.
From that point onward the space bar will not work on that button until i close the application and start it again.

-Peter

Zvoni

  • Hero Member
  • *****
  • Posts: 3430
Re: BitBtn Oddity
« Reply #3 on: July 07, 2026, 11:50:47 am »
sounds like keyboard-buffer

you said, there is "input" to be made.
In what? TEdit's? Remember, that TEdit's have precedence on catching Keyboard-Input

I find it weird, that it's the Space-Bar which should be the Default-Trigger for a Button (usually it's the Return/Enter-Key)

Have you tried setting KeyPreview of the Form to True, and in KeyDown/Press/Up of the Form itself to look for the Space-bar?
If SpaceBarWasPressed then Call OnClick of BitBtn
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Petrus Vorster

  • Full Member
  • ***
  • Posts: 248
Re: BitBtn Oddity
« Reply #4 on: July 08, 2026, 09:38:36 am »
Hi all

Its truly odd.
I mean it works perfectly every time, and just at some point it stops working.
Yes there are a few Tedits and then once the button is pressed the info goes into a simple DBF file linked to a Gridview.
Sometimes nothing happens and at some odd, unexplainable reason during a bunch of capturing it randomly happens. The space bar still functions ion the TEdit though, but once that Bitbutton gets focus, it ignores it completely.
I will go with the Keypreview suggestion and see if I can make that work.

-Peter

Zvoni

  • Hero Member
  • *****
  • Posts: 3430
Re: BitBtn Oddity
« Reply #5 on: July 08, 2026, 10:24:57 am »
Hi all

Its truly odd.
I mean it works perfectly every time, and just at some point it stops working.
Yes there are a few Tedits and then once the button is pressed the info goes into a simple DBF file linked to a Gridview.
Sometimes nothing happens and at some odd, unexplainable reason during a bunch of capturing it randomly happens. The space bar still functions ion the TEdit though, but once that Bitbutton gets focus, it ignores it completely.
I will go with the Keypreview suggestion and see if I can make that work.

-Peter
Do note, that in that case, the space-bar will not insert a BLANK while in a TEdit.
Except if you write corresponding logic for that

Aircode
Code: Pascal  [Select][+][-]
  1. //In TForm.KeyDown/Press/Up
  2. IfPressedKeyIsSpaceBar And TEditHasFocus Then
  3.   ProcessSpaceBarInTedit
  4. Else
  5.   BitBtn.Click;
  6.  
If you have multiple TEdits you have to consider all of them.
Probably best with a Bitmask.
As long as whichever TEdit has the Focus do not call the BitBtn-OnClick

But this is all only as a workaround.
I'd really research what is going on there, because i agree: it sounds really weird
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

 

TinyPortal © 2005-2018