Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

I have a main layout called Members.

On it, you can click a "setup" button to open a window that shows setup information.

I want to make sure that only ONE instance of SETUP is open. What is the best way to look at the open windows and see if there is one called "setup" all ready open?

Thanks

Ron

Posted

Curious, your "main layout" sounds as if it is a preference table. Why is it called "Members?"

Posted

Try

PatternCount ( WindowNames ( Get ( FileName ) ) ; "Setup" )

Thanks for the 'code'. I am storing it away.

I had the epiphany this morning that what I needed to do was set $$variable=$$variable+1 each time Setup was opened and then check if $$Variable was >1. If so, just open a custom dialog, close the window and set $$Variable=0.

Thanks again

Ron

Posted

This would be better:

not IsEmpty( FilterValues ( WindowNames ( Get ( FileName ) ) ; "Setup" ) )

Why do you need to ensure there is only one window open with that layout? Is this restriction for the local user or all users of a hosted solution?

Posted

Where would I put that code? If I put it in the module that calls the window, then the window closes and consequently never opens. My thinking was that if I use a $$variable to keep track of how many Setup windows are open I can insure that only 1 is open.

Because of the relationship of Setup to Members, the Setup portal does not allow me to directly add or delete records. Instead I have to open another window, specify an appropriate layout an add or delete a row in it to have the appropriate change show in the portal. When there is more than one instance of the Setup window open, I 'sometimes' (isn't that weird) get a FM message about how I need to 'Add a record...' In this case, I can't even edit anything in the portal. So, I limit Setup to one instance and don't (so far) have this problem.

Posted

Sounds like you're trying to solve the wrong problem: you need to fix the error message. Could be a relationship issue.

Forget all the variables and stuff, you are over-complicating things. A list of windows already exists and it's managed by FMP, it's in the WindowNames function. There is no need to create your own list of windows.

All you need to do is see whether a window with the name "Settings" already exists. If it does, select it and it will come to the front. If it does not exist then open one up.

That code would be used like this:

If [ not IsEmpty( FilterValues ( WindowNames ( Get ( FileName ) ) ; "Setup" ) ) ]

Select WIndow [ "Setup" ]

Else

<steps to open the Setup window>

End If

Posted

Sounds like you're trying to solve the wrong problem: you need to fix the error message. Could be a relationship issue.

Forget all the variables and stuff, you are over-complicating things. A list of windows already exists and it's managed by FMP, it's in the WindowNames function. There is no need to create your own list of windows.

All you need to do is see whether a window with the name "Settings" already exists. If it does, select it and it will come to the front. If it does not exist then open one up.

That code would be used like this:

If [ not IsEmpty( FilterValues ( WindowNames ( Get ( FileName ) ) ; "Setup" ) ) ]

Select WIndow [ "Setup" ]

Else

<steps to open the Setup window>

End If

"Ah, I see... Said the blind man as he picked up his hammer and saw."

Your solution looks to be both simple and efficient.

I got 'my' solution' to work but as you said it is unnecessarily complicated. I look forward to making the change.

Thank you for the instruction...

Grasshopper

Posted

Sounds like you're trying to solve the wrong problem: you need to fix the error message. Could be a relationship issue.

Forget all the variables and stuff, you are over-complicating things. A list of windows already exists and it's managed by FMP, it's in the WindowNames function. There is no need to create your own list of windows.

All you need to do is see whether a window with the name "Settings" already exists. If it does, select it and it will come to the front. If it does not exist then open one up.

That code would be used like this:

If [ not IsEmpty( FilterValues ( WindowNames ( Get ( FileName ) ) ; "Setup" ) ) ]

Select WIndow [ "Setup" ]

Else

<steps to open the Setup window>

End If

I just want you know how much I appreciate your code. So far I have used to 3 times to see if the proper window/layout is open. It has resulted in a *lot* of inefficient code (the way I used to do it) being thrown out. Your reply and the code has been a real eye opener and time saver. Thanks again.

Ron

Posted

There is no simple way to test weather a "layout" is open, because layouts don't really open. They get displayed in windows, and the layout that the window displays can be changed.

If you definitively wanted to know when a layout was ever displayed you could set up a an object on the layout with conditional formatting that sets a global variable to a value. When the layout is displayed it will set the global variable, so a test for the variable will show whether the layout has been displayed.

This topic is 4648 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.