Jump to content

Set cursor location in a field?


This topic is 6679 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Does anyone know a way for a script to set the cursor position within a field to a specific location? What I need to do is have a button that adds a note with attribution to the top of a notes field. So, if the field says "8/23/05 foo: this is weird", I need the script to add "8/23/05 bar: a new note" followed by a couple of line feeds.

It's easy to add the attribution and line feeds to the top of the field, but how do I then set the cursor to the end of the newly-in serted attribution so that someone can start typing there?

Thanks in advance.

Link to comment
Share on other sites

A better idea is to use a global field for data entry, then set the non-modifiable notes field to

globalField & "¶¶" & notesField.

This way notesField cannot be modified accidentally.

Link to comment
Share on other sites

Well, I started out doing something like that, but that approach introduces a level of indirection (having to enter data into a different field and/or layout than where it will be viewed), and I have found that users can find that counterintuitive and disorienting, or, at the least, an annoying extra step.

For that reason, I think doing it in the same field is the *better* solution, but if there's no way to set the cursor position (which I would have thought would be simple), then it's not going to be a *workable* one.

Link to comment
Share on other sites

Sigh.

Well, I can't say I'm surprised; this is classic Filemaker. I've been working with the program long enough to know when to say "uncle" and do the workaround, so I'll just make the "Add Note" button bring up a layout with the global field and have a "Done" button that will update the Notes field.

By the way, I tried the Set Selection command, setting the start and end to be the same character right after the colon that designates the end of the "header." It didn't quite work, but I didn't fiddle with it, I just tried it once.

Thanks for your help, folks!

Link to comment
Share on other sites

This topic is 6679 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.