Welcome! Log In Create A New Profile

Advanced

background color of a field

Posted by Mike Bernard 
Mike Bernard
background color of a field
January 20, 2009 08:42PM
Hi

Is there any function or event that allows change the background color of a field where the cursor is on it?

Best Regards

Mike
Jimbo
Re: background color of a field
January 20, 2009 09:31PM
How about 'Got Focus' and 'Focus Lost' ?
Regards, Guenter
Mike Bernard
Re: background color of a field
January 21, 2009 02:10AM

Hi Guenter ...

would be Focus Gain and Loss of Focus field? :confused:

If yes, has the same effect if the code is used for input and output of the Field and has to be done one to one.

correct?

Thanks :spos:
Fabrice Harari
Re: background color of a field
January 21, 2009 11:32AM
Hi Mike...

You can use the 'event' function to interecept the SetFocus and KillFocus events on every field of the window, then in the called procedure, set the background color as needed

Best regards

Mike Bernard
Re: background color of a field
January 22, 2009 02:30AM
Hello Fabrice
I appreciate your tip ... but truth be told, I do not know how can I do this.

Thank you for the tip...

Best Regards
DW
Re: background color of a field
January 22, 2009 02:48AM
Mike,

If this is Windev you are talking about

Focus Gain event
MySelf..BrushColor = LightYellow

Focus Loss event
MySelf..BrushColor = DefaultColor

Dennis W

Gianni Spano
Re: background color of a field
January 22, 2009 11:57AM
Hi Mike

You can put this portion of code in the Main project code area:
I have declared two variables that contains the Api value to intercept the event
gnSETFOCUS is int=7
gnKILLFOCUS is int=8

Then i declare the two lines below:
Event("ColorOn","*.*",gnSETFOCUS)
Event("ColorOff","*.*",gnKILLFOCUS)

Then you have to create two separate GLOBAL PROCEDURE functions to execute the code once the field get the focus or kill it.

Example:.

//ColorOff ()
IF MySelf..Type=typDate OR MySelf..Type=typText OR MySelf..Type=typNum OR MySelf..Type=typTime THEN
MySelf..BrushColor=gnPreviouscolor
END


//ColorOn ()
gnPreviouscolor=MySelf..BrushColor
IF MySelf..Type=typDate OR MySelf..Type=typText OR MySelf..Type=typNum OR MySelf..Type=typTime THEN
MySelf..BrushColor=LightYellow
END

As you can see, the color is applied only to field that have a particular field type (date, text, etc. etc)

I use the "gnPreviousColor" variable to store the original field color, then once it kill the focus on field it restore the previous background color.

Hope in this help

Gianni
Mike Bernard
Re: background color of a field
January 22, 2009 03:03PM
Hello friends,

Thank you for your help, everyone who helped me...

Today I learned a little more about windev, thanks again

Cheers

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: