[AccessD] Tab Control Hover Color Changing

David Emerson newsgrps at dalyn.co.nz
Fri Apr 29 00:57:04 CDT 2022


I created a new form, added a 3 page tab, changed the Use Theme property to no, changed the Style to buttons.
Viewing the form provided no hover fore color.

I added a button which set the hover fore color in code.  The buttons now have a hover color but it is the same pale blue (not the red I set it to).

It seems that any vba manipulation of the tab control causes a hover color to appear (but not one that can be changed) ☹

-----Original Message-----
From: AccessD <accessd-bounces+newsgrps=dalyn.co.nz at databaseadvisors.com> On Behalf Of John Colby
Sent: Friday, 29 April 2022 12:54 pm
To: Access Developers discussion and problem solving <accessd at databaseadvisors.com>
Subject: Re: [AccessD] Tab Control Hover Color Changing

https://docs.microsoft.com/en-us/office/vba/api/access.tabcontrol.hoverforecolor

There are properties of the tab control which are "not surfaced in the property sheet".  Meaning they exist and can be manipulated but you can't see them in the property sheet.  Have you played with all these things?
The explanations on this page frankly suck.

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

> That is what I would expect, but the font hover color property only 
> seems to work is the Use Theme property is set to yes (this is no good 
> because of other problems listed in my original email.
>
> -----Original Message-----
> From: AccessD 
> <accessd-bounces+newsgrps=dalyn.co.nz at databaseadvisors.com>
> On
> Behalf Of John Colby
> Sent: Friday, 29 April 2022 11:01 am
> To: Access Developers discussion and problem solving 
> <accessd at databaseadvisors.com>
> Subject: Re: [AccessD] Tab Control Hover Color Changing
>
> Is it by any chance a property of the tab control itself?  Something 
> has to be manipulating the individual pages.
>
> On Thu, Apr 28, 2022 at 5:24 PM David Emerson <newsgrps at dalyn.co.nz>
> wrote:
>
> > Hi John,
> >
> > You have hit the nail on the head with your last paragraph.  If only 
> > I could work out the property that controls the hover fore color.  
> > The one shown in the tab control property box only works when Use 
> > Theme is selected.
> > Individual page controls do not have any properties showing for colors.
> >
> > Regards
> >
> > David Emerson
> > Dalyn Software Ltd
> > Wellington, New Zealand
> >
> >
> >
> > -----Original Message-----
> > From: AccessD
> > <accessd-bounces+newsgrps=dalyn.co.nz at databaseadvisors.com>
> > On
> > Behalf Of John Colby
> > Sent: Friday, 29 April 2022 8:47 am
> > To: Access Developers discussion and problem solving 
> > <accessd at databaseadvisors.com>
> > Subject: Re: [AccessD] Tab Control Hover Color Changing
> >
> > 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
--
AccessD mailing list
AccessD at databaseadvisors.com
https://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list