Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
I have built a tiny app that runs on some all-in-one Windows 10 touch screen PC's (no physical keyboard or mouse). The app contains a text field and when I tap it to enter some text, I would like to have the PC/Windows virtual keyboard automatically appear (I can invoke it manually by tapping on the keyboard icon in the Windows task tray but I would like eliminate that step if possible). Is there a way to do this?
That kind of works. The keyboard automatically appears but nothing happens when I tap any of the keys. Only after I close the keyboard does the text I tapped appear in the text field in my app. The other thing I noticed is that the keyboard that is called by my app is not the same keyboard as the one that appears when I tap the keyboard icon in the Windows task tray. The one called by my app has a black background while the one that appears when tapping the icon in the task tray has a light gray background.
Any other ideas?
Thank you so much!
Jon
Last edited by cmhjon on Wed Oct 20, 2021 5:00 pm, edited 1 time in total.
on openfield
set the hideconsolewindows to TRUE
get shell("osk")
end openfield
I think I have the same problem. I see the cursor flashing in the text field, the virtual keyboard appears with the command get shell("osk") but strangely it does not write in the text field. If I close the virtual keyboard in the text field the characters I had typed before are written in succession. This does not always happen and I can not understand what it could depend on. It seems that it loses focus but I am not sure it is a strange behavior because if I restart everything for a while it works after that it comes back. Any suggestions, ideas? Thanks
I have some big problems with adapting a virtual keyboard stack that I found on your forum.
-The first problem is writing the pressed key in a text field located in a different stack than the virtual keyboard.
-The second problem is inserting a pressed RETURN from the virtual keyboard stack always in the text field of another stack
-Third problem inserts the pressed character in the virtual keyboard stack when the blinking cursor is in the text field of another stack about halfway through a word.
If anyone can help me I would be grateful. I attach what I have done so far. I do not understand why the type command does not write to me in the text field in the other stack but writes to me only if the field is present in the same stack of the virtual keyboard. Thanks to all
My question is whether LiveCode can invoke this without the machine-user having already turned this on via system settings.
Tip: The Accessibility Keyboard is used for the macOS Keyboard Viewer, which lets you type in different languages when you change input sources. See Use the Keyboard Viewer.
I have found that the following Applescript code can bring the MacOS's Keyboard Viewer into view (tried on MacOS Monterey, Apple M1):
tell application "System Events"
tell process "TextInputMenuAgent"
-- Click the first menu bar item
click menu bar item 1 of menu bar 2
-- Click "Show Keyboard Viewer" in the dropdown menu
click menu item "Show Keyboard Viewer" of menu 1 of menu bar item 1 of menu bar 2
end tell
end tell
put that code into variable tScript and then: do tScript as "AppleScript"
There is a 3-second or so delay between the two clicks for some reason.
To show the Character Palette instead, use the same code but change "Show Keyboard Viewer" into "Show Emoji & Symbols"
You can also call the Character Palette with this other AppleScript code:
tell application "System Events"
if exists (process "CharacterPalette") then
tell application "CharacterPalette" to quit
else
key code 49 using {control down, command down}
end if
end tell
Here is the AppleScript code that lists all the menu items pertaining to the Text Input menu on the Mac OS (the menu that shows up on the top right side of the screen when the Keyboard viewer is turned on in the system's preferences):
tell application "System Events"
tell process "TextInputMenuAgent"
try
set menuItems to every menu item of menu 1 of menu bar item 1 of menu bar 2
set itemDescriptions to {}
repeat with menuItem in menuItems
try
set end of itemDescriptions to name of menuItem
on error
set end of itemDescriptions to "No name"
end try
end repeat
-- Display the list of menu items
set descriptionsText to ""
repeat with desc in itemDescriptions
set descriptionsText to descriptionsText & desc & return
end repeat
display dialog "Menu Items:" & return & descriptionsText buttons {"OK"} default button "OK"
on error errMsg
display dialog "Error listing menu items: " & errMsg buttons {"OK"} default button "OK"
end try
end tell
end tell