Jump 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 "detect" scroll bars ?

Featured Replies

Hi All,

While in browse mode is there a way to detect if the active window (my layout) has visible scroll bars ?

After using the "Adjust Window - size to fit" script step...
I have a layout that is a list of items, depending on the number of records, this is likely to extend beyond the bottom of the layout window.
If that happens FM (or the computer OS) will show a vertical scroll bar - that bar will "eat up" layout space and force a bottom scroll bar because of the 16 px of the scroll bar.
I am wondering if there is a way to check for the presence of that vertical scroll bar to perform another "Adjust window" script step but this time add the scroll bar size to the layout width to get rid of the bottom scroll bar.

Thanks, D

Why don't you see how many records can fit into your window. Then it's a simple test of Get ( FoundCount ) > n.

----

Added:
Actually, there is even simpler way: look at the result of Get ( WindowContentWidth ). If there is no vertical scroll bar, it will return the width of your layout. If there is a scroll bar, it will show 15px (on macOS) less. 

This has the advantage of working independently of your monitor size as well as allowing for a layout with sub-summary parts.

 

Edited by comment

  • Author

Ooohhh, I like it.  Thank you !

Upon re-reading your question: 

If you do Adjust Window [ Resize to Fit ] while you have more records then will fit into the window, then the vertical scroll bar will be placed to the right of your layout width, the Get ( WindowContentWidth ) function will return the width of your layout and there will be no horizontal scroll bar.

What you describe can only happen if you add records to the found set after adjusting the window (when initially there was no need for a vertical scroll bar).

 

  • Author

I will play around and do more tests.  When I tried the resize to fit, the layouts go to the top of the screen and all the way to the bottom.
Basically trying to fit as many records as possible on the screen.  I am trying to figure out a way to resize to fit but keep the top of the window to where it was before going into the list layout. So if the user position the window where it's convenient for him I want to keep that position until he decides to move the window again for whatever reason.

All these things can be calculated using the appropriate Get() functions. 

 

  • Author

II have come up with calculated result that almost works for my needs. One hick-up is that when I use the "OnLayoutEnter" as I enter a new layout, it seems that my global variables are not updated right away but rather they have the values of the previous layout I was in.

So when to these Get functions trigger ?   WindowHeight, WindowWidth, ContentHeight, ContentWidth ?

I thought of putting them on an ExitLayout trigger but only works for WindowTop and WindowLeft - that allows me to position the next window wherever the user positioned the one he was in before switching to the new layout.

4 hours ago, DannA said:

when I use the "OnLayoutEnter" as I enter a new layout, it seems that my global variables are not updated right away but rather they have the values of the previous layout I was in.

I don't think so. A script triggered by an OnLayoutEnter event runs after the event:
https://help.claris.com/en/pro-help/#page/FMP_Help%2Fonlayoutenter.html%23

  • Author

Hmmm,  must be my logic that is wrong. I am on a PC, when I look at the pixel numbers I see 29px difference between window and content. From what I found searching here and there 12px would be a left/right window border, which leaves me 17px for the scroll bar.
I read that it should be 16 but I seem to get 17 on my machine. I have attached my LayoutEnterScript in case it is all wrong and I just don't see it anymore. I have hard coded the "default" layout size because they are all the same in what I am working on.

Thanks for the help.

OnLayoutEnter_getWindowSizes.pdf

Create an account or sign in to comment

Important Information

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

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.