5 Replies Latest reply on Nov 15, 2014 12:36 AM by FredH

    Friendliness "User Interface" to enter numbers

    FredH

      Title

      Friendliness "User Interface" to enter numbers

      Post

      Hi experts,

      I have two small questions on the behavior of FM regarding the ease to enter numbers in fields :

             
      • When I go from one field to another one that already contains a number, I cannot directly put a new number.  I first have to select the old one and than type the new one.  Is it possible to force FM to select automatically the old number in order to be able to type the new one directly?
      •      
      • Some of my fields are "%" and I notice that you cannot enter i.e. "40" or "40%"  as FM translates this into 4000%.  I have found a workaround for this using a script triggered on object exit but I wanted to know if there is no "cleaner" solution for this?


      Thanks in advance for your input!
      Kind regards,

      _Fred_

        • 1. Re: Friendliness "User Interface" to enter numbers
          philmodjunk

          1) In the Behavior section of the Inspector's data tab, there is a "select entire contents on entry" option that you can select for a field on your layout.

          2) Many developers use an auto-enter calculation on number fields formatted to display data as a percent.

          a simple calculation sometimes used is;

          Self/100

          a more sophisticated option:

          If ( Self > 1 ; self/100 ; self )

          The second option allows you to enter 40% as either 0.40 or 40.

          In both cases, you would clear the "do not replace existing values" check box.

          Caulkins Consulting, Home of Adventures In FileMaking

          • 2. Re: Friendliness "User Interface" to enter numbers
            FredH

            Hi PhilModJunk,

            Thanks for the tip for the "select all"!

            Regarding the percentage, I thought using following script : 
            Set Variable [ $Number ; YourField ]
            If [ $Number > 1 ]
            Set Field [ YourField ; $Number / 100 ]
            End If 


            But this is usefull only if you can define dynamically "YourField" being the active field. 
            What do you think of this approach?  Is it possible to define the active field?

            Kind regards,

            _Fred_

             

            • 3. Re: Friendliness "User Interface" to enter numbers
              philmodjunk

              Why use a script when you can produce the same result with an auto-enter calculation?

              I'd write a scripted approach like this:

              Set Variable [$Number ; value: Get ( activeFieldContents ) ]
              SetVariable [$FieldRef ; value: Get ( ActiveFieldTableName ) & "::" & Get ( ActiveFieldName ) ]
              If [ $Number > 1 ]
                 Set Field By Name [ $FieldRef ; $Number / 100 ]
              End If

              This script won't work unless the cursor is still in the field at the point in time when the script executes.

               

              • 4. Re: Friendliness "User Interface" to enter numbers
                FredH

                Hi PhilModJunk,


                Thanks a lot for your insight on this!  Based on my readings, I thought that the scripting could be more easy and robust to implement but  I understand that, regarding to you, the auto-enter calculation is at least as efficient.

                I will thus go for the auto-enter calculation ;-)

                Thanks again!

                _Fred_

                • 5. Re: Friendliness "User Interface" to enter numbers
                  FredH

                  Ok, small update in case others would have the same question as me later : 

                  As suggested by PhilModJunk, the auto-enter calculation works very well and I used it for 80% of my "%" values. 
                  Nevertheless, I will have to use the script for the last 20% of % fields because these were already having auto-enter calculation for which I also specified that no calculation should be done if the field is not empty.

                  KR,

                  _Fred_