Page 2 of 2

Re: Get the screen position of the cursor

Posted: Sun Nov 28, 2021 5:31 pm
by richmond62
SShot 2021-11-28 at 18.29.39.png

Re: Get the screen position of the cursor

Posted: Sun Nov 28, 2021 6:52 pm
by dunbarx
Richmond.

You do not need all that. You can examine the "textChanged" message as you type each char, and see if the last three of the field fall into any of the stock patterns that will engender a substitution.

That is not what I am asking. It is whether it is required that the typist be alert to the current context so that he enters any of the prescribed text patterns.

Craig

Re: Get the screen position of the cursor

Posted: Sun Nov 28, 2021 7:01 pm
by dunbarx
Richmond.

I did not mean to be short. Sorry.

Anyway, in the field script, simply place:

Code: Select all

on textChanged
   if char - 3 to - 1 of me = "//t" then beep
end textChanged
The "beep" here just means we have typed a certain pattern, and now is the time to show the menu.

Craig

Re: Get the screen position of the cursor

Posted: Sun Nov 28, 2021 7:09 pm
by dunbarx
@banjaxd

If you see my last post, we might enhance the one-liner to read something like:

Code: Select all

if char - 3 to - 1 of me is among the lines of the patterns of this card then....
The "patterns of this card" is a custom property that contains, perhaps:
"//t"
"//p"
etc.
Now the menu can see that (1) it is time to reveal itself, and (2) will know which pattern was typed, and (3) will be able to populate itself with the appropriate menuItems

So much fun

Craig

Re: Get the screen position of the cursor

Posted: Sun Nov 28, 2021 7:12 pm
by richmond62
I did not mean to be short.
It'll take more than that to offend me. 8)

Anyway, as a teacher, I tend to like to be long-winded: especially as all my code is worked out as I go along.

Re: Get the screen position of the cursor

Posted: Sun Nov 28, 2021 9:22 pm
by dunbarx
I never work out my code as I go along.

Craig

Re: Get the screen position of the cursor

Posted: Mon Nov 29, 2021 3:32 am
by dunbarx
@banjaxd

Try this demo stack and me know if it works for you as a starter. You can change the actual menuItems, which are located in the custom properties of the card, as needed.
WordSelector.livecode.zip
(1.51 KiB) Downloaded 243 times
Craig

Re: Get the screen position of the cursor

Posted: Mon Nov 29, 2021 12:46 pm
by banjaxd
@Craig - thank you for the example, that's an ideal solution.

Also thank you to everyone else for your contribution and support. I'll post a link to the full solution when I'm done :)

Re: Get the screen position of the cursor

Posted: Mon Nov 29, 2021 3:47 pm
by dunbarx
banjaxd.

Good.

Make sure you check out the custom properties of the card to see how I put it together. That is where you will add your own tags and their contents.

Know also that the pulldown menu is made very small so that only the menuItems are visible. You can see that in the button script at the bottom of the card.

Craig