Link to home
Start Free TrialLog in
Avatar of fadyg
fadyg

asked on

changing color font in disabled edit box

Hi,
is there a way of changing the color of the font in a disabled tedit control? i.e is it possible to have the contents displayed in something different than the grey color to show a disabled status ? (for ex: I want red font over white background when control is disabled)
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fadyg
fadyg

ASKER

thanks for your reply,
your component would work correctly but this would give me a control that can get the focus (even though you won't be able to change anything because it's a read-only).  What is needed is the exact same behaviour as diabled i.e. no focus.

any ideas ?
ok to try this put my comp on a form and a button
give my comp some disabledcolors then on button click type this:

SetWindowLong(DisabledColorEdit1.Handle,GWL_STYLE,
    GetWindowLong(DisabledColorEdit1.Handle,GWL_STYLE) or WS_DISABLED);
DisabledColorEdit1.Enabled:=False;

this will stop it from recieving focus
if you want it to recieve focus type this:

SetWindowLong(DisabledColorEdit1.Handle,GWL_STYLE,
    GetWindowLong(DisabledColorEdit1.Handle,GWL_STYLE) and not WS_DISABLED);

Regards Barry