Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

This is strange and frustrating:

I have a drop down list displaying ALL layout names. This drop down list is on all layouts. When a User selects a layout name from the drop down to navigate to it - it fires a script trigger that takes them to the layout.

This seems to work except on some layouts it takes you to - a tab order object obtains focus. I have not been able to find a reason why it does so on some layouts - and not others.

The behavior from the result of my script is different than just a straight "Go to Layout" button, or even a script defined to go to layout. It appears only to happen with the script I created.

There are steps in the script that I had to include to get the interface and behavior to display correctly - such as clearing the value after a layout was selected.

Screen shot of script attached.

Any ideas?

go_to_layout_variable.png

Posted

I don't know why you're seeing the behavior, but you should be at least using a global field for the layout selection. Then you only need a Set Field[], not a Replace Field Contents[] which can slow things down.

Or you could just use FileMaker's built in Layout selection tool.

Posted

Thanks Dan - I tried the debugger and did not see anything that would shed light on the focus.

Hey DJ,

Thanks for lending a hand. Changed the field to a global - same result. I have a feeling I have set this up differently (and perhaps more convoluted) than what you would have done.

Here is what I did to create this Layout Navigation widget:

1. Created table to hold "system" wide fields;

2. In "system" table, created calculation field to return a list of all layouts in file - defined as: LayoutNames ( Get ( FileName ) );

3. Created value list to display result of calc. field in #2 above;

4. Created field called: "layout_selector" and attached #3 to field

5. Created script as shown in first post, used as script trigger on #4 above;

6. Placed this on each layout;

7. "System" table is connect via "x" join to a table that is related to other tables.

Is there an easier way? I would rather use the LayoutID instead of the LayoutNames - but too much for me to comprehend "how".

What I have works - except for the "focus" issue. The focus occurs after the script runs - as shown in the script debugger. Nowhere during the script steps does the focus take place - only AFTER exit / completion of script. This is not to say I think this is the best way - I was just trying to figure out how to have drop down navigation. I hide the status/toolbar from the User so I can not use the native layout selector.

There is one other side effect that I thought I would be able to overcome - but I haven't. If I add a layout and then delete it - it still shows in the drop down list. I thought exiting the file and reopening it would refresh the list - but no go. The calc field is Indexed - so that must be why the old values remain. I tried an unstored calc - but the value list displays nothing. So I guess I need a way for a calc field to evaluate all layout names in a file and display those values. I imagine this is why the global field is being recommended - just do not see how it would work.

I am all ears if you could try to explain the "global" and set field method you eluded to in your reply. I searched here on the forum and could not find any thread on the topic.

Thanks in advanced

Posted

The 'Replace Field Contents' step is for changing data in ALL records in the found set, 'Set Field' only changes data for the current record. If you use a 'system' table with 1 record (which is a common thing to do), then you only need to use 'Set Field' (in the example script you posted). I doubt that will solve your problem though...

Since your goal here is to create a way to navigate your database, I'll comment on that and not so much on all the specific questions.

If you want to get some ideas on what types of navigation methods you can use, you could search the internet for sample or trial databases to see how others do it. One common method is buttons on the top of the layout. I like building multi-window based systems, so I use a custom menu called "Navigation" to open new windows to different sections of the database, and tabs in the windows to access all the areas of that section.

For me, I often have layouts that I would not want the user to be able to access directly (those used only by scripts, for example); therefor I would not want to create a navigation system which gives the user access to all layouts.

The bottom line is that you have to decide the best way to navigate your database. If you like the idea of a drop-down list; I would suggest creating a custom value list with only the names of the layouts you want users to access in it. When you add a layout, you would need to manually add the layout to this list if you want users to access it directly.

Posted

Thank Dan and DJ,

Dan, I appreciate the explanation. I replaced the script step to a "set field" and used a global field. As both of you suspected, it does not resolve the issue.

As for navigation methods, I too have used buttons on layouts and explicitly controlled navigation in this fashion. I wanted to explore how I can implement a drop-down navigation as well.

Your suggestion of the Custom value list would work - I would just have to maintain it. I was exploring how to make the navigation functional automatically. Ideally, it would be nice to make it automatic - and display based on privilege to address who should see what.

If anyone has any idea why at the conclusion of the script the User ends up on a layout with an object as the focus, I'd appreciate the insight.

Thanks

This topic is 5106 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
×
×
  • Create New...

Important Information

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