5 Replies Latest reply on Mar 15, 2013 5:03 PM by tb3

    Change insertion point from end of field to beginning?

    tb3

      Anyone know how to change the default text insertion point from the end of a text field to the beginning of the field?

       

      As text is entered into fields, the most recently entered info needs to be at the top of the field, such as when a field is used for notes. The only way that has worked for me thus far, always posts text to the bottom of the field which means to see the most relevent and recent notes, one must scroll downward rather that just glance at the screen.

       

      Thanks, Thom

        • 1. Re: Change insertion point from end of field to beginning?
          keywords

          I don't claim to understand the reason it works, but a script using Set Selection as below seems to achieve what you are after:

           

          Set Selection [ Table::Field; Start Position: Left ( Table::Field ; 0 ) ]   

           

          To activate the script, set an On Object Enter script trigger on the field, and you will find the cursor goes to the start of the field instead of the end.

          1 of 1 people found this helpful
          • 2. Re: Change insertion point from end of field to beginning?

            As will:

             

            Set Selection [ Start: 0 ]

            • 3. Re: Change insertion point from end of field to beginning?

              Honestly, it is best to create records instead of using a single field (for many reasons).  Here are a few off the top of my head:

               

              1. It is easier to search for dates
              2. You can attach notes to different entities of your solution *simultaneously
              3. You can prohibit some ding-dong from wiping out the entire field or scrambling the data or pasting garbage into everyone's depository
              4. You wish to archive older notes but some folks put extra carriage returns like told so you'd know the 'notes' breaks and some didn't and it is now difficult to break them apart.
              5. If as records, each User can view their own notes in their own related portals (on their Staff records).
              6. If as records, you can sort by date or by user or by Category or Type.
              7. You can open a new window to display a single note
              8. You can print report showing all Client Notes for a single Rep whereever they have note - Invoices, Addresses
              9. Notes can be kept separate from your main tables so serving up the records remains fast.

               

              The thing is ... why put something together only to require breaking it apart later?  As records, Notes can easily attach everywhere with Allow Creation on.  *Notes would contain a foreign key from each of your main tables (Contacts, Companies, Invoices, Products) and relate directly to that TO. 

              • 4. Re: Change insertion point from end of field to beginning?
                BowdenData

                Thom,

                 

                Use the Set Selection script step and set the start position to 0. For entering text into a notes field, I suggest using a button or script trigger to run a script that will insert a tag line at the beginning of the field and then place the cursor at the end of the tag line. Any existing data will be pushed down. Likely better depending on your situation, would be to create a "notes" table and then have each note be an entry in the table. With this, you can have each notes record get automatically date/time stamped, record who created the record, and so forth. Can then perhaps display the notes in a portal on a main view or in a list view on their own. You can then sort the portal or list view by different criteria as needed.

                 

                HTH.

                 

                Doug

                 

                 

                Sample script below that will insert the current date and the name of the person logged into the dB into a general notes field in bold, underline text like this:

                 

                15-Mar-2013 - Doug:

                 

                 

                 

                # Note that this is kind of old school using the Insert Calculated Result command, but it works assuming the Notes field is on the current layout.

                Enter Browse Mode

                If [ IsEmpty( Main::Notes ) ]

                #"insert" commands leave the cursor in the field at the end of the inserted text.

                Insert Calculated Result [ Main::Notes; TextStyleAdd( GetAsText( Day( Get( CurrentDate ) ) ) & "-" & Left( MonthName( Get( CurrentDate ) ); 3 ) & "-" & GetAsText( Year( Get( CurrentDate ) ) ) & " - " & Get( AccountName ) & ":" ; Bold + Underline ) &" "]

                Else

                #"set field" command does NOT leave the cursor in the field so we need do that with the "set selection" command.

                Set Field [ Main::Notes; TextStyleAdd( GetAsText( Day( Get( CurrentDate ) ) ) & "-" & Left( MonthName( Get( CurrentDate ) ); 3 ) & "-" & GetAsText( Year( Get( CurrentDate ) ) ) & " - " & Get( AccountName ) )

                ) & ":" ; Bold + Underline ) & " ¶¶" & Main::Notes ]

                Set Selection [ Main::Notes; Start Position: Position ( Main::Notes ; ": " ; 1 ; 1 ) + 2 ]

                End If

                #

                Exit Script [ ]


                1 of 1 people found this helpful
                • 5. Re: Change insertion point from end of field to beginning?
                  tb3

                  I used the simplest answer, Set Selection [ Start: 0 ]. It does exactly what I was looking for by making it the first line in a script I am already using. But all the answers have information that interests me - and I'm guessing they are all correct. As I become a bit more sophisticated, I'll be coming back to take give more consideration to the more indepth solutions and the reasons behind them.

                   

                  Thanks Everyone!

                   

                  Thom