Pages: [1]   Go Down
Author Topic: Detecting text fields  (Read 647 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 1
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone,

I just started programming with Arduino, some Projects are already working.
But now I need some help, there is no useful information on the internet.
The hardware-part is easy, I want to build a keyboard light.
A few LEDs connected to an arduino, which is plugged into a usb port.
But I dont want to make one of those always-on lights.
It should only light up if you need it.
There must be a way to detect a blinking cursor in a text field.
For exampe in a browser when you are typing something in the searchbar.
In Android or iOS the keybard pops up if you click on a text field.
The same thing should be possible in Windows.
But I dont have any idea how to start with this.

Thanks in advance,
Max
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just to confirm, you want to check when any text input area on any application gets focus?

That's pretty low level. You'd need to hook into the system-wide text input processes.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, that is exactly what I want it to do.
And it cant be that complicated, the program does not have to search for text fields.
It should just detect if the cursor is in text mode.
Like when you clicked on a text field in a browser the arrow keys control the cursor,
They dont move the page up and down anymore.
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
And it cant be that complicated

Really? Off you go then.

This is window manager level function. It is the window manager's job to control (amongst other things) input functionality. You will need to find a way to hook into the window manager (Explorer.exe in MS Windows), and get it to notify a routine that you will need to write. That routine will then need to send something to your Arduino. There are, I believe, interrupt hooks that are used by the international language/keyboards processes when text input fields get focus. You might be able to attach to that process somehow, but this is not trivial, and requires fairly low level knowledge of Windows internals.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow.
Looks like I wont get around using a on/off switch.
Would it be easier to use the function in Google Chrome only?
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Possibly. Chrome's extensions API can notify an extension whenever a text input field gets focus.

http://developer.chrome.com/extensions/input.ime.html

Whether a Chrome extension can communicate with an Arduino is another question, and I don't know the answer to that.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, thanks.
Now I know what to search for.
At least it is possible.
Logged

Pages: [1]   Go Up
Jump to: