Form Jumps On Tab Click (1 Viewer)

Friday

Registered User.
Local time
Today, 18:27
Joined
Apr 11, 2003
Messages
542
Searched for this and couldn't find the right thread (it's probably out there somewhere). Form with 2 tabbed controls on it. Each tab has a subform on it. When the user clicks on the first tab, the entire form jumps down to the first tab stop (field) on the subform1, hiding the top 1/4 of the form. Now the user has to scroll up to find the tabs so the second tab can be clicked. And, again, it jumps down to the first tab stop on the subform2. Can this be avoided?
 
B

Bob_Langley

Guest
Friday said:
Searched for this and couldn't find the right thread (it's probably out there somewhere). Form with 2 tabbed controls on it. Each tab has a subform on it. When the user clicks on the first tab, the entire form jumps down to the first tab stop (field) on the subform1, hiding the top 1/4 of the form. Now the user has to scroll up to find the tabs so the second tab can be clicked. And, again, it jumps down to the first tab stop on the subform2. Can this be avoided?
I have a similar problem when the Form opens. The Form header is visible as is most of the form but the tab captions are not. The user has to scroll up by about 1" to reveal the tabs.
 
J

JohnEC

Guest
Similar situation III

Bob_Langley said:
I have a similar problem when the Form opens. The Form header is visible as is most of the form but the tab captions are not. The user has to scroll up by about 1" to reveal the tabs.


Me too. Any guesses?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:27
Joined
Feb 19, 2002
Messages
43,201
You need to resize the controls that hold the subforms so they're bigger.
 
J

JohnEC

Guest
Resizing controls doesn't do the trick

Pat Hartman said:
You need to resize the controls that hold the subforms so they're bigger.

Resizing controls doesn't do the trick
 
D

daisyage

Guest
count me in!

i am having the same problem. i created a form with 7 pages. 5 of the pages have subforms. when i click on a page with a subform, the main form jumps down and hides the page controls. if anyone has done this troubleshooting before, please share the joy! i've tried 'GotoControl' and 'GotoPage' it works on some pages and not others.
thanks for any help!!!
 

WindSailor

Registered User.
Local time
Today, 10:27
Joined
Oct 29, 2003
Messages
239
The only time I have seen this happen is when the mainform and/or subforms have been actually designed on a display setting, and then viewed on a different display setting other than what they were designed for, or... if every thing is sized correctly go back into design mode and move the bottom dimensions of your form and/or subform(s) up or down to correct this.
Thats about all I know on this subject. Hope it helps.
 
Last edited:
D

daisyage

Guest
one solution

i used the MoveSize macro for the subform and form and set it to move down on enter. may not be the best solution, but it worked! :D
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:27
Joined
Feb 19, 2002
Messages
43,201
Sizing the subform and tab control properly would also have worked :)
 

green

Registered User
Local time
Today, 10:27
Joined
Dec 23, 2009
Messages
20
Pat - I have tried your recommendation. I created a test form and added it as a subform to one of my tabs and it works correctly. But I can't figure out how to re-size either my original subform or tab control so that they play nice together. Thanks.
 

missinglinq

AWF VIP
Local time
Today, 13:27
Joined
Jun 20, 2003
Messages
6,423
This problem is usually the result of two things, the first being that the Form and/or Tabbed Control are/is too long to be completely displayed without scrolling. As Pat said, they need to be resized so that scrolling them is never needed.

The second part of the problem is usually what Control on the Tabbed Page receives Focus when the Tabbed Page is first clicked on. The Control first receiving Focus is low enough that the Form has to be scrolled to display it. This can be remedied by forcing Focus to a Control at the top of the Tabbed Page, but if the Form is sized so as to never need scrolling, the problem wouldn't exist.

Preventing the need to require the user to scroll a Form in order to access all Controls is one of the two reasons for having Tabbed Controls. The second reason is to allow for the logical grouping of Controls within the Form.

Linq ;0)>
 

green

Registered User
Local time
Today, 10:27
Joined
Dec 23, 2009
Messages
20
Thanks, Linq! I didn't make the connection between the subform being long and the auto-scroll. In my project the best arrangment is to leave the subform long with scrolling. (I am using tabs to group data by applicable subject matter.) I have verified my field tab order is correct. How can I tell how which contol is otherwise getting focus first? Secondly, do I use an On Open function to assign focus to the control I want instead of the system assigned focus?
 

green

Registered User
Local time
Today, 10:27
Joined
Dec 23, 2009
Messages
20
I was able to resolve the issue by resizing the tab control to fit within the screen size and limit the subform to the size of the tab contol. Now the subform has a scroll bar but the subform doesn't auto-scroll.
 

missinglinq

AWF VIP
Local time
Today, 13:27
Joined
Jun 20, 2003
Messages
6,423
Glad you got it fixed, Idaho! Scrolling a Subform is perfectly acceptable, but having to scroll the Main Form, in order to view all of the Controls, is considered, by most experienced developers, to be one of the most user-unfriendly things you can do!
BTW, using Tabbed Controls to logically group data is a great approach! So many people, both newbies and some not-so-newbies, only think of using them when Subforms are needed. And the great thing, of course, when putting Controls directly on a Tabbed Page, is that it's referenced the same as it would be if simply added directly on the Form's main detail area.

Linq ;0)>
 

Clicky

New member
Local time
Today, 10:27
Joined
Jul 12, 2018
Messages
4
I've been scouring the internet for a solution to this and realized there are a number of ways of fixing. But even if you resize the subforms/tab forms to ensure everything fits on one page, it may look fine on a regular computer screen, but the window may still jump down when it's a laptop screen.

This may be posted somewhere, but I figured out a solution that worked for me.
- I created buttons over each tab (no caption and no background color so they look hidden).
- In the OnClick event for those buttons, I set the focus to the tabbed subform and then set the focus to a control at the top of the main form.
- And then it worked! When clicking on the button over the tab, the focus is set on the tabbed subform, and then the main form is forced to scroll back up to the top to set its focus on a field near the top.
- I then noticed there was a bit of flickering when the form would set its focus on one field and then quickly to another. I found on the forums somewhere about the echo function and that made it flicker less. Below is the code that worked for my situation.

'These are for invisible buttons on each tab to ensure the screen won't jump down. Otherwise, on laptop/small screens, clicking the tab may make the screen jump down, hiding the top portion of the form
Private Sub btnTabA_Click()
Application.Echo False
Me.TabAForm.SetFocus
Me.FieldatTopofMainForm.SetFocus
Application.Echo True
End Sub


 
Last edited:

missinglinq

AWF VIP
Local time
Today, 13:27
Joined
Jun 20, 2003
Messages
6,423
...even if you resize the subforms/tab forms to ensure everything fits on one page, it may look fine on a regular computer screen, but the window may still jump down when it's a laptop screen...

FYI...This has nothing to do with whether you're on a 'regular computer' or on a 'laptop'...i.e. whether you're on a large screen or a small screen...the behavior is caused by different screen resolutions on the two machines!

Because of this, the same problem could crop up between two or more 'regular' computers, if their screen resolutions were different...a problem often encountered in corporate environments.

There are hacks out there that address the problem of distributing an app among PCs of different screen resolutions.

Linq ;0)>
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 18:27
Joined
Sep 12, 2006
Messages
15,634
Similar thoughts to missingling above

you can set controls as non tab-stop, and set the tab order.

However, if you tab to a control off the page, then I can't see how you can prevent the form being forced to redraw.

Is it possible to redesign the from so that the controls are shown in a different way - maybe group associated controls on a tabbed control (different from pressing the "tabs" key) - so that the whole form can be displayed on the screen.

With regard to the display resolution, I desgin for a standard resolution - say 1024 x 768, and at startup, I check the resolution and warn users if their resolution is lower than this.

Although you can repostion and resize controls to fit any screen res, it's a big job, and it may not be acceptable for some forms if users use something like 800x600

If they do use a smaller res, then you need to ensure you include scroll bars where appropriate.

api calls to get the screen res are
GetSystemMetrics(SM_CXSCREEN)
GetSystemMetrics(SM_CYSCREEN)
 

Users who are viewing this thread

Top Bottom