Results 1 to 33 of 33

Thread: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

  1. #1

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    User Control: ucAddScroll.ctl
    Author: Shagratt
    Dependencies: ucScrollbar.ctl

    Name:  sScrollAdd_screenshotW71.jpg
Views: 1306
Size:  24.6 KB
    Name:  sScrollAdd_screenshotW72.jpg
Views: 1315
Size:  34.4 KB



    -What it does?: It create a scrollable area on the TARGET (Control/Form) with all it's content.
    It add 4 controls to the Form: (exposed in ucScrollAdd.xxxx)
    1) .PBContainer: The new container that will scroll inside the Target with all the the content.
    2) .UCScrollV: Vertical scrollbar
    3) .UCScrollH: Horizontal scrollbar
    4) .PBCover: A simple picture box put in bottom right corner between the scrollbars


    -What it dosnt?: It's not a scrollable container by itself. You need to create the
    content on a standard vb6 container (for example a PictureBox) or Form, wich has content
    larger than its viewable area. This means you can use an already made Form and add
    scrollable resize with just this control and 1 line of code.


    -Usage:
    1) Add a instance on the form.
    2) In your code call: 'ucScrollAdd.AddScroll <TARGET CONTAINER>' to automatilly add
    scrollbars when needed. (Example: ucScrollAdd.AddScroll Me)

    Optional:
    -call 'ucScrollAdd.TrackMouseWheel' to enable MouseWheel tracking over container area.
    (Press SHIFT to scroll horizontal)
    -call 'ucScrollAdd.ResizeWindowLimit <MINWIDTH>, <MINHEIGHT>,[MAXWIDTH], [MAXHEIGHT]'
    to add Form resize limit without flickering
    -call 'ucScrollAdd.RemoveFromContainer <CTRL>,[CTRL],[CTRL],...' to exclude all
    controls/containers you want from Scrolling.
    -If you want to know the size of content inside the container
    'CalcContainerContentSize maxBottom&, maxRight&' values are returned by ref.
    -propertys ContainerW/ContainerH can be used to force the size of the container


    NOTE: You can have more than 1 scrolling area in the form

    For better understanding check the included 4 examples in the project.

    ----------------

    *v1.0.0 11/12/19
    - Starting version. Basic usage working


    Download: prj (Ctrl) ScrollAdd_v1.0.zip

  2. #2

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    Lightbulb Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Talking with Eduardo I realised that I did not explain well how to create this 'larger than screen' forms.

    You can use 2 simple methods:

    Method A)
    -Create a PictureBox with the size you want and put in Top: 0, Left: 0. This will be our container.
    Just for the example let's say our screen is 800x600 and we created a 800x1200 picture box called PBContainer
    (This mean we now have a picturebox with a Height of 2 screens)
    -Now add all the content you want on that picturebox (labels, others picturebox, images, textbox, etc.)

    -The problem: You can only see the first 800x600 part that fit on the screen.
    Fix: Move the picturebox (PBContainer) upward by dragging it or just changing its top to negative values.
    Let's put in half screen up moving it to Top: -300.
    Now we see the bottom half of the 800x600 we designed and the first part of the second.
    (what we see in the screen is the rectangle 0,300 to 800,900 from the PBContainer.
    -Keep adding controls and repeat moving it up until we have edited all the area we wanted.

    -When finished restore the Top: 0 , Left: 0 of the Picturebox
    -On Form_Load when calling "ScrollAdd.AddScroll me" and the form we will be
    able to access everything that was offscreen.


    Method B)
    -Create diferent picturebox (like PbA PbB, PbC)
    -On Form_Load put every picture box below the other
    Example:
    Code:
    PbB.top = PbA.top + PbA.height
    PbC.top = PbB.top + PbB.height
    ScrollAdd.AddScroll me

    All my examples and documentation was written in most used language in the world, and that is "BAD ENGLISH" , so if I was not clear enough feel free to ask

  3. #3
    Addicted Member
    Join Date
    Jun 2016
    Location
    Espaņa
    Posts
    244

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    very good job this great control.
    in the not too distant future will probably use
    Greetings

  4. #4
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Great! Although Demo is not really a web page, it seems to be a good web UI simulator! Hope that VB6 can be more and more applied to web development.

  5. #5

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Quote Originally Posted by dreammanor View Post
    Great! Although Demo is not really a web page, it seems to be a good web UI simulator! Hope that VB6 can be more and more applied to web development.
    Of course! The demos are just drawn to show the kind of UI design that can be accomplished with the usercontrol. No real functionality added. (I copied the style of a well known news webpage wich can be created with standard VB6 elements)
    I have in mind to create more controls to mimic more web UI functionality. Too many good ideas, too little time to make them

  6. #6
    Addicted Member
    Join Date
    Nov 2011
    Posts
    182

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    hi. been playing around with this control and it works very well.
    I did not like to bounce when i scrolled and found somewhere in the code and set it to 1 and not 0.15.
    this was more inline with a scrollbar i usually use.
    i also wanted a status bar at the bottom, and had to make a few adjustments in the code to leave a gap
    at the bottom of the form.
    Works real nice now.

    Many thanks.

    p.s will you be adding any other features etc

  7. #7

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Quote Originally Posted by k_zeon View Post
    hi. been playing around with this control and it works very well.
    I did not like to bounce when i scrolled and found somewhere in the code and set it to 1 and not 0.15.
    this was more inline with a scrollbar i usually use.
    The 'bounce' effect was expected :P but if you dont like you dont need to change anything in the code.
    Scrollbars have a property called 'SmoothScrollFactor' wich its pretty sure what you have modified
    You can change it from the ScrollAdd control with 'ucScrollAdd1.UCScrollV.SmoothScrollFactor=1' and 'ucScrollAdd1.UCScrollH.SmoothScrollFactor=1' (for the vertical and horizontal axis)


    Quote Originally Posted by k_zeon View Post
    i also wanted a status bar at the bottom, and had to make a few adjustments in the code to leave a gap
    at the bottom of the form.
    Works real nice now.
    Again no need to change the code. You can use 'ucScrollAdd.ResizeTargetOnFormResize X,Y' where X and Y are the padding left and bottom you want to leave when resizing.


    Quote Originally Posted by k_zeon View Post
    p.s will you be adding any other features etc
    There are a few bugs that I still not found. So aside from fix this bugs I dont think so, it's pretty much working as I spected.

  8. #8
    Addicted Member
    Join Date
    Jul 2017
    Posts
    227

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Very nice control shagratt .

    How about adding support to scrolling by mouse_down on the container itself that is being hooked to act like mobile phones scrolling . It will be so great for applications that run on touch screens so the user will not have to scroll using the scrollbar only .
    I don`t know if it should be added to UcScrollbar or the UcScrollAdd . Only you who can evaluate this .

  9. #9

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Quote Originally Posted by Hosam AL Dein View Post
    Very nice control shagratt .

    How about adding support to scrolling by mouse_down on the container itself that is being hooked to act like mobile phones scrolling . It will be so great for applications that run on touch screens so the user will not have to scroll using the scrollbar only .
    I don`t know if it should be added to UcScrollbar or the UcScrollAdd . Only you who can evaluate this .
    Hi Hosam! That's a really cool idea! Thanks for sharing it! I will add it to the TODO LIST to make it in the near future. (working on another UC right now)
    Unfortunately I dont have any touchscreen to play with (but I could try test sharing my screen to my phone and use it as a touch monitor...)

    Even if right now the feature is not implemented I think you can capture the mouse down in your code and change the values of ucScrollAdd1.UCScrollV to mimic the drag.

  10. #10
    Addicted Member
    Join Date
    Jul 2017
    Posts
    227

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Ok , I will see what I can come up with . Keep it up .

  11. #11
    New Member
    Join Date
    Feb 2021
    Posts
    6

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    hi shagratt
    great control !!

    i'm running it in VB6 in Windows XP
    and i get this error when call the Form_Unload event

    Private Sub Command1_Click()
    Unload Me
    End Sub

    Attachment 180353

    any idea?
    tanx!

  12. #12
    New Member
    Join Date
    Feb 2021
    Posts
    6

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    I just added a button Command1 to your project :

    Private Sub Command1_Click()
    Unload Me
    End Sub

    when i click the button vb6 crash

  13. #13

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Hi Jeeba!!! Thanks for finding that bug!

    I found the problem and fixed:
    - Go to ucScrollbar.ctl and replace the SubclassEnd sub with this code:

    Private Sub SubclassEnd()
    sc_UnSubclass UserControl.Parent.hwnd
    sc_UnSubclass UserControl.hwnd
    End Sub

    now it should not crash anymore!

  14. #14
    New Member
    Join Date
    Feb 2021
    Posts
    6

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Hi Shagratt,
    now everything work fine. Thank you!

    i have another issue.

    i make a new project, added your controls ( i make a copy of ucScrollAdd and ucScrollbar in this directory )
    in the form1
    i just copied your Example3 ( everything , the form and code )

    but it crashes

    AddScroll UCScrollV Error: Object variable or With block variable not set
    AddScroll UCScrollH Error: Object variable or With block variable not set
    TrackMouseWheel Err: Object variable or With block variable not set

    did i miss something? how can i use this controls in other projects?
    thanx again

  15. #15

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    yes! of course. The problem is that you copied the Form from one project to another.
    The control in the form is declared with "[your projectname].[Control Name]" so when you copy it try to look for an object called "[my project].[Control Name]" wich dosnt exit anymore.

    There is a really simple fix when you need to do that:
    -Copy the form from my project to your project (DONT OPEN VB6 YET) Remember to copy the .frm and .frx (when exist)
    -Open the copy of the frm copied in your project in a text editor like notepad
    -Change every declaration of the object like

    Begin ScrollAdd.ucScrollAdd ucScrollAdd1

    with

    Begin [Your project name].ucScrollAdd ucScrollAdd1


    -if you dont know your project name, just open your project, create an empty form and add a AddScroll control, then save, and open the frm in a text editor to see what is the name that vb put before the ucScrollAdd and use that.

    Tell me if that solved your problem.

  16. #16
    New Member
    Join Date
    Feb 2021
    Posts
    6

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Hi Shagratt,
    in the .frm file the project name is correct.

    Begin TemplateSoftware.ucScrollAdd ucScrollAdd1
    ...
    Begin TemplateSoftware.ucScrollAdd ucScrollAdd2

    i just make a copy of your code ( form Example3 ), it's not the same file.
    in my project i added a form , copied your code and added controls, ( ucScrollbar.ctl and ucScrollAdd.ctl , .ctx too )

    Before it crashes i get Object variable or With block variable not set in the Form_Load here:

    ucScrollAdd1.UCScrollV.ShowButtons = False
    ucScrollAdd1.UCScrollH.ShowButtons = False
    ucScrollAdd2.UCScrollV.ShowButtons = False
    ucScrollAdd2.UCScrollH.ShowButtons = False

    this is my code :

    Private Sub Form_Load()


    ucScrollAdd1.AddScroll Me

    ucScrollAdd1.TrackMouseWheel Vertical

    ucScrollAdd1.ResizeWindowLimit 750, 500


    ucScrollAdd1.RemoveFromContainer frTop, frDashboard, PicHover

    ucScrollAdd2.AddScroll Frame1Cont
    ucScrollAdd2.TrackMouseWheel Vertical

    ucScrollAdd2.RemoveFromContainer PicHover, PBMovingTitle1, PBMovingTitle2


    ucScrollAdd1.UCScrollV.ShowButtons = False
    ucScrollAdd1.UCScrollH.ShowButtons = False
    ucScrollAdd2.UCScrollV.ShowButtons = False
    ucScrollAdd2.UCScrollH.ShowButtons = False


    Form_Resize




    End Sub


    even if i try to add your controls from their location ( where it works ) to another form (with another path.)
    just add the instance in the form ( nothing else ) and in the form_load :

    ucScrollAdd1.AddScroll Me

    ucScrollAdd1.TrackMouseWheel Vertical

    ucScrollAdd1.UCScrollV.ShowButtons = False
    ucScrollAdd1.UCScrollH.ShowButtons = False

    i really don't understand.

    Hope you can find a solution!

    thanks again

  17. #17

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Please, attach all the project files in a zip and i test them.

  18. #18
    New Member
    Join Date
    Feb 2021
    Posts
    6

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Hi Shagratt,
    this is the project

    New Folder.zip

    thanx!

  19. #19

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Quote Originally Posted by jeeba73 View Post
    Hi Shagratt,
    this is the project

    New Folder.zip

    thanx!
    Hi jeeba73! I found why it was not working... there is 2 things you need to change:

    1) On the project properties uncheck the "REMOVE INFORMATION ABOUT UNUSED ACTIVEX CONTROLS".

    This is because the scrollbars are added by the scrollAdd control, so the compiler think you never added any scrollbars at all and remove it before executing it.

    2) On ucScrollAdd.ctl you need to do 2 aditional changes:

    Line 374 and 381 should use the name of the project like:

    'Vertical
    Set UCScrollV = TargetForm.Controls.Add("Project1.ucScrollBar", UCScrollVName$)
    'Horizontal
    Set UCScrollH = TargetForm.Controls.Add("Project1.ucScrollBar", UCScrollHName$)


    This can be avoided if the ucAddScroll and ucScrollbar are compiled as an OCX with a fixed project name, but it will have the downside of the OCX needed alongside with the exe (i always try to keep everything inside the exe)

  20. #20
    New Member
    Join Date
    Feb 2021
    Posts
    6

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Hi Shagratt,
    everything works properly now!
    thank you!!!!

    and... great job

  21. #21
    Junior Member
    Join Date
    May 2019
    Posts
    17

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Shagratt, recently found your scrolling control which is fantastic. I've implemented it into our software product, following the instructions in post numbers 1, 2, 13 and 19. However, my software requires that "REMOVE INFORMATION ABOUT UNUSED ACTIVEX CONTROLS" is checked, given all the other controls we use. Despite wanting to keep everything in the EXE, how do I create an OCX from the 2 user control files (ucAddScroll and ucScrollbar)?
    Regards
    Gordon

  22. #22

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Quote Originally Posted by SGordonS View Post
    Shagratt, recently found your scrolling control which is fantastic. I've implemented it into our software product, following the instructions in post numbers 1, 2, 13 and 19. However, my software requires that "REMOVE INFORMATION ABOUT UNUSED ACTIVEX CONTROLS" is checked, given all the other controls we use. Despite wanting to keep everything in the EXE, how do I create an OCX from the 2 user control files (ucAddScroll and ucScrollbar)?
    Regards
    Gordon
    Hi Gordon! Good to know that you liked the scrollbars!
    If you cant uncheck to remove unused activex dont worry! Its really easy! You need to make the compiler think you use the scrollbar, so just add the scrollbar control into any form and make it invisible (in the "About" form is just perfect).
    Now when you make the exe it will not remove the scrollbars.
    Tell me if that worked for you.

  23. #23
    Junior Member
    Join Date
    May 2019
    Posts
    17

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Thanks for your quick reply. Installed an invisible scrollbar control in my About form ... and magic happens. Thanks for your assistance, now looking forward to doing great things with your scrollbar control.

  24. #24
    Junior Member
    Join Date
    May 2019
    Posts
    17

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    I would like to use the Page Up/Down, Home/End and Arrow Up/Down keys for scrolling. I've looked through your code and don't see where that is possible. Can you advise?

  25. #25

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Quote Originally Posted by SGordonS View Post
    I would like to use the Page Up/Down, Home/End and Arrow Up/Down keys for scrolling. I've looked through your code and don't see where that is possible. Can you advise?
    That's a very good idea!

    All On ucScrollbar.ctl:

    On SubclassingStart() add the line:

    Code:
        Call sc_AddMsg(UserControl.hwnd, WM_KEYDOWN, MSG_BEFORE)
    On zWndProc1(...) add in the case:

    Code:
                Case WM_KEYDOWN
                    'PGUP
                    If (wParam = 33) Then
                        Call pvScrollPosDec(m_lLargeChange)
                        Call pvKillTimer(TIMERID_CHANGE1)
                        Call pvSetTimer(TIMERID_CHANGE1, m_lChangeDelay)
                    
                    'PGDW
                    ElseIf (wParam = 34) Then
                        Call pvScrollPosInc(m_lLargeChange)
                        Call pvKillTimer(TIMERID_CHANGE1)
                        Call pvSetTimer(TIMERID_CHANGE1, m_lChangeDelay)
                    
                    'HOME
                    ElseIf (wParam = 36) Then
                        Call pvScrollPosDec(999999)
                        Call pvKillTimer(TIMERID_CHANGE1)
                        Call pvSetTimer(TIMERID_CHANGE1, m_lChangeDelay)
                    
                    'END
                    ElseIf (wParam = 35) Then
                        Call pvScrollPosInc(999999)
                        Call pvKillTimer(TIMERID_CHANGE1)
                        Call pvSetTimer(TIMERID_CHANGE1, m_lChangeDelay)
    
    
                    End If

  26. #26
    Addicted Member
    Join Date
    Jun 2016
    Location
    Espaņa
    Posts
    244

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    very good idea.
    Try adding what it does not work for me.
    It only works if I first click on the scroll or the scroll has the focus.

    regards

  27. #27
    Junior Member
    Join Date
    May 2019
    Posts
    17

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Thanks for the code in post #25. On execution, I get a "Variable not defined" error for WM_KEYDOWN. Should there be a declaration for "Private Const WM_KEYDOWN as Long = ???"

    In SubclassingStart(), I note the square brackets used in other calls that end with "MSG_BEFORE", such as:
    Code:
    Call sc_AddMsg(UserControl.hwnd, WM_PAINT, [MSG_BEFORE])
    Should KEY_DOWN have the same square brackets?
    Code:
    Call sc_AddMsg(UserControl.hwnd, WM_KEYDOWN, [MSG_BEFORE])
    Regards
    Gordon

  28. #28

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Quote Originally Posted by SGordonS View Post
    Thanks for the code in post #25. On execution, I get a "Variable not defined" error for WM_KEYDOWN. Should there be a declaration for "Private Const WM_KEYDOWN as Long = ???"
    Sorry! my mistake!

    Add this declaration
    Private Const WM_KEYDOWN As Long = &H100 '256

    In SubclassingStart(), I note the square brackets used in other calls that end with "MSG_BEFORE", such as:
    Code:
    Call sc_AddMsg(UserControl.hwnd, WM_PAINT, [MSG_BEFORE])
    Should KEY_DOWN have the same square brackets?
    Code:
    Call sc_AddMsg(UserControl.hwnd, WM_KEYDOWN, [MSG_BEFORE])
    Regards
    Gordon

    Not really needed.Its equivalent

  29. #29

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Quote Originally Posted by yokesee View Post
    very good idea.
    Try adding what it does not work for me.
    It only works if I first click on the scroll or the scroll has the focus.

    regards
    yes, WM_KEYDOWN its only send to the control with the focus.
    I made a lot more changes to have support for the keys (included up/down arrows) also on the container. Instead of using the WM_KEYDOWN message I used a simpler method programing the _KeyDown event.
    Still needs the focus to work (on the container or scrollbar) wich is not ideal.
    Having a perfect support to detect keys on the container is becoming a little problematic without resorting to a keyboard hook (wich I prefer to stay away). If you think of a better solution I will glady implement it.

    This is the code I added on UcScrollbar.ctl (remove all the WM_KEYDOWN related code I posted before), just this:


    Code:
    Private Sub UserControl_KeyDown(KeyCode As Integer, Shift As Integer)
        Select Case (KeyCode)
            Case 33: Scroll_UP 1 'PGUP
            Case 34: Scroll_DOWN 1 'PGDOWN
            Case 36: Scroll_UP 2 'HOME
            Case 35: Scroll_DOWN 2 'END
            Case 38: Scroll_UP 0 'UP ARROW
            Case 40: Scroll_DOWN 0 'DOWN ARROW
        End Select
    End Sub
    
    '==================================
    'Scroll Up
    '==================================
    '(Also for external call)
    Public Sub Scroll_UP(Distance_Type&)
    Dim dist&
    
    
        Select Case (Distance_Type&)
            Case 0: dist = m_lSmallChange
            Case 1: dist = m_lLargeChange
            Case 2: dist = 99999999
        End Select
    
    
        Call pvScrollPosDec(dist&)
        Call pvKillTimer(TIMERID_CHANGE1)
        Call pvSetTimer(TIMERID_CHANGE1, m_lChangeDelay)
    End Sub
    
    
    '==================================
    'Scroll Down
    '==================================
    '(Also for external call)
    Public Sub Scroll_DOWN(Distance_Type&)
    Dim dist&
    
    
        Select Case (Distance_Type&)
            Case 0: dist = m_lSmallChange
            Case 1: dist = m_lLargeChange
            Case 2: dist = 99999999
        End Select
    
    
        Call pvScrollPosInc(dist&)
        Call pvKillTimer(TIMERID_CHANGE1)
        Call pvSetTimer(TIMERID_CHANGE1, m_lChangeDelay)
    End Sub

    And on AddScroll.ctl:

    Code:
    Private Sub PBContainer_KeyDown(KeyCode As Integer, Shift As Integer)
    on error resume next
        Select Case (KeyCode)
            Case 33: UCScrollV.Scroll_UP 1 'PGUP
            Case 34: UCScrollV.Scroll_DOWN 1 'PGDOWN
            Case 36: UCScrollV.Scroll_UP 2 'HOME
            Case 35: UCScrollV.Scroll_DOWN 2 'END
            Case 38: UCScrollV.Scroll_UP 0 'UP ARROW
            Case 40: UCScrollV.Scroll_DOWN 0 'DOWN ARROW
        End Select
    End Sub

  30. #30
    Junior Member
    Join Date
    May 2019
    Posts
    17

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Many thanks. Error gone, however, none of the 'keys_down' function in IDE or compiled.

  31. #31
    Junior Member
    Join Date
    May 2019
    Posts
    17

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Oops, our messages crossed paths. I've removed the WM_KEYDOWN code from post #25 and inserted code from post #29. When run in IDE, my scrolling form generates "VB has encountered a problem and needs to close", then the IDE environment crashes and closes. The program compiles but generates "Data Execution Prevention" message and then crashes.

  32. #32
    Addicted Member
    Join Date
    Jun 2016
    Location
    Espaņa
    Posts
    244

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    In Examples 1,2 and 3 it seems to work quite well.
    In Example 4, having 2 scroll not so well.
    But it works pretty well
    great job.

  33. #33

    Thread Starter
    Addicted Member shagratt's Avatar
    Join Date
    Jul 2019
    Location
    Argentina
    Posts
    174

    Re: [VB6] ScrollAdd Ctrl v1.0 (add scrolling to current forms and containers)

    Quote Originally Posted by yokesee View Post
    In Examples 1,2 and 3 it seems to work quite well.
    In Example 4, having 2 scroll not so well.
    But it works pretty well
    great job.
    Solution from post#29 works well also in example 4. (always remember you need to give focus first)

    I cant work on more complex solutions for the time being (too busy on other works right now) but if someone can do it I will be happy to test it.

Tags for this Thread

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