Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to find Mode

Featured Replies

I have a script which is meant to copy the field contents if in Browse mode. But I need it to simply enter the filed if in Find Mode.

Is there a calculation or script step which can determine which mode the user is in?

Get(WindowMode) will return 0 for browse mode, 1 for find mode or 2 for preview mode

HTH

Phil

  • Author

That's great. Thank you :o

Ok... sorry, but -- now what do I do? I've actually been messing around with this for the past few hours and can't figure out how to allow the user to enter any of fields which have this button assigned to them. Or even to know what field they've clicked on.

EDITED: I'm in 8.5 advanced, not dev 7. Have to change that

Edited by Guest

Script something like this

If Get(WindowMode)=0

Copy Select; Get(Scriptparameter)

endif

If Get(WindowMode)=1

Go to field(GetScriptparameter)

endif

If you pass the name of the field in each case as the script parameter you will be able to attach this same script to each field.

Wherever it is used, if the user is in browse mode it will copy the contents of the field they have just clicked in or if they are in find mode it will place them in the field they have just clicked into

Hope that helps

Merry Christmas

Phil

  • Author

Hi, Phil--

Thank you. Merry Xmas to you and yours as well :o

I've actually been trying something similar.

If you pass the name of the field in each case as the script parameter you will be able to attach this same script to each field.

The issue is how to do that? For example, get[what]? If I use get[activefieldname] I get that it's not active because the cursor can't enter it -- the button wont let it. So how would I know what field I'm in?

I have just tried to do a dem file to demonstrate my idea but I have just discovered that you cannot apply a Get(scriptparameter) to a copy or go to field script step so that is my theory up the swanny!!

Sorry about that, I have used this method so often in a similiar fashion but not, as it happens with those two script steps.

Once again I apologise for misleading you

Phil

OK then, now that I have stopped blushing with embarrasment at my faux-pas and have given it a little more thought....

Since we cannot use a script parameter with those two steps the only other solution I can come up with is to have seperate script steps for each field with the field names hard coded into the script but with each set surrounded by a script parameter

eg

If Get(WindowMode)=0

If Get(ScriptParametr)=1

Copy Select; Name

endif

If Get(ScriptParametr)=2

Copy Select; Number

endif

endif

If Get(WindowMode)=1

If Get(ScriptParametr)=1

Go to field(name)

endif

If Get(ScriptParametr)=2

Go to field(number)

endif

endif

Now I KNOW we can do that one. It might just get quite long if you have a bazzillion fields to apply it to but it would work - Phew!!

Phil :goodluck:

In version 8.5, you can assign object names to fields on a layout, and use the Go to Object script step instead of Go to Field.

There's probably a more elegant solution, but we'd have to know what is the ultimate purpose here.

  • Author

Hi--

Phil, I don't know about adding in all those fields. I'm also still not sure what parameters you mean.

Basically, the intent here is have a set of layouts where the user has no ability to enter any fields in Browse Mode, but can copy their contents when clicked, and can enter find criteria in Find Mode.

So I have all the fields on several layouts set to only allow entry in Find Mode. I then setup what I thought would be a simple script. It went:

If [get(ActiveFieldContents) ≠ ""]

Copy[select]

Else

EndIf

I then assign this script to each field as a button assignment.

This actually works perfectly to copy the contents in Browse mode when they user clicks on any field. What I didn't realize is that this would prevent the user from entering any Find Criteria.

My best thought at this point was to create a new duplicate layout with all the fields again accessible in Find Mode -- but without any script assignments. I named each duplicate layout with the same name as the original, but added "_FIND" to the layout name, and made sure the layout did not appear in the layout menu.

So I setup the script as:

If [Get(ActiveFieldContents) ≠ ""]

Copy[select]

Else If [Get(WindowMode) = 1]

Go to Layout [Get(LayoutName) & "_FIND")]

Enter Find Mode [Pause]

Go to Layout [Original Layout]

End If

This also worked. But here I ran into another issue. No matter what I do, I can't get the user to not have to press the return or enter key twice to perform the find. If Paused, when return is pressed, it does go back to the original layout, but then goes into Find Mode and waits for the additional click to perform the Find. If I put in a Perform Find [no dialog] step, it does the same thing.

So at that point I knew I was stuck...

EDITED: Well -- spoke too soon. Even the first part doesn't work. If all the fields are assigned at once as a button, the FMP copies *all* the contents to the clipboard. But it doesn't copy anything when you assign the button to one field.

Edited by Guest

When calling a script, you can pass a script parameter to it via a button or a master script etc. In your case, as Comment pointed out, you can name all of your fields with Object Names (new to FM8.5). So you can Pass the Object Name as the Script Parameter to your script. Just have the fields themselves be buttons and run the script with the parameters attached.

If [ Get (WindowMode) = 0 ]

Go to Object [Object Name: Get (ScriptParameter)]

Copy [ Select ]

Else If [ Get (WindowMode) = 1 ]

Go to Object [Object Name: Get (ScriptParameter)]

End If

  • Author

Ah, right-- I did see that. That looks like it'll do 'er :o

Thanks ;)

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.