[AccessD] Tab Control Hover Color Changing

John Colby jwcolby at gmail.com
Thu Apr 28 15:46:43 CDT 2022


My head hurts!  What I think I know is that each tab page is a control.
The tab is a control, and the tab pages are actual controls which are
children of the Tab control.  There is a controls collection that contains
the tab pages.  The pages can be manipulated by setting a variable to point
to one of the tab pages (index into that collection) and then read / write
the various tab page properties.

Which quickly gets clunky.  The problem is that if you want to do anything
with a control such as a tab control, any code for that control has to be
placed into the *FORM'S* "code behind form" class module.  Likewise the
code for the individual tab pages.  Soon the form's class has been overrun
with code having nothing to do with the form.

You know me, I tend to use classes to "wrap" controls.  The form (and
report) is the only thing that has a built in class to hold code and
variables.  But any class (that we design) can "wrap" a control.  We pass
(for example) a tab page control into the class and store a pointer to that
in a variable in the header of said class.  Now you can have code that
manipulates that exact tab page, stored right there with thas specific tab
page.  The class wrapper can read the control properties to discover their
state.  It can write to the control properties to cause the control to do
something.  It can sink the events from the control to cause the class to
execute code that you write when an event fires.  Now you have an instance
of a class for each tab page.

This is precisely how I accomplish my "JIT" subforms.

So I have no idea specifically what is going on with the individual tab
page controls in your example.  But if there are control properties that
are used to read and write these colors, then a wrapper class can hold an
instance   of (pointer to) a specific tab page and do whatever you want to
that page, whenever you want it to do that.  Hold "original state" to look
back at as needed.

You should be able to read the colors out as the form opens, and manipulate
the colors with code as you desire.  If you figure out the code to do this,
and place that code into a wrapper class, then the exact same code will
work for whichever tab needs to be manipulated, stored right in the wrapper
class along with a pointer to a specific tab.

On Thu, Apr 28, 2022 at 3:52 PM David Emerson <newsgrps at dalyn.co.nz> wrote:

> Hi Listers,
>
> I have a form with a tab control.  There are 14 tabs. The Style property is
> set to Buttons.  The Use Theme property is set to No (This is because Use
> Theme doesn't allow Multi-Row, and in Design View the tab control can't be
> made narrower than the width of all the buttons - the buttons are wider
> than
> the form width so the form cannot be sized to fit the form width)
>
> Depending on the value of a field on the first tab, the subsequent tabs are
> either set to visible or not.
>
> If I don't change any tabs (ie set them to visible or not) then when I
> hover
> over a tab button the font color stays the same.  However, when I do change
> any tabs by setting them visible or invisible, then the hover color of the
> font is a light blue.  I do not want the hover color to change.
>
> I have tried changing the Hover color property but this is only relevant if
> the Use Theme property is set to Yes.
>
> I have 2 other tab forms that act in the same way - hover color if I make
> tabs invisible, no color if I don't hide tabs.
>
> I have tested it in a different database with the same result.
>
> Has anyone come across this before?
>
> My current solution is to create an extra tab on the other 2 forms and hide
> it when the form loads - this means all the tabs show the hover color.
>
> Ideally I would like to either not have the hover color show (it is a light
> blue), or be able to change it to a color that suits the color scheme for
> the application.
>
> Regards
>
> David Emerson
> Dalyn Software Ltd
> Wellington, New Zealand
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


-- 
John W. Colby
Colby Consulting


More information about the AccessD mailing list