Solved

how to show scrollbars for MDI child form

Posted on 1998-04-27
6
821 Views
Last Modified: 2008-02-01
I have a MDI application with MDI child screens.

When I open MDI child screens in the App, I donot get vertical and horizantal scroll bars for child forms (making it look ugly, and hide several control in the form).

For example, when you open a doc. in WORD you get vert. & horiz. scrollbars for the document view automatically.

Though this is farily simple one, but I do not know how to do it (and also documentation is unhelpful).

Thanks for your answer,

D.Venkatesan Pillai
Senior Software Engineer
dvenkat@iptcorp.com or (dvenkat68@hotmail.com)
0
Comment
Question by:dvenkat
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:clifABB
ID: 1431269
If you are talking about the scroll bars on the parent form, they should appear automatically when needed.

If you are talking about each child forms scroll bars, you have to add them yourself using VScrollBar & HScrollBar.
0
 

Accepted Solution

by:
clsmaster earned 30 total points
ID: 1431270
It's actually a bit harder than you would think.  Scrollbars do not automatically appear on forms (only on the MDI parent for).  What you can do is place a vertical scrollbar on the form and position it on the right side of the screen.  You can do the same if you need a horizontal scroll bar.
After that set the max property to the hight of the form and the min property to 0.  Name the scrollbar vScroll
Then set the tag property of the control to the top property on the control
Then in the code use the following:

sub vScroll_Change()
  vScroll_Scroll
end sub

sub vScroll_Scroll
  dim ctl as object

  on local error resume next
  for each ctl in Form1
    ctl.top = ctl.tag - scroll.value
  next
end sub

This will scroll each control on the form when the scrollbars are used.  A few notes:
1.  Set the Tabstop property of the scrollbar to False
2.  You must used the on local error resume next line because some controls namely menues will cause an error when this above code is used.  This line cause it to skip theses controls.
0
 

Author Comment

by:dvenkat
ID: 1431271
The problem still persists. The scrollbars also go hiding!

The issue is I paint the form at a size greater than the normal display size. (I expect the VB to automatically show a Scrool bar in this case, and evidently it does not).

Your code will not work in this case, because the scroll bar lie at a screen co-ordinate beyond normal display window size.

So please suggest me someother method or correct if I am wrong or misunderstood you.

Thanks

0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 6

Expert Comment

by:clifABB
ID: 1431272
I will assume you are talking about scrollbars you have added to a child form.  In the form resize event of the child form add this code:
Private Sub Form_Resize()

  HScroll1.Move 0, Me.ScaleHeight - HScroll1.Height, Me.ScaleWidth - VScroll1.Width, HScroll1.Height

  VScroll1.Move Me.ScaleWidth - VScroll1.Width, 0, VScroll1.Width, Me.ScaleHeight - HScroll1.Height

  HScroll1.ZOrder
  VScroll1.ZOrder
End Sub

This will keep your scrollbars visible and aligned to the bottom and right edges of the form.
0
 

Author Comment

by:dvenkat
ID: 1431273
Thanks "clifABB" and "clsmaster". It works!


0
 
LVL 6

Expert Comment

by:clifABB
ID: 1431274
Glad to be of service.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

757 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

19 Experts available now in Live!

Get 1:1 Help Now