Solved

Random Disappearing Scrollbars on a MDI Child form

Posted on 2001-09-14
3
552 Views
Last Modified: 2012-06-27
We have an MDI document in VB6 with a main menubar on the side and a bunch of kiddie forms that appear in the MDI when items on the menubar are clicked.  Most of the child forms are forms with embedded Excel-like spreadsheets (to be more precise they are Formula One ActiveX spreadsheets).

The child forms are all loaded when the application starts up and are hidden until they are needed.  When the user clicks a menu item, the appropriate form is brought up and the data loaded into it.

THE PROBLEM
In most cases, the child form is larger than the available space in the MDI form - hence, logicially, scrollbars should appear so you can view the entire child form. half the time, the scrollbars are there and everything is good.   At completely random times, when the child form is loaded, the scrollbars will be completely absent.  You can still view the whole child form by using the arrow keys and moving from cell to cell on the spreadsheet but you can't scroll.

The ONLY way you can get the scrollbars back when this happens is to resize the form (whether it be minimizing then restoring, maximizing then restoring, or simply manually resizing the form with the mouse).  Once you do this, the scrollbars will appear.

Through trial and error, we're pretty confident that it's a MDI problem and has nothing to do with the spreadsheet itself (because resizing the MDI corrects the problem).  We've tried forcing the scrollbars on in just about every MDI event possible.  Refreshing everything  does nothing...

We've even tried workarounds including changing the size of the form through code as in the example below:

        mdiMain.Height = mdiMain.Height * 0.1
        mdiMain.Height = mdiMain.Height / 0.1

Which works except when the form is maximized (in which case you can't alter the .height property).

We've tried the following as well( where frmWorkbook is the child form):

        frmWorkbook.Height = frmWorkbook.Height * 0.1
        frmWorkbook.Height = frmWorkbook.Height / 0.1

and it works when it's maximized except sometimes you get double scrollbars appearing - one set on the child form and the other set on the MDI frame.  We've even gone as far as hiding the form, maximizing the form and normalizing the form, then making the form visible again.  This doesn't work if the form is hidden - works if it's visible but obviously it's not pretty to look at.

We can't be the only ones suffering from this!!  Thanks in advance.
0
Comment
Question by:ripnasty
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
glass_cookie earned 100 total points
Comment Utility
Hi!

Haven't really got such a problem, but how about resizing the MDI form by a little bit instead, rather than minimising the maximising/restoring it or hiding then show it?

Do something like:

SomeForm.Height = Someform.Height + 10

or

SomeForm.Height = Someform.Height - 10

THen, instead for allowing the form to be maximised, you simply set the form's height and width to the screen's height and width.  Something like this:

SomeForm.Move 0, 0, Screen.Height, Screen.Width

From there, you could add the form's height and width by a little to cause the bars to appear.  The only problem is that you'll have to store the original height, wifth, left, top values of the form.  You'll also have to program it to check the height and width to determine whether the form is restored or maximised.

Sorry is the values are wrong as I can't really remember the parameters.

That's it!

glass cookie : )
0
 
LVL 1

Author Comment

by:ripnasty
Comment Utility
We had already tried the suggestions that you made - modifying the form always worked when the form wasn't maximized but would never work when it was maximized.

The form.move was an idea but unfortunately, our users like toggling between maximize and the form's usual size and applying the form.move idea takes away this option (most of our users wouldn't know that you can resize a window by using the mouse!!)

I did find a solution that worked:
   
    If Not WindowState = vbMaximized Then
        mdiMain.Height = mdiMain.Height * 0.1
        mdiMain.Height = mdiMain.Height / 0.1
    Else
        frmWorkbook.Height = mdiMain.Height * 0.1
        frmWorkbook.Height = mdiMain.Height / 0.1
    End If

where mdiMain is the MDI form and frmWorkbook is the child form.

glass_cookie's suggestion wasn't the answer but for whatever reason, it got me thinking about a new approach so what the hell - give 'em the points!!!  :-)
0
 
LVL 8

Expert Comment

by:glass_cookie
Comment Utility
Thanks for the points : )
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now