Bluetooth and wireless keyboard

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
MikaelA
Posts: 1
Joined: Sun Jun 19, 2011 11:27 am

Bluetooth and wireless keyboard

Post by MikaelA » Sun Jun 19, 2011 11:42 am

Hi
If I use a wireless keyboard with bluetooth on my Mac and write in the Card Script:
on arrowKey theKey
   if theKey is "Up" then
       put "Up" Into fld "Field1"
       Break
    end if
end arrowKey
Then it works fine on the Macintosh but not in my iPad or in the simulator with my wireless keyboard.
I have tried with KeyDown and RawKeyDown but nothing works with any keys. I have no keys to function.
I have looked everywhere on the internet, but I find nothing written about it.
Is it iPhoneControl-"something" I have to use?
I just find that it only should work with "Browser" and "Scroller".
My wireless keyboard works perfectly with other programs on my iPad.
Does anyone know how I should write it?
Mikael

trevix
Posts: 960
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Bluetooth and wireless keyboard

Post by trevix » Mon Sep 23, 2019 9:54 am

It has been a few years since this subject was raised, but I will give a try for a similar problem.

I assume that on a iPad it is possible to use an external hardware keyboard without having the virtual keyboard to appear. So the below behaviour should be possible, in my opinion.

I have a stack, running in the front, that I want to rely on a key down sent from a commercial App, running in background, in order to trigger a script. For example using "on KeyDown" or "on KeyUp" (The background App fires key press by listening to bluetooth and it run fine on background, beeping accordingly.)

It works, but only if I place a focused unlocked field on the card. And if the virtual keyboard is visible (annoying).

If I hide the virtual keyboard, the char does not reach livecode.
This behaviour is similar to the problems encountered by many using card readers that transform read data in key press.
Is there any solution to this?

Thanks
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

trevix
Posts: 960
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Bluetooth and wireless keyboard

Post by trevix » Mon Sep 23, 2019 10:23 am

Before you ask, using this doesn't work:

Code: Select all

before keyUp theKey 
answer theKey
end keyUp
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

trevix
Posts: 960
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Bluetooth and wireless keyboard

Post by trevix » Mon Sep 23, 2019 10:40 am

And this does not work either (it works on Desktop tough):

Code: Select all

on mouseUp
     put empty into me
   keyDetector
end mouseUp

on keyDetector
     if the commandKey is down then exit keyDetector --manually exit
     put the keysDown into fld "Field1" --locked field
     if 65436 is in  fld "Field1"  then --detects "1"
          send "MyKeyDown 1" to this card in 0 seconds
          put empty into fld "Field1"
          --exit keyDetector
     end if
     send "keyDetector" to me in 1
end keyDetector
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Bluetooth and wireless keyboard

Post by richmond62 » Mon Sep 23, 2019 10:56 am

In theory the operating system on a computer should do all the "heavy lifting"
to pick up keyDown signals from any keyboard be it USB, ADB, wireless, bluetooth or what-have-ye.

Try and see if TextEdit on your Mac picks up when you type "Does this work?" on your keyboard.

If that works then LiveCode should pick it up as well.

trevix
Posts: 960
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Bluetooth and wireless keyboard

Post by trevix » Mon Sep 23, 2019 11:13 am

OSX 10.14.6, LC 9.5.0 RC2, iOS 9.3.5 on iPad3

On desktop everything works fine.
On the iPad, using "Note" or any other text App, works fine. The background App fire the preferred key press and the "Note" App receive it fine.

In LC, it only works if there is a focused unlocked text field (and the virtual keyboard is showing, thing that I don't want).

I explain better my problem in order to be clear:
I have a bluetooth fisical button that pairs with its commercial iOS App, called "Flic", that can run on background.
In order to trigger some action, one of the available option is, on pushing the BT button, to trigger a keypress (for example "1")
My front LC standalone should pickup the keypress, without showing the virtual keyboard, and act accordingly.

As I said, this is similar to the behaviour of most card readers, that read the data from the card and fire keypress to be received by the user developed application (I do this with Filemaker with no problems).
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Bluetooth and wireless keyboard

Post by richmond62 » Mon Sep 23, 2019 11:30 am

Have you tried a USB keyboard connected to your iPad?

It would be interesting to see if a LiveCode standalone could pick up signals from that.

viewtopic.php?f=7&t=33103

trevix
Posts: 960
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Bluetooth and wireless keyboard

Post by trevix » Mon Sep 23, 2019 12:16 pm

Interesting.

I just paired a BT keyboard to the iPad (works fine with "Note").

In the iPad:
If there is NOT an unlocked focused field on the card, no KeyDown and no RawKeyDown gets picked up, sent from the BT keyboard.
Nor does the "keydetector" routine works

I there is an unlocked focused field on the card, both KeyDown and rawKeyDown works fine AND the virtual keyboard does NOT show.

So the pairing with the BT keyboard locks the virtual keyboard (as it should). I wish there were a LC command to do that.

Since I cannot pretend that each user as a BT keyboard at disposal, all of this does not help me though.

Jee...have you ever had the sensation that everything runs against you? (I didn't report the tons of hours that I spent to make this Flic button work with LC)
Thanks for any help
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Bluetooth and wireless keyboard

Post by richmond62 » Mon Sep 23, 2019 12:18 pm

have you ever had the sensation that everything runs against you?
Try being a red-haired Scottish boy who is no good at sport
in a snobby private school in England in the 1970s: after that most things don't seem so bad. :D

I win 100 points for most Off-Topic comment of the last 20 years!

Post Reply

Return to “iOS Deployment”