August 18, 20178 yr Hi guys Hoping for some intellectual input from those more experienced than I. I am trying to create a "portable tick box" By this I mean a script that I can attach to any field to make it a tick box So far I have created a number field and set it to display all non zero values as a tick. I have then attached a scriptrigger which runs a script on entering the field The script is as follows: Set Field by Name [Get (ActiveFieldTableName)& ::" & get (ActiveFieldName);Abs (Get (ActiveFieldName)& "::" & get (ActiveFieldName)-1)] This way if the field is empty it will be set to 1 and if it isn't it will be set to zero. So far, when I click into the field it correctly sets it to 1 and displays the tick but it remains at 1 and won't zero which I don't understand. Can anyone see the flaw? Joseph
August 18, 20178 yr Get (ActiveFieldName) gets the field's name. You want to modify the field's value, so set the field to = Abs ( Get ( ActiveFieldContents ) - 1 ) or simply = not Get ( ActiveFieldContents )
August 20, 20178 yr Author Awesome. This works really well. I notice though that by using this method, that the 1 or 0 becomes momentarily visible before seeing the tick If I set the field directly ( set field rather than set fieldbyname) that the 1 or zero is not displayed
August 20, 20178 yr 2 minutes ago, eyedoctor said: I notice though that by using this method, that the 1 or 0 becomes momentarily visible before seeing the tick That is the nature of the hack you have devised: a script triggered OnObjectEnter runs after entering the field - and while a field is active it will display its contents unformatted. If you use a button instead, the field won't be entered at all and you won't see the raw contents. What is the purpose of these boxes?
August 20, 20178 yr Author They are just tick boxes. Look better than the native Filemaker ones. Problem with attaching a script, is that the field is not entered and so the Get(active fieldname) won't work because the field is never active
August 20, 20178 yr 1 hour ago, eyedoctor said: Problem with attaching a script, is that the field is not entered and so the Get(active fieldname) won't work because the field is never active That is correct: you need to use a script parameter to identify the field. Or attach a single-step action to each button.
August 20, 20178 yr You would have to define each button individually, with the specific field being hard-coded in the Set Field[] script step.
August 20, 20178 yr Author I think that in the end, this is probably a better and simpler approach. Thank you for your advice Joseph
Create an account or sign in to comment