set control properties

  • Thread starter Thread starter Walter
  • Start date Start date
W

Walter

How can I cause each control on a form to be highlighted
when it gets focus without setting each control's property
individually?
Thanks,
Walter
 
There are many ways to highlight the control that has the focus
through code, but it almost sounds like you want to do this
without code. If so, here is an option provided by Rick Brandt
in the past:
"If you don't mind the controls without focus being the same color as the form
you can set them all to a contrasting color and then set them to transparent.
The transparent setting is ignored for the control that has focus so it will
automatically show a different color (with no code)."
To set this for all the controls at once, just hold down the Shift key
while you click on each control. Once they are all selected you can
go to the Properties area and change the Back Color and then
the Back Style all at the same time in one motion.
 
Jeff Conrad said:
There are many ways to highlight the control that has the focus
through code, but it almost sounds like you want to do this
without code. If so, here is an option provided by Rick Brandt
in the past:

"If you don't mind the controls without focus being the same color as
the form you can set them all to a contrasting color and then set
them to transparent. The transparent setting is ignored for the
control that has focus so it will automatically show a different
color (with no code)."

To set this for all the controls at once, just hold down the Shift key
while you click on each control. Once they are all selected you can
go to the Properties area and change the Back Color and then
the Back Style all at the same time in one motion.

And if you want to go to a bit more trouble, you can put a white (or
other color) box behind each control, sized and shaped to match the
control. Then the controls without the focus will appear to have that
color background (not the same color as the form), and the control that
has the focus will have your chosen highlight color.
 
-----Original Message-----
I don't mind using code if I know how. I was looking for
a way to do it without having to set each control
individually.
Thanks,
Walter
 
(resending because my first reply doesn't seem to have made it)

Walter said:
I don't mind using code if I know how. I was looking for
a way to do it without having to set each control
individually.

Pardon me, Walter, but I'm not sure whether you're saying that your
question has been answer, or that it hasn't. The no-code method Jeff
described (courtesy Rick Brandt) requires you to do a little work at
design time on the form, but nothing at all at run time. There is no
method I know of that will let you do it without at least doing
something to each control at design time.

You can write a pair of functions, HighlightControl() and
UnhighlightControl(), and set them to be called from each control's
GotFocus and LostFocus events. That code wouldn't need to be told which
control is the one in question, because it can use the form's
ActiveControl property to tell it. However, you do need to do the work
at design time to get the functions called by the appropriate events.
And it won't work properly on continuous forms.

You can also use Conditional Formatting -- in Access 2000 or later -- to
set various formatting attributes of each control depending on whether
it has the focus or not. That will work on continuous forms, but you
have to set it at design time for each individual control.
 
-----Original Message-----
(resending because my first reply doesn't seem to have made it)



Pardon me, Walter, but I'm not sure whether you're saying that your
question has been answer, or that it hasn't. The no- code method Jeff
described (courtesy Rick Brandt) requires you to do a little work at
design time on the form, but nothing at all at run time. There is no
method I know of that will let you do it without at least doing
something to each control at design time.

You can write a pair of functions, HighlightControl() and
UnhighlightControl(), and set them to be called from each control's
GotFocus and LostFocus events. That code wouldn't need to be told which
control is the one in question, because it can use the form's
ActiveControl property to tell it. However, you do need to do the work
at design time to get the functions called by the appropriate events.
And it won't work properly on continuous forms.

You can also use Conditional Formatting -- in Access 2000 or later -- to
set various formatting attributes of each control depending on whether
it has the focus or not. That will work on continuous forms, but you
have to set it at design time for each individual control.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
I appreciate the info. I'll set each control.
Thanks again,
Walter
 
Back
Top