AnsweredAssumed Answered

Column Lock (Row Lock)

Question asked by eric on Jun 19, 2018

Some one had this question on Facebook:

In Excel there is possible to lock one or more columns to the left so that you can scroll sidewise but still see the first columns. I have tried to figure out if that could be done in FileMaker but I have not found any solution for that.

FileMaker Discussions Public Group | Facebook

 

I have the following solution as a button script using a floating document window:

 

Scripts for Buttons: Lock Column

 

If [ Get ( WindowName ) = "Locked" ]

Close Window [ Current Window ]
Exit Script [ Result: "Column Unlocked" ]

End If

 

If [ IsEmpty ( Get ( ActiveFieldName ) ) ]

Go to Next Field

End If


Set Variable
[ $fullFieldName; Value:Get(ActiveFieldTableName) & "::" & Get(ActiveFieldName) ]

Set Variable [ $bounds; Value:FieldBounds( Get(FileName); Get(LayoutName); $fullFieldName ) ]

Set Variable [ $fieldWidth; Value:MiddleWords ( $bounds ; 3 ; 1 ) - LeftWords ( $bounds ; 1 ) ]

Set Variable [ $newWindowWidth; Value:$fieldWidth + 36 ]

 

New Window [ Style: Floating Document; Name: "Locked"; Using layout: <Current Layout>; Width: $fieldWidth + 36; Left: Get
( WindowLeft ) - 16; Close: Yes; Minimize: Yes; Maximize: Yes; Resize: Yes; Menu Bar: Yes; Dim parent window: No; Toolbars: Yes ]

 

Same as the video in a reply below. Couldn't embed video when creating question, only while editing later.

 

Of course the problem after locking the column is matching the vertical scrolling, unless I add my own buttons for scrolling. Perhaps the advantage of this method is it's very portable; just add the button to any layout.

This could have been more flexible if there were a way to uniquely identify the current field and go to it on a layout:

https://community.filemaker.com/ideas/1859#comment-36295

Thus the following If statement was meant to help accommodate something like that if it existed:

If [ IsEmpty ( Get ( ActiveFieldName ) ) ]

Go to Next Field

End If

 

The same floating document method could also be used for to lock a row, and in that case easily lock any row you want (but again a slight problem if there is horizontal scrolling this time).

 

 

Posing this as a question in case there is a better answer.

Outcomes