larrytheo Posted August 23, 2005 Posted August 23, 2005 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.
-Queue- Posted August 23, 2005 Posted August 23, 2005 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.
larrytheo Posted August 24, 2005 Author Posted August 24, 2005 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.
comment Posted August 24, 2005 Posted August 24, 2005 I agree with Queue (which BTW is generally the smart thing to do). Your objection is easily solved by designing the layout with a clearly marked "draft area" and a "Add to Notes" button. That said, examine the Set Selection script step.
larrytheo Posted August 25, 2005 Author Posted August 25, 2005 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!
Recommended Posts
This topic is 7032 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 accountSign in
Already have an account? Sign in here.
Sign In Now