"Freeze Panes" in Form view (1 Viewer)

CJ_London

Super Moderator
Staff member
Local time
Today, 05:43
Joined
Feb 19, 2013
Messages
16,629
That is pretty neat:). And overall, really easy to follow

I've been playing around with freezing using the standard scrollbar and getscrollinfo api - but there is too much flicker. My purpose is slightly different which is to keep a control top right (or left) of the window of a horizontally scrollable form - similar to the window controlbox. I can see the issue - the 'normal' scrollbar scrolls a pixel at a time rather than a column at a time
 

isladogs

MVP / VIP
Local time
Today, 05:43
Joined
Jan 14, 2017
Messages
18,246
Thanks
There is no flicker using this approach (and no APIs). The only non-standard feature is the use of an ActiveX scrollbar for horizontal scrolling
One advantage of the ActiveX scrollbar is that you can set the size of movement (small change/large change)
 

CJ_London

Super Moderator
Staff member
Local time
Today, 05:43
Joined
Feb 19, 2013
Messages
16,629
Agree - just not keen on the flashing thumb🙂
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:43
Joined
May 7, 2009
Messages
19,247
it's not working like in datasheet view where you an use TAB/BackTab key to goto next column.
 

isladogs

MVP / VIP
Local time
Today, 05:43
Joined
Jan 14, 2017
Messages
18,246
it's not working like in datasheet view where you an use TAB/BackTab key to goto next column.
Of course it isn't - its a continuous form - not a datasheet

Labels cannot get focus and aren't part of the tab order
Clicking on a control (not the header label) and using the tab/back tab key goes to the next/previous column

You could use transparent buttons instead of labels for headers but you'd still need to 'tie' the buttons and field controls.
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:43
Joined
May 7, 2009
Messages
19,247
Of course it isn't - its a continuous form - not a datasheet
of course it continuous!!! so where is the freezing you are talking about?
on the scrollbar only?:rolleyes:
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:43
Joined
May 7, 2009
Messages
19,247
so i am correct, it is only freeze using the ActiveX scrollbar.
using Tab key does not freeze it, so it is half baked.
Application should be robust.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 05:43
Joined
Feb 19, 2013
Messages
16,629
With respect @arnelgp Colin's example is just that, an example. I don't believe it is intended as a fully working, ready to go exact duplicate of a datasheet. But if you wanted to 'freeze on tab', it is relatively easy to do so, but ultimately depends on the user requirements. Adding the following code will retain the viewable columns when going to the next record when tabbing, unlike a datasheet which will return you to the first unfrozen column when to tab of the last frozen one. For some this would be seen as an improvement over the way a datasheet works, for others they want the same functionality as a datasheet.

add this code to the form module

Code:
Function tabScroll()

    With Screen.ActiveControl
    
        If .Left + .Width >= InsideWidth Then
        
            MainScrollBar.Value = MainScrollBar.Value + 1
            MainScrollBar_Updated (MainScrollBar.Value)

        End If
        
    End With

End Function

and for each control in the detail section, add =tabScroll() to the gotfocus event (instead of [Event Procedure])

Another variation would be to lock the frozen columns so they cannot be selected, so tabbing only works on the unfrozen columns - again, not datasheet functionality, but some would find it useful
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:43
Joined
May 7, 2009
Messages
19,247
not datasheet functionality, but some would find it useful
i would rather wait for ms to do it since they have the "deep" knowledge and the creator of such.
 

isladogs

MVP / VIP
Local time
Today, 05:43
Joined
Jan 14, 2017
Messages
18,246
As @CJ_London said earlier this was intended as a way of replicating some of the functionality of datasheet forms in a continuous form.
It does exactly what was described in the linked article and is totally robust in doing exactly what it was intended to do.

However, as I rarely navigate forms using the tab key, I didn't think to include functionality to handle frozen columns on tabbing.
That certainly doesn't make it 'half baked' as @arnelgp suggests.

However adding that functionality doesn't appear to be too difficult
I already have a solution for scrolling using the tab key (similar to the suggestion in post #29) and am now working on Shift+Tab.
I will publish an updated version when that is done.

As always, I'm extremely grateful to @arnelgp for his highly constructive feedback to help improve my example apps!
What would I do without your support ...? 🙄
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:43
Joined
May 7, 2009
Messages
19,247
As always, I'm extremely grateful to @arnelgp for his highly constructive feedback to help improve my example apps!
What would I do without your support ...? 🙄
there is always that balance in nature.
even in politics they call them minority and majority.
good and evil.
negative and positive.
each holding each other.
if all are the same, there is imbalance is created and will collapse.
 

isladogs

MVP / VIP
Local time
Today, 05:43
Joined
Jan 14, 2017
Messages
18,246
Following the recent prompt about tab navigation, I've just uploaded an updated version (2.9) of my example app to my website:


In addition to the ActiveX scrollbar, this version allows you to navigate using the Tab / Shift+Tab keys whilst keeping the frozen columns fixed in position. It also supports use of the Up/Down & Left keys

ShiftTabScroll2.png

As before the number of frozen columns can be specified & optionally locked. The form can be filtered and sorted

8FrozenFilteredSortedScrolled.png

No APIs are used so it will work in in all versions from A2010 through to A365 (both 32-bit & 64-bit)

Overall it now closely replicates the functionality of the freeze fields feature in datasheets whilst adding extra features
 

Attachments

  • FreezeColumns_v2.9.zip
    163.8 KB · Views: 19

Users who are viewing this thread

Top Bottom