By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,747 Members | 1,778 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,747 IT Pros & Developers. It's quick & easy.

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

P: 8
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
Feb 21 '08 #1
Share this Question
Share on Google+
7 Replies


Delerna
Expert 100+
P: 1,134
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.
Feb 21 '08 #2

Delerna
Expert 100+
P: 1,134
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....anyone?
Feb 21 '08 #3

mshmyob
Expert 100+
P: 904
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.

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
Feb 21 '08 #4

missinglinq
Expert 2.5K+
P: 3,532
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.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2.  With Me.FlashingLabel
  3.  'If the color is black, the color is red otherwise the color is black!
  4.  .ForeColor = (IIf(.ForeColor = vbRed, vbBlack, vbRed))
  5. End With
  6. End Sub
  7.  
Welcome to TheScripts!

Linq ;0)>
Feb 21 '08 #5

jaxjagfan
Expert 100+
P: 254
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.
Feb 21 '08 #6

mshmyob
Expert 100+
P: 904
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.

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.
Feb 21 '08 #7

P: 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
Feb 24 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.