I've written some BlackBerry apps, but now i'm trying to write one that must access the hardware (keyboard) in some low level way, and I can't seem to find a way to do it, nor any help to it in the 'official' boards.
The thing is, I need to know when, at any time, the '$' key is pressed in the blackberry keyboard, so my app (or resident service) can catch it, stop the '$' char from displaying, and if the user presses a vowel next, then add an accent to that vowel... and if it presses another key, just send back the '$' char + the other char.
i.e. '$' + 'a' = รก
In other words, I need to create an app or service that converts the '$' key into an accent key, just like typical non-US PC keyboards works.
Now here's the problem: The whole Blackberry OS works under a Java Virtual Machine (Kind of making the JVM the actual OS). So as you can imagine, every app written for it is written in Java.
There's obviously a set of special blackberry api libraries into their Java implementation so the developer is able to access particular Blackberry functions and features... however there doesn't seem to be a thing that I can use to achieve my particular task.
But then maybe there is, and I haven't found it, since I'm still new to Blackberry Programming.
So, in that note, any help or comment will be greatly appreciated.
-Gabriel Alonso.
A screen need to have the focus to be able to get key Event.
RIM dosen't allow low level access to their hardware for security reason.
Press and hold a letter key and roll the thumb-wheel to scroll through international/accent characters, equation symbols and other marks.
Here is the source
Blackberry do not allow execute applications, if they use certain API, not to mention the low-level programming.
All that you can use in your applications for keypad handling - it is possibilities of Java. Like KeyListener interface and Keypad class.
This is a very late reply, however...
You can use keyChar (member of screen, and of KeyListenerInterface) to intercept any key - for the first letter, capture the key pressed. If it's "$" hold onto it and don't call super.keyChar. On the next keyChar (or after a delay with no input) perform your mapping if $ was previously pressed, and send your designed character code to the super.keyChar call. keyDown and keyUp can be used similarly if keyChar presents implementation issues.
Related
I have implemented a complicated UITextInput that works quite well on iOS save for one missing feature:
when the user has a hardware keyboard connected (at least, in the simulator) and no text is selected, and presses Forward Delete, nothing happens.
Note that I am NOT referring to the key labeled Delete on a Mac, which is just a Backspace key -- that works correctly already, using an implementation of the UIKeyInput deleteBackward method.
Two questions:
Is it possible for iOS to process Forward Delete correctly (for example a Bluetooth Mac hardware keyboard with Fn + Delete aka not Backspace, but Forward Delete). This works on my Mac laptop? (The answer seems like a yes because I just tested Forward Delete on a hardware keyboard (my host Mac dev machine) in the Simulator in Safari.)
If it is possible and common in other apps, how do I intercept this key command? I cannot find what to send as the string to create a UIKeyCommand, nor can I find any API method that makes sense to do this in an easy fashion.
Note also that selecting text and pressing the Forward Delete key works properly already in this custom text editor, so it appears iOS knows about this key.
FYI this code is in C# but answers to part (2) in Swift or Objective-C would be welcome as well.
(My current best guess might be try messing with the code in this question ? -- Seems like a real headache just to get this one fairly common key?)
UPDATE:
Now pressing Delete (right-delete not backspace) somehow works on iOS, at least the simulator. It may have been a bug in the TextInput system since now when I press the right-Delete key, the system calls my code to select a single character to the right of my cursor and then calls my DeleteBackwards code to delete the selection (which code knows how to delete selected text). Strange but happy this is working as expected now, "out of the box".
You can use Unicode code point 0x7f, for example in Swift:
UIKeyCommand(input: "\u{7f}", modifierFlags: [], action: #selector(forwardDelete))
Objective-C:
[UIKeyCommand keyCommandWithInput:[NSString stringWithFormat:#"%C", 0x7f] modifierFlags:0 action:#selector(forwardDelete)]
I have a simple problem statement, to invoke my application when multiple key pressed in blackberry device.
For example, I have the "Capture It" application which takes screenshot with key-combinations. How do we achieve such implementations. Any way to handle global key press event handling like how we invoke PhoneListener for incoming calls handling?
As Richard says in this stack overflow answer, you can't implement a KeyListener from the background, because that would be a huge security risk. Applications could then log your keystrokes, and steal your password.
I don't have CaptureIt, but it looks to me like it works two ways:
first, it adds a BlackBerry menu option, to launch it. That's completely different from allowing the app to start from any key combination. That technique (adding your app into the BB menu) is definitely supported.
it looks like a lot of people setup CaptureIt to run when they press their device's Convenience Key. That is a special key, that you can program to start any app on the device, through Options -> Screen / Keyboard.
But, I don't think you can do exactly what you're asking.
I have a bar-code scanner with USB interface, so it appears as an HID.
There are reasons why I must breakpoint on the first character.
That brings my Delphi IDE to the front, it stops on the breakpoint and the rest of the bar-code is injected into my code as if it had been typed front the keyboard (which, in a way it has, as the USB scanner is just another HID).
Is there any way to avoid this? Or to add an initial check as to the source of the input?
It annoys me so much that I am now looking for a scanner with an RS232 interface.
The problem is that HID "devices" send information back to the computer in packets known as "reports".
In the case of a mag-swipe, or bar-code scanner, the "report" contains the entire number.
Which is to say, you don't receive reports character-by-character, but the entire string at once. (In the case of a mag-swipe, you will receive all two, or three, tracks in the same report).
So your code doesn't break "on the first character", it breaks "on the entire report". The fact that the remaining characters are there you can think of as a bonus (if you don't want to look at them you don't have to). But you won't be receiving any more "reports" for subsequent characters.
i cannot imagine any reason why you wouldn't want to know the bar-code at once. But most mag-swipe and bar-code scanners can be configured to emulate a keyboard, rather than a generic HID device. In that case you will receive multiple WM_KEYDOWN messages.
sorry for this little bit strange title, didn't found a better one..
I've got the following situation:
I have a PC with an RFID reader connected via USB.
I now need a program which pops up when ab transponder was scanned the the RFID reader and shows the scanned value. (The reader just simulates keystrokes)
Problem: the value of the transponder is something like 0001230431, and I can't change it. (To prefix a hotkey combination or so)
So I have thought about using a global keyboard hook, check if three zeros where typed in, capture rest of data and when the 10 digits are complete, call the application through an automation object and show the number.
But I'm not very exalted about using a global keyboard hook. Many AV programs don't like them very much, they are not so easy to handle with Delphi and I guess that's not very resource-friendly for such a little task...
So I'm looking for an alternative solution...maybe somebody has an idea?
Big thx!
ben, you can use the RegisterRawInputDevices and GetRawInputData functions.
first you must use the RegisterRawInputDevices function to register the input device to monitor and then you can retrieves the data from the input device using the GetRawInputData function.
Check theses functions too
GetRawInputDeviceList retrieves the list of input devices attached to the system.
GetRawInputDeviceInfo retrieves information on a device.
Why not make sure the Delphi app with a text edit control has focus before the scan is done? Then the keystrokes will go straight into your Delphi app.
I'm making user definable key macros to a program. (Those macros are limited to that program.)
I'm using TApplicationEvents to record key messages. And then use SendInput to play them back. But I need to disable mouse and keyboard so it wouldn't interrupt playback.
I can't use JournalPlaybackProc and JournalRecordProc because they are subject to UAC, UIPI in Vista and Win7.
Is there a easy way to block mouse and keyboard input while still using SendInput. (A way that doesn't need heightened privileges.)
Also I need one escape key that stops playback.
EDIT:
TControl.Perform didn't work because it ignores hotkeys.
I thought of using reserved nibble (bits 25-28) in WM_KEY messages, but in the windows documentation it says it's reserved and do not use. What could be the consequences.
If you want the 'artificial input' to be limited to your own application, I wouldn't use SendInput. If you use TApplicationEvents.OnMessage to record messages, I would add a 'if not(PlayingBack) then' check in the OnMessage when playing back a macro and use Form1.Perform
I have always used AutoIT's DLL for sending KeyStrokes as well as Blocking Keyboard and Mouse.
There is one thing and that is AutoIT can't block Ctrl+Alt+Del keys.
Do check it out.
HTH