Label Automation (Flashing): changing a label's colour

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • emlimeng
    New Member
    • Feb 2008
    • 8

    Label Automation (Flashing): changing a label's colour

    Hello, I have a label on the form to draw people's attention so they do not forget to input the data in a particular section. e.g. "Please carefully check all the options on the form".

    I hope I can automate the colour of the label, so that the colours for the label can keep on changing nicely and smoothly from one end to the other. Such as the colours moves per letter or per word from left to right towards the end of the sentence, or from a corner to the other.

    Is this a complecated process? Should I use array or timer? I am not sure if I am on the right track and which functions or properties I need to use in order to complete this process, could anyone please point it out for me? Thanks in advance for any suggestions.

    Cheers

    meng
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    since you want the colors scrolling through the letters of the message you could try this

    Have 1 label for each letter in the message, so that way letter can be a different color.
    or
    Have 1 label for each word in the message, so each word can be a different color.

    Then use the forms timer event to update the colors in a way that the colors scroll the way you want.

    For the colors you could use an array to store the sequence of colors.
    The label has a tag property which you can store the index into the array for the labels current color.
    Each time the timer even fires you increment the number in the tag and then set the labels forecolor to the color pointed to by the index in its tag property.

    Have a go at coding that and if you have trouble, post your attempt here and someone will help you.

    Comment

    • Delerna
      Recognized Expert Top Contributor
      • Jan 2008
      • 1134

      #3
      Another posibility would be a sequence of images and using the forms timer event you could change the image in an image control so that the color animation does whatever you want it to do.
      There is probably a million and one ways to do this.
      Can you make giff animations work in access....anyon e?

      Comment

      • mshmyob
        Recognized Expert Contributor
        • Jan 2008
        • 903

        #4
        Later today I will try and write the code for you. I have written some code to scroll a message through a text box (like a ticker display), so I am sure I can modify it to scroll through colours. I post it if I get it changing colours.

        Originally posted by emlimeng
        Hello, I have a label on the form to draw people's attention so they do not forget to input the data in a particular section. e.g. "Please carefully check all the options on the form".

        I hope I can automate the colour of the label, so that the colours for the label can keep on changing nicely and smoothly from one end to the other. Such as the colours moves per letter or per word from left to right towards the end of the sentence, or from a corner to the other.

        Is this a complecated process? Should I use array or timer? I am not sure if I am on the right track and which functions or properties I need to use in order to complete this process, could anyone please point it out for me? Thanks in advance for any suggestions.

        Cheers

        meng

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          I have to tell you that having a scrolling , multi-color message crawl across a data entry form is a very bad idea! You're dealing with a database here, not a video game. It will be distracting to your users and very probably cause an increase in data entry errors! Using the Timer Event to do this sort of thing in a splash screen is one thing, but this type of prolonged use of the Timer frequently leads to sluggish response times and other processing problems when data is also involved. You'd be far better off using validation code in your form's BeforeUpdate event to insure that the required data is entered. If you insist on using a flashing label, you'd be better off using one that is less distracting, like one that slowly cycles thru two colors.

          This code will do this. Set the Timer Interval to 400. The colors, of course, can be changed to suit you.

          Code:
          Private Sub Form_Timer()
           With Me.FlashingLabel
           'If the color is black, the color is red otherwise the color is black!
           .ForeColor = (IIf(.ForeColor = vbRed, vbBlack, vbRed))
          End With
          End Sub
          Welcome to TheScripts!

          Linq ;0)>

          Comment

          • jaxjagfan
            Recognized Expert Contributor
            • Dec 2007
            • 254

            #6
            I agree with Missingling's assessment. What I normally do is build my logic into the afterupdate property of each required control. The form appears normal (standard colors) until the end user leaves a control null, incorrect data, or incorrrect format. It's at that moment I change the label color and/or control backcolor along with a message box telling them what they are doing wrong. If the enduser isn't screwing it up, no need to display a "rainbow", keep the interface simple and professional.

            Comment

            • mshmyob
              Recognized Expert Contributor
              • Jan 2008
              • 903

              #7
              I agree with Linq and Jax but if you really want the scrolling text code I will post it. I did it for a test I was running and it didn't affect the data entry but it was on a table with only about 5000 records and there was not any intence queries being run. It had about 30 fields.

              I did notice though that making a control flash or change colours constantly had more of an impact than just changing a text box value.

              My own thoughts are that I usually stay away from flashing, changing colours constantly, or scrolling because it is SOOOOOO annoying. The only time I like to use the ONTIMER event is for extended timer events such as backing up each night or checking every hour or so.

              A flashing or scrolling event is done anywhere between 200ms to 1 second usually.

              After all said and done if you want the scrolling text code I will post it just let me know.

              Originally posted by jaxjagfan
              I agree with Missingling's assessment. What I normally do is build my logic into the afterupdate property of each required control. The form appears normal (standard colors) until the end user leaves a control null, incorrect data, or incorrrect format. It's at that moment I change the label color and/or control backcolor along with a message box telling them what they are doing wrong. If the enduser isn't screwing it up, no need to display a "rainbow", keep the interface simple and professional.

              Comment

              • emlimeng
                New Member
                • Feb 2008
                • 8

                #8
                Hello, Delerna, mshmyob, missingling, and jaxjagfan, many thanks for all your suggestions and comments.

                I have get the visual effect from missingling's code generally, having a flashing label do distract the users. What I am trying to achieve at the moment is the colour could scrolling from one end to other slowly and smoothly, therefore, the users do not feel uncomfortable, it also could draw people’s attention. I will have a go on Delerna's first suggestions and see if I can work out how to scroll the colours by using array, timer and tags.

                Cheers for all your helps, I will come back shortly.

                regards

                meng

                Comment

                Working...