Welcome! Log In Create A New Profile

Advanced

Changing background color when control has the focus

Posted by Gus 
Hi:
I have a form with many edit controls and I would like to define a different background color for the control when this last has the focus. How can I make this?

Thanks;
Gus
Al
Re: Changing background color when control has the focus
March 16, 2009 10:43PM
Hello Gus

Each control has focus options available in the code edit section. At the bottom of the code edit window there are a series of button icons to set code for the mouse buttons and a (...) more processes section and the focus otions are in that part.

You can change the background colour of a control with the ..brushcolor command

Regards
Al
Hi Al:
Yes, I noticed the Gain Focus event which could help with this. But, I was wondering if there is a way to do this for all the controls in the form at once, so I can avoid to implement the change for each different control...

Thanks in advance!
Gus
Fabrice Harari
Re: Changing background color when control has the focus
March 16, 2009 11:20PM
Hi Gus,

to do it once for all control, you need to use the 'event' function, set an event on 'SetFocus' and another one on 'KillFocus' in the init code of the window...

In the called procedures, you can then change the background of your fields

Best regards

Hi Gus,

I know I am late to the dance but I would like to add another method.

It can be done with define a style.
I used zune and changed it slightly to fit my needs. Not only does it change the focus but you can also have it change for roll over with no code at all.

This is the image that I used for my input fields.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: