Jump to content

How to find Mode


This topic is 5761 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

This topic is 5761 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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