StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
berlihingen  
#1 Posted : Sunday, June 19, 2022 8:16:19 AM(UTC)
berlihingen

Rank: Member

Reputation:

Groups: Approved
Joined: 11/10/2020(UTC)
Posts: 26

Was thanked: 1 time(s) in 1 post(s)
I tried and I failed (not a coder after all) so would appreciate any help.
The idea is: a common gesture (right to left) that emulates the BACK button changes this to the BACKSPACE when gets cursor state "blinking text cursor" (or whatever name it is) and then goes back to the BACK for any other cursor state (including "unknown").
Is it even possible? Thanks.
Rob  
#2 Posted : Monday, June 20, 2022 3:26:39 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,224
United States
Location: Tampa, FL

Thanks: 27 times
Was thanked: 378 time(s) in 328 post(s)
So this works for me, however note that this only works if the mouse cursor is the IBeam style - which usually means the mouse cursor needs to be over the text/typing area and visible (I can't remember, but I think I may have my mouse cursor set to not hide when typing).
Code:
if(sp.GetCurrentMouseCursor() == "IBeam") {
    sp.SendVKey(vk.BACK);
} else {
    sp.SendVKey(vk.BROWSER_BACK);
}

Unfortunately, in web browsers (and a lot of apps), S+ can't determine if you're in an active text input field (blinking input cursor [caret]) - at least, not that I'm aware of.

This will allow you to test if the standard Windows API is able to get the location of the caret (keyboard cursor) and log it to the S+ Console User tab - but it only works on native Windows input controls, which many apps these days do not use:
Code:
var cp = sp.GetCaretLocation();
if(cp) {
    StrokesPlus.Console.Log(`Caret Location (X,Y): ${cp.X},${cp.Y}`);
} else {
    StrokesPlus.Console.Log("No caret location found");
}
berlihingen  
#3 Posted : Monday, June 20, 2022 4:36:02 PM(UTC)
berlihingen

Rank: Member

Reputation:

Groups: Approved
Joined: 11/10/2020(UTC)
Posts: 26

Was thanked: 1 time(s) in 1 post(s)
For now, I checked places where I wanted this functionality (OneNote app; online translation sites in Edge and Waterfox browsers), and this works perfectly. Thank you very much!
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.