Results 1 to 28 of 28

Thread: Scrollable forms

  1. #1

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Scrollable forms

    Hi

    I did a search on the forum on how to create a scrollable form - but the results were not very helpful.....Please can anyone help me................How do I create a scrollable form?

    Thanks in advance


  2. #2
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535
    What exactly are you up to ?

  3. #3

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721
    Originally posted by kinjalgp
    What exactly are you up to ?
    kinhalgp

    I have created a form which contain a number of command buttons - these command buttons are within a frame.....a user cannot see all the available buttons unless they actually scroll up/down...

    Hope I have mad myself clear enough.........

    Holly

  4. #4

  5. #5

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Re: Try here

    Originally posted by Briantcva
    vbaccelerator.com/codelib/ssubtmr/sbrclass.htm
    Thanks Briantcva - I will have a look

    Holly

  6. #6
    Member
    Join Date
    Aug 2002
    Posts
    33

    Nice One

    Nice class, just what I wanted

  7. #7
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Thumbs up Hmm...

    Does it work in ur PC...???

    does't work at my PC...!!!

    I think I need a DLL as it says up there...

    Can u help me out...

  8. #8

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Re: Nice One

    Originally posted by CADMANdo
    Nice class, just what I wanted
    Have you managed to get the class to work. I cannot get it to work.

    holly

  9. #9
    Fanatic Member
    Join Date
    May 2002
    Posts
    746

    Also...

    The subclassing method is good but you need to expend some effort to make it work. Unfortunately, I don't remember what machinations I went through. Make sure you d/l and register the correct .dll (there are vb5 and 6 versions). The dll works great for resizing entire forms, but like I said - requires some work. I've also had sporadic issues w/ it when installing on win95 boxes.

    Depending on what you're doing, the attached file (scrollbox.zip) may work better for you. (I did not write this control and I can't find where I got it from - so my apologies to the author). I tend to use it to create a scrollable "viewport" on a form - where it works great. In my experience though, it doesn't work too well when used to fill an entire form - scrolls fine but there are some graphics issues which I didn't like on Form_Resize.
    Attached Files Attached Files

  10. #10

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Re: Also...

    Originally posted by Briantcva
    The subclassing method is good but you need to expend some effort to make it work. Unfortunately, I don't remember what machinations I went through. Make sure you d/l and register the correct .dll (there are vb5 and 6 versions). The dll works great for resizing entire forms, but like I said - requires some work. I've also had sporadic issues w/ it when installing on win95 boxes.

    Depending on what you're doing, the attached file (scrollbox.zip) may work better for you. (I did not write this control and I can't find where I got it from - so my apologies to the author). I tend to use it to create a scrollable "viewport" on a form - where it works great. In my experience though, it doesn't work too well when used to fill an entire form - scrolls fine but there are some graphics issues which I didn't like on Form_Resize.
    Briantcva

    Maybe I am doing something wrong...when I try to load your *.ocx file...I am receiving an error " file cannot be loaded" am I doing something wrong...

    Thanks for all your help

    Holly

  11. #11
    Fanatic Member
    Join Date
    May 2002
    Posts
    746
    Did you register the ocx before loading?

  12. #12

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721
    Originally posted by Briantcva
    Did you register the ocx before loading?
    Oh dear, am I thick or what???????

  13. #13

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721
    Hi everyone

    Briantcva was kind enough to zip me an *.ocx file so I would be able to scroll my forms. I have referenced the OCX file but as I'm new to VB.....I'm stuck. How do I use this OCX file and its properties?

    Thanks in advance

    Holly

  14. #14

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721
    Originally posted by holly
    Hi everyone

    Briantcva was kind enough to zip me an *.ocx file so I would be able to scroll my forms. I have referenced the OCX file but as I'm new to VB.....I'm stuck. How do I use this OCX file and its properties?

    Thanks in advance

    Holly
    Sorry I have answered my own question!!!!!!

    Thanks

  15. #15

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Thumbs up Scrollable forms - Thanks Briantcva

    Thanks Briantcva - Your *.OCX file works a treat.

    Thanks again for all your help
    Holly


    Last edited by holly; Sep 18th, 2002 at 02:46 AM.

  16. #16
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Re: Also...

    Originally posted by Briantcva
    The subclassing method is good but you need to expend some effort to make it work. Unfortunately, I don't remember what machinations I went through. Make sure you d/l and register the correct .dll (there are vb5 and 6 versions). The dll works great for resizing entire forms, but like I said - requires some work. I've also had sporadic issues w/ it when installing on win95 boxes.

    Depending on what you're doing, the attached file (scrollbox.zip) may work better for you. (I did not write this control and I can't find where I got it from - so my apologies to the author). I tend to use it to create a scrollable "viewport" on a form - where it works great. In my experience though, it doesn't work too well when used to fill an entire form - scrolls fine but there are some graphics issues which I didn't like on Form_Resize.
    I this is a great ocx...but can I do something with it as it chnages it height and width according to form resize...

    Can u show me some example where u have used this...???

    Cheers...

  17. #17
    Fanatic Member
    Join Date
    May 2002
    Posts
    746

    Re: Re: Also...

    Originally posted by wrack
    I this is a great ocx...but can I do something with it as it chnages it height and width according to form resize...

    Can u show me some example where u have used this...???

    Cheers...
    I'm a little confused. Are you asking how to set it so it doesn't change size based on Form_Resize (set "Fit to Form" property to False) or how to use when it is maximized?

    Attached file is a screenshot of the scrollbox in use. The six "entries" are all placed on the scrollbox control. As those same entries can be in any number for a particular date - the viewport needs to scoll.
    Attached Images Attached Images  

  18. #18
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Thumbs up Hmm...

    I add that control in the form and when I resize the form it doesn't show me the scrollbar...

    I added that control and some controls in that control...When I resize that control in runtime it does shows the scrollbar but when I try to resize it in runtime it gets messed up...

    Any idea...

  19. #19
    Fanatic Member
    Join Date
    May 2002
    Posts
    746

    Re: Hmm...

    Originally posted by wrack
    I add that control in the form and when I resize the form it doesn't show me the scrollbar...

    I added that control and some controls in that control...When I resize that control in runtime it does shows the scrollbar but when I try to resize it in runtime it gets messed up...

    Any idea...
    So you have Fit to Form = True?

    Paste this:
    Code:
    Private Sub Form_Resize()
        Me.ScrollBox1.Refresh
    End Sub
    And most importantly, DO NOT double click the controls from the toolbox to place them in the scrollbox. Even though they appear to be children of the scrollbox, they are not. Physically draw the controls in the scrollbox and see if that helps.

  20. #20
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Re: Re: Hmm...

    Originally posted by Briantcva
    So you have Fit to Form = True?

    Paste this:
    Code:
    Private Sub Form_Resize()
        Me.ScrollBox1.Refresh
    End Sub
    And most importantly, DO NOT double click the controls from the toolbox to place them in the scrollbox. Even though they appear to be children of the scrollbox, they are not. Physically draw the controls in the scrollbox and see if that helps.
    Run the program and then resize the form to smaller size...U will see what I am talking about...

    See the attachment...
    Attached Files Attached Files

  21. #21

  22. #22
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Hmm...

    Originally posted by MartinLiss
    I've attached a zip of a project that scrolls a form just using standard VB controls.
    Thanks Martin....

    U reckon u can post one more with Horizontal and Vertical both scrollbar...

    Really appreciate that...

    Cheers...

  23. #23

  24. #24
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    How about this...

    Originally posted by MartinLiss
    You should be able to add a horizontal scrollbar by modifying the code for my horizontal scrollbar. If you give it a try and you have a problem, then I'll try to help.
    Thanks Martin but I already put the horizontal bar but when I scroll horizontally can't see the half of the combobox...

    see the attachment plz...
    Attached Files Attached Files

  25. #25
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695
    What am I doing wrong or what I am not doing...???

  26. #26
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    VB Code:
    1. Private Sub Form_Load()
    2.     picWindow.Left = 0
    3. '    picWindow.Width = Me.Width - VScroll1.Width
    4.     picWindow.Width = 8535
    5.     picI_Scroll.Width = picWindow.Width
    6.    
    7.     VScroll1.Height = picWindow.Height
    8.     VScroll1.Max = picI_Scroll.Height - picWindow.Height
    9.     VScroll1.SmallChange = 100
    10.     VScroll1.LargeChange = picWindow.Height
    11.     VScroll1.Left = Me.Width - VScroll1.Width - 60
    12.  
    13.     VScroll1.Top = 0
    14.    
    15. '    HScroll1.Width = picWindow.Width
    16.     HScroll1.Width = VScroll1.Left
    17.  
    18. '    HScroll1.Max = picI_Scroll.Width - picWindow.Width
    19.     HScroll1.Max = VScroll1.Left
    20.  
    21.     HScroll1.SmallChange = 100
    22.     HScroll1.LargeChange = picWindow.Width
    23.     HScroll1.Left = 0
    24.     HScroll1.Top = picWindow.Height
    25.    
    26.     picI_Scroll.Left = 0
    27.     picI_Scroll.Width = picWindow.Width
    28.    
    29. End Sub

  27. #27
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Thumbs up

    Originally posted by MartinLiss
    VB Code:
    1. Private Sub Form_Load()
    2.     picWindow.Left = 0
    3. '    picWindow.Width = Me.Width - VScroll1.Width
    4.     picWindow.Width = 8535
    5.     picI_Scroll.Width = picWindow.Width
    6.    
    7.     VScroll1.Height = picWindow.Height
    8.     VScroll1.Max = picI_Scroll.Height - picWindow.Height
    9.     VScroll1.SmallChange = 100
    10.     VScroll1.LargeChange = picWindow.Height
    11.     VScroll1.Left = Me.Width - VScroll1.Width - 60
    12.  
    13.     VScroll1.Top = 0
    14.    
    15. '    HScroll1.Width = picWindow.Width
    16.     HScroll1.Width = VScroll1.Left
    17.  
    18. '    HScroll1.Max = picI_Scroll.Width - picWindow.Width
    19.     HScroll1.Max = VScroll1.Left
    20.  
    21.     HScroll1.SmallChange = 100
    22.     HScroll1.LargeChange = picWindow.Width
    23.     HScroll1.Left = 0
    24.     HScroll1.Top = picWindow.Height
    25.    
    26.     picI_Scroll.Left = 0
    27.     picI_Scroll.Width = picWindow.Width
    28.    
    29. End Sub
    Thanks Martin...really appreciate that...

  28. #28
    Fanatic Member
    Join Date
    May 2002
    Posts
    746

    Maybe overcome by events but...

    Here's the code I have from your tmp.zip
    Code:
    Private Sub Form_Load()
        ScrollBox1.Width = Me.Width
        ScrollBox1.Height = Me.Height
        ScrollBox1.Refresh
    End Sub
    
    Private Sub Form_Resize()
        ScrollBox1.Width = Me.Width
        ScrollBox1.Height = Me.Height
        ScrollBox1.Refresh
    End Sub
    Now I see what you mean about resizing. So my question is, do you want the scrollbox to fit the entire form? If yes, then set "Fit to Form = True" and don't mess w/ the form load and resize events save for
    Code:
    Private Sub Form_Resize()
        ScrollBox1.Refresh
    End Sub
    Or am I being a total knucklehead and *still* not getting your problem? Or have you simply given up? FWIW, I think this is an excellent and more elegant control than using the standard VB scrollbars - w/ all due respect to Martin.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width