refresh screen during scrolling

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Wilcox
    New Member
    • Sep 2007
    • 68

    #1

    refresh screen during scrolling

    Hi

    I'm trying to emulate, within access, the gantt chart timeline / task planner aspects of ms project. Creating the chart on the form has been easy enough; I use a series of unbound text boxes in the header to show the week numbers, with correlating unbound text boxes in the detail section of a continuous form to calculate a series of values for each task which, where these match the value in the header text box will change the colour of the detail box using conditional formatting.

    The planner only shows 3 months worth of project time on the form, so to make it 'dynamic' i.e. can span 2 or 3 years worth of project life, I use an activex scroll bar control to set the week number of the first week in the first text box, then the other 12 text boxes (weeks in the displayed quarter) calculate off that.

    All of this is slightly besides the point but it might help you understand what it is I'm trying to acheive;

    my problem is that I would like all the text boxes to recalculate and/or get a screen refresh on each incremental change when I hold down the scroll bar buttons, i.e. to scroll. This would mean that the form would then look and work exactly like project. At the moment it'll refresh once I stop scrolling, but not during the scroll. however, the value in the first text box, which is set by the scroll bar, does update during scrolling so I'm sure this must be possible. I've tried playing around with the various events of the scroll bar and the text boxes but this doesn't get me anywhere.

    It feels like I'm either missing something obvious or going down a blind alley, i.e. I could acheive this quite easily through using a different control or approach. Does anyone have any ideas?

    Thanks
    Kevin
  • FishVal
    Recognized Expert Specialist
    • Jun 2007
    • 2656

    #2
    Hello, Kevin.

    Try to use DoEvents command.

    Regards,
    Fish

    Comment

    • Kevin Wilcox
      New Member
      • Sep 2007
      • 68

      #3
      Hi Fishval

      that doesn't seem to work. can I check that I'm coding this right?

      Code:
      Private Sub ScrollBar1_Change()
      On Error GoTo proc_error
      Dim ScrollVal As Integer
      Dim DateFactor As Integer
      
      ScrollVal = Int(Me.ScrollBar1.Value)
      
      Select Case ScrollVal
      Case 52
      DateFactor = 0
      Me.txtWk1 = RefDate
      Case Is < 52
      DateFactor = (52 - ScrollVal) * 7
      Me.txtWk1 = RefDate - DateFactor
      Case Is > 52
      DateFactor = (ScrollVal - 52) * 7
      Me.txtWk1 = RefDate + DateFactor
      End Select
      Me.Repaint
      DoEvents
      
      proc_error:
      GoTo proc_exit
      
      proc_exit:
      Exit Sub
      
      End Sub
      It actually doesn't make any difference whether I use refresh or repaint, or whether this is before or after doevents. If you're certain that doevents is the solution I'll persist.

      thanks
      Kevin

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        1. I'm a little rusty on the ScrollBar Control, but if you a User to be able to see the changes in the Value Property while dragging the Button, you need to place code in the Scroll() Event.
        2. Consequently, I would imagine that if you wanted the Screen Display to 'catch up', you would place the DoEvents Statement here.
        3. If the difference between the Min and Max values is large, you may wish to execute DoEvents at periodic Intervals, such as:
          Code:
          Private ScrollBarName_Scroll(<not sure of Argument(s)>)
          Static lngCounter As Long
          
          lngCounter = lngCounter + 1
          
          If lngCounter Mod 1000 = 0 Then
            DoEvents
          End If
          End Sub
        4. Take all this with a grain of salt, since I haven't programmed Scroll Bars in awhile, but do let us know how you make out.

        Comment

        • Kevin Wilcox
          New Member
          • Sep 2007
          • 68

          #5
          Sadly that doesn't work either. Refreshing does have an effect in so far that the screen will flicker as the value changes, but at best the screen will white-out within the affected area the repaint once I release the mouse button. I'm wondering whether I might be able to solve it by using a mousedown event on the form coupled with timer and an on_click on a dummy button. I don't know enough about scroll bars to know what I should be able to get them to do but it feels like the mousedown situation interferes with any attempt to interrupt the looping which must be taking place.

          Thanks
          Kevin

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            Not sure what the problem is, if I send you my E-Mail Address in a Private Message, would you be willing to send me the DB so that I may have a look at it first hand?

            Comment

            • Kevin Wilcox
              New Member
              • Sep 2007
              • 68

              #7
              that's very kind of you, yes of course. do you need my private email address?

              thanks
              Kevin

              Comment

              • ADezii
                Recognized Expert Expert
                • Apr 2006
                • 8834

                #8
                do you need my private email address?
                No, I'll obtain it when you E-Mail me the Database as an Attachment. I'll send you a Private Message shortly with the Address.

                Comment

                Working...