Jump to content
Sign in to follow this  
sandyinlet

Scripted hiding of layout objects

Recommended Posts

Is it possible to conditionally hide or reveal fields, labels and rectangles on a layout in FMP10?

I'd like to place three or four elements on top of each other at the same co-ordinates. They would reveal or hide themselves depending on the current user's activities.

Possible? Feedback much appreciated.

Share this post


Link to post
Share on other sites

Labels, yes. Just creates a calculation which produces the text you want, or nothing, depending on conditions. Rectangles, well that depends whether you mean a plain layout object, in which case, yes, you can create a calculation that produces them. The rectangles themselves would be stored in container fields somewhere.

If by "fields," you mean "the value of fields," then yes, same as labels. But if you mean "enterable fields," that's much more difficult. Calculations are simply not enterable, so that's out. You also cannot stack the fields, because only one will be enterable, and this is a Layout mode setting, which you cannot change on the fly.

This could be simulated in FileMaker 10, by using a global field on the layout. An OnObjectExit script trigger could run a script to take the value and put it into one of the "real" fields. But the global would not behave the same as other fields, say in Find mode,* and would be gone once you closed the file, in a network environment. I suppose it could be captured on shutdown, and repopulated on startup.

The normal "visibilty" trick, using a relationship, would not work for this, because 2 portals cannot occupy the same space, and only one field can be the target. It's useful for making something either appear or disappear, but not for toggling enterable fields within the same space.

There may be some other trick, but that's what comes off the top of my head; admittedly pre-coffee however.

*Actually the script trigger could also run in Find mode. But how would you know which to use, as whatever values determined which would likely not be available in Find mode?

Edited by Guest

Share this post


Link to post
Share on other sites

If only one of elements needs to be visible at any time, then a tab control object might be a good choice. It really depends on what "depending on the current user's activities" means.

Share this post


Link to post
Share on other sites

Another idea. Use a Tab object for the fields, just larger than the fields, invisible line and fill, 0-width tabs, named as objects. A script would have to go to the correct tab. It would have to be triggered by some other enterable field. Or possibly determined by an unstored calculation, such as Get ( PrivilegeSetName ), etc., and triggered by an OnLayoutLoad script trigger. Unfortunately we do not have "default tab by calculation" (yet).

Share this post


Link to post
Share on other sites

Labels, yes. Just creates a calculation which produces the text you want, or nothing, depending on conditions. Rectangles, well that depends whether you mean a plain layout object, in which case, yes, you can create a calculation that produces them. The rectangles themselves would be stored in container fields somewhere.

If by "fields," you mean "the value of fields," then yes, same as labels. But if you mean "enterable fields," that's much more difficult. Calculations are simply not enterable, so that's out. You also cannot stack the fields, because only one will be enterable, and this is a Layout mode setting, which you cannot change on the fly.

This could be simulated in FileMaker 10, by using a global field on the layout. An OnObjectExit script trigger could run a script to take the value and put it into one of the "real" fields. But the global would not behave the same as other fields, say in Find mode,* and would be gone once you closed the file, in a network environment. I suppose it could be captured on shutdown, and repopulated on startup.

The normal "visibilty" trick, using a relationship, would not work for this, because 2 portals cannot occupy the same space, and only one field can be the target. It's useful for making something either appear or disappear, but not for toggling enterable fields within the same space.

There may be some other trick, but that's what comes off the top of my head; admittedly pre-coffee however.

*Actually the script trigger could also run in Find mode. But how would you know which to use, as whatever values determined which would likely not be available in Find mode?

Very helpful. Let me be more explicit. Two of the objects — the label and the rectangle can stay in all circumstances. It's the third one, the field, which is a possible problem.

The field is a global, it has a trigger activated on field contents changing. The field is also a value list popup from which the user can only select the appropriate contents, never change the contents of the field otherwise. When they make their choice they are activating one or another of a series of scripts.

The reason I want hiding and revealing popups is because the available script options presented should change according to the user's current context.

And as I'm typing this I'm realizing a possible solution. Make the contents of the value list itself conditional. Haven't tested it yet, but I suspect that might work.

Am I on the right track?

Nope, at least my initial tests resulted in an indexing issue.

Edited by Guest
Added results of recent test

Share this post


Link to post
Share on other sites

As Michael and Fenton both pointed out, you could try using hidden tabs. Each object can be on a tab and the script trigger can load whichever tab that you need to display at the time.

Share this post


Link to post
Share on other sites

Making the choices in the value list change depending on conditions that change its relationship's originating key field is certainly possible. I don't know what problems you ran into. Possibly you were trying to point the relationship to an unstored field. We cannot solve your problem without more specifics on the data and structure.

Share this post


Link to post
Share on other sites

As Michael and Fenton both pointed out, you could try using hidden tabs. Each object can be on a tab and the script trigger can load whichever tab that you need to display at the time.

Hi

I'm new to FM (using FM 11 Adv) and want to do a similar thing ie hide fields when using IWP. You mentioned hidden tabs but I haven't been able to find anything on how to use these.

I'm after:

- how to set up hidden tabs

- how to control them in scripts

Thanks

Laurence

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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