473,836 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom Collection Class woes

I'm in the process of expanding my knowledge and use of Class Modules.
I've perused MSDN and this and other sites, and I'm pretty comfortable
with my understanding of Class Modules with the exception of custom
Collection Classes.

Background: I'm developing an A2K .mdb to be deployed as an .mde at my
current job-site. It has several custom controls which utilize custom
classes to wrap built-in controls, and add additional functionality. In
my job, I'm only at this site for about another year, and I'd like for
the folks that follow me here to be able to add the same custom
controls with minimal effort on forms they may need to construct down
the road. Making them a custom class also reduces the repetition of
reinventing them for every form I construct.

Details on the controls:

Type1 is an image control that acts like a command/toggle button. The
control has three states and is used to call code to bring up the
Office Assistant to serve a WhatsThis type function. That functionality
doesn't require a compiled help file, but gets its display inputs from
the database itself. This control has three states. Initially it is
flat with a dimmed image. OnMouseMove it is raised with a clear image.
OnClick it is armed for Assistant calls, and the image is sunken with a
dark image. On subsequent Clicks, the Assistant goes away, and the
button returns to its raised state. OnMouseOut which is simulated using
ctl.Section.OnM ouseMove, the button returns to its default, flat,
state.

Type2 is a label control that acts like a hyperlink. It has similar
OnMouseMove, OnMouseDown, and OnMouseUp functionality to Type1 and also
utilizes ctl.Section.OnM ouseMove to simulate MouseOut behaviour.

Both types are associated with existing controls using this code in the
form that utilizes them:

************
' Declarations section
************
Public/Private mclsControlX as CustomClass
' Public for Type1 to allow the Assistant to
' change the state of the control when
' cancelled and Private for Type2.
************
' Form_Load code
************
Set mclsControlX = New CustomClass
Set mclsControlX.Co ntrol(x, y) = ctlControlOnFor m

Problem 1: After reference to the aforementioned sources, I've been
able to create a custom Collection Class that wraps the built-in
Collection type. What I've been unable to do is assign all the
CustomClass objects to the same Collection. I've tried establishing a
reference to the collection in the CustomControl.C ontrol Property Set
procedure, but this has failed. I use this code for that Property Set:

************
' CustomClass module
************
Public Property Set Control(x ..., y ..., img as Image)
....
Dim col as CustomCollectio n
Set col = New CustomCollectio n
col.ClsControls .Add img, img.Name

The Initialize and Terminate events for the CustomCollectio n fire every
time this Property Set code runs and the Collection is neither singular
(collecting every control of TypeX), nor persistant. How do I make the
Collection both singular and persistant?

I tried using:

If col.ClsControls .Count > 0

But, that throws object Error 91 every time because this instance of
the CustomCollectio n hasn't been created, yet.

How do I set this CustomCollectio n up to wrap a built-in Collection and
become a container for all CustomClass objects of Type1 or Type2,
respectively?

Problem 2: I can't really tell when the Terminate event for the
CustomClass objects is firing. Since I don't want to leave unassociated
or dormant Class objects laying around in memory, I have been setting
the module level object variable that contains the reference to these
objects to Nothing in the Terminate event. Do I need to remove that
reference with the Nothing keyword to the Form_Unload event where the
controls are instantiated or is the Terminate event of the Class
sufficient?

Hope that's descriptive enough. If not, I'll try to clear the fog
wherever there is any.

Thanks in advance.

Jamey Shuemaker

Feb 19 '06
19 4926

David W. Fenton wrote:
1. are you creating a new instance of the class for each instance of
your custom control? If so, then I must have misunderstood what
you're doing, since each instance of the class would have only one
member in its internal collection.
No. The intention was to have a single collection for all class objects
of a particular type.
2. you originally said you were working with a class wrapper around
a custom collection. That would mean that you'd want to use the same
class instance for all the items you are adding to your collection.
As you know, a custom class cannot be a public member of a class
module, so you have to create a wrapper around the collection to
populate it and clear items from it.
Got that. Didn't when we started this inquest.
3. for a class instance to be used in multiple forms, the variable
used to refer to that class instance has to be publicly available at
all times. That means you either make it a public member of class
omdule or as a public member of a form that is always open. I'd
think that the former is easier than the latter, but I could see
circumstances where you'd do that latter (a form is, after all, just
a class module with a user interface included along with it).
Wait a minute. Didn't you say in #2 above that custom classes cannot be
public members of a class module? I think you meant they can't be
public members of their own class module. Is that right?
4. if you declare your class variable with the NEW keyword, any call
to the class instance will initialize it. If you *don't* declare it
with the NEW keyword, you must initialize the class module before
using it. This can be done in startup code, or it could be done in
the OnOpen events of each form that uses the class instance (by
checking if it's Nothing and initializing if it is; that could
easily be put in a public function somewhere).
Once a custom class wrapping a collection is initialized, I can add to
it as long as it is open. It will stay open as long as the Form or
Module that initialized it is open, right?

On another note, if I don't set that reference to Nothing when the form
closes it stays in memory regardless of whether I can still reference
it, correct?
Now, those are all things that have an effect on scope, and if I've
understood what you're trying to do, you're simply declaring the
variable for your class instance in the wrong place.
I'm pretty sure that was the case. See below for current status on the
class modules.
But, as I said, I was very confused by what you've posted, so all of
what I"ve written above may be useless to you.


Not at all.

Feb 21 '06 #11
rkc
Jamey Shuemaker wrote:
Questions that remain:

Am I adequately killing off all the custom class objects with the
Terminate events and the Form_Unload procedure? Do I need to enumerate
through all elements of the Form module level "mclsCol" object variable
and use the Remove method to get them out of memory, as well?

Do I need something like this in the Initialize event for each custom
class?

*********
Private Sub Class_Initializ e()
Set mCol = New Collection
End Sub
*********


Yes, you do need to do something like that in each CustomClass.
What you have now won't run without an error because the collection
is never actually created.

There is no collection created at form level so there is nothing to
unload. The unloading is handled in your CustomCollectio n class. As
far as I can see that is the only reason for the class as it you
have shown it.



Feb 21 '06 #12
rkc
rkc wrote:
Yes, you do need to do something like that in each CustomClass.
What you have now won't run without an error because the collection
is never actually created.


<edit>
CustomClass should read CustomCollectio n
</edit>
Feb 21 '06 #13
"Jamey Shuemaker" <ca*********@ya hoo.com> wrote in
news:11******** **************@ g47g2000cwa.goo glegroups.com:
David W. Fenton wrote:
1. are you creating a new instance of the class for each instance
of your custom control? If so, then I must have misunderstood
what you're doing, since each instance of the class would have
only one member in its internal collection.
No. The intention was to have a single collection for all class
objects of a particular type.


On multiple forms? If so, then I don't know why you'd ever have
contemplated declaring the variable used for your class instance at
the form level.
2. you originally said you were working with a class wrapper
around a custom collection. That would mean that you'd want to
use the same class instance for all the items you are adding to
your collection. As you know, a custom class cannot be a public
member of a class module, so you have to create a wrapper around
the collection to populate it and clear items from it.


Got that. Didn't when we started this inquest.


Above, what I meant to write was:

A custom COLLECTION cannot be a public member. . .

Don't know why I typed that.
3. for a class instance to be used in multiple forms, the
variable used to refer to that class instance has to be publicly
available at all times. That means you either make it a public
member of class omdule or as a public member of a form that is
always open. I'd think that the former is easier than the latter,
but I could see circumstances where you'd do that latter (a form
is, after all, just a class module with a user interface included
along with it).


Wait a minute. Didn't you say in #2 above that custom classes
cannot be public members of a class module? . . .


No. Above I meant to write custom *collections*, which, like arrays,
cannot be public members of a class module. If you try declaring a
custom collection or an array as public in a class module, you'll
get a compile error, and a useful error message telling you that you
can't do it. This is why you have to wrap the private
collection/array in a function/method/property in order to use it.
. . . I think you meant they can't be
public members of their own class module. Is that right?
Collections, not classes. I don't know if class instances can be
public members of classes, but you can test it yourself and find
out.
4. if you declare your class variable with the NEW keyword, any
call to the class instance will initialize it. If you *don't*
declare it with the NEW keyword, you must initialize the class
module before using it. This can be done in startup code, or it
could be done in the OnOpen events of each form that uses the
class instance (by checking if it's Nothing and initializing if
it is; that could easily be put in a public function somewhere).


Once a custom class wrapping a collection is initialized, I can
add to it as long as it is open. It will stay open as long as the
Form or Module that initialized it is open, right?


Yes.

But if you want the class to be used by multiple forms, then you
really oughtn't be declaring it at the form module level.
On another note, if I don't set that reference to Nothing when the
form closes it stays in memory regardless of whether I can still
reference it, correct?


Well, that's a good question. Theoretically, if the variable you're
using for your class instance is declared in the form module, then
closing the form should destroy the class instance.

That's why I'd tend to declare such a variable in a public module,
instead of in a form module. But I"m also assuming you're using a
single class instance for multiple forms.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Feb 21 '06 #14
"Jamey Shuemaker" <ca*********@ya hoo.com> wrote in
news:11******** **************@ g44g2000cwa.goo glegroups.com:
Am I adequately killing off all the custom class objects with the
Terminate events and the Form_Unload procedure? Do I need to
enumerate through all elements of the Form module level "mclsCol"
object variable and use the Remove method to get them out of
memory, as well?

Do I need something like this in the Initialize event for each
custom class?

*********
Private Sub Class_Initializ e()
Set mCol = New Collection
End Sub
*********
I would say yes to that, but I'm confused on the architecture of
your code. I thought the custom collection was defined in the class
wrapper, not in the custom control class module (you really ought to
use better names for your classes, since the names you've used here
are completely generic and have meanings of their own, independent
of their use as the names of your class modules).

On the other hand, if you've declared the collection in the class
module with the NEW keyword, you don't need to initialize it, as the
first use of it will automatically initialize the collection.

I still think you are confused.

I certainly am, but in attempting to define what's confused about
your code, I'm not sure I have answers to enough questions to be
helpful. Let me take one code snippet and suggest what I see as
wrong with it:
*********
' Form Module Declarations
*********
Private mclsCol as CustomCollectio n
Public mclsBtn0 as CustomClass
Private mclsBtn1 as CustomClass


If the CustomCollectio n class instance is supposed to be used by
more than one form, then the declaration for your class instance
should not be here. If you want it to be used by only the two
instances of CustomClass that you are declaring in this form, then
it's OK for the collection to be defined here.

I think there's something structurally wrong here. You are declaring
a class instance for your custom collection, but I don't see that
this class instance (named mclsCol) is used in the class instances
you create for the controls.

It would seem to me that you'd have a single global class instance
of your custom collection wrapper, and its variable would be global.
That instance would then by used by the control class modules, and
you'd create as many instances of the control class as you needed.

This would also mean that your terminate code in the control class
would need to check the number of controls in the public collection
class, and terminate it only if the collection is empty.

Also, you'd want to remove the reference to the control used by each
instance of the control class from the global collection class
instance.

But I may have completely misunderstood your code, so all of the
above may be more confusing than helpful.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Feb 21 '06 #15
rkc
David W. Fenton wrote:
But I may have completely misunderstood your code, so all of the
above may be more confusing than helpful.

The "CustomCollecti on" is simply used here as a way to not
have to declare a form level "CustomClas s" variable for each
individual image-button widget. It may be the foundation for
something more, but here it could just as well be an unwrapped
instance of a vba.collection.

Feb 22 '06 #16
rkc <rk*@rochester. yabba.dabba.do. rr.bomb> wrote in
news:H6******** **********@twis ter.nyroc.rr.co m:
David W. Fenton wrote:
But I may have completely misunderstood your code, so all of the
above may be more confusing than helpful.
The "CustomCollecti on" is simply used here as a way to not
have to declare a form level "CustomClas s" variable for each
individual image-button widget. It may be the foundation for
something more, but here it could just as well be an unwrapped
instance of a vba.collection.


Well, that would be exactly what I'd use it for, but he's declaring
a variable in each of his form modules, according to the code he
posted:
*********
' Form Module Declarations
*********
Private mclsCol as CustomCollectio n
Public mclsBtn0 as CustomClass
Private mclsBtn1 as CustomClass


That seemed to me to be a mistake, but that's the way he's doing it,
according to his code.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Feb 22 '06 #17
rkc
David W. Fenton wrote:
rkc <rk*@rochester. yabba.dabba.do. rr.bomb> wrote in
news:H6******** **********@twis ter.nyroc.rr.co m:

David W. Fenton wrote:

But I may have completely misunderstood your code, so all of the
above may be more confusing than helpful.


The "CustomCollecti on" is simply used here as a way to not
have to declare a form level "CustomClas s" variable for each
individual image-button widget. It may be the foundation for
something more, but here it could just as well be an unwrapped
instance of a vba.collection.

Well, that would be exactly what I'd use it for, but he's declaring
a variable in each of his form modules, according to the code he
posted:

*********
' Form Module Declarations
*********
Private mclsCol as CustomCollectio n
Public mclsBtn0 as CustomClass
Private mclsBtn1 as CustomClass

That seemed to me to be a mistake, but that's the way he's doing it,
according to his code.


I don't see any point in making the scope of the collection anything
other than form level. The widgets only exist if the form is open.
Making the collection global would just increase the complexity of
managing the disposal of the class instances, if that is in fact
necessary. I am taking Terry Kreft's word that it is. Not doing it
in the past never caused me any problems.


Feb 22 '06 #18
rkc <rk*@rochester. yabba.dabba.do. rr.bomb> wrote in
news:jT******** ***********@twi ster.nyroc.rr.c om:
David W. Fenton wrote:
rkc <rk*@rochester. yabba.dabba.do. rr.bomb> wrote in
news:H6******** **********@twis ter.nyroc.rr.co m:

David W. Fenton wrote:
But I may have completely misunderstood your code, so all of the
above may be more confusing than helpful.

The "CustomCollecti on" is simply used here as a way to not
have to declare a form level "CustomClas s" variable for each
individual image-button widget. It may be the foundation for
something more, but here it could just as well be an unwrapped
instance of a vba.collection.

Well, that would be exactly what I'd use it for, but he's
declaring a variable in each of his form modules, according to
the code he posted:

*********
' Form Module Declarations
*********
Private mclsCol as CustomCollectio n
Public mclsBtn0 as CustomClass
Private mclsBtn1 as CustomClass

That seemed to me to be a mistake, but that's the way he's doing
it, according to his code.


I don't see any point in making the scope of the collection
anything other than form level. The widgets only exist if the form
is open. Making the collection global would just increase the
complexity of managing the disposal of the class instances, if
that is in fact necessary. I am taking Terry Kreft's word that it
is. Not doing it in the past never caused me any problems.


Well, I'm just going on what I thought the original poster said he
wanted, which was a single collection for all instances of the
controls on all forms.

Maybe I misunderstood.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Feb 22 '06 #19

David W. Fenton wrote:
Well, I'm just going on what I thought the original poster said he
wanted, which was a single collection for all instances of the
controls on all forms.


First off, sorry I haven't been able to check back and answer more of
your questions about the intent of the code, till now. Things at work
and school have been quite busy.

RKC is right, I didn't intend for the collection to have scope beyond
the form level or remain after the form was closed. As it is, I didn't
envision any use for it above the form level where the custom classes
are associated with the actual image objects on the form. The only use
I had for the collection itself was to control the MouseOut type
behavior I was using to change the state of the images back to their
flat perspective.

Here's the intention of the custom class objects as I originally
envisioned it.

1. The custom classes (wrapping an image object) were originally
intended to allow the image swapping behavior. I've used nested images
with code in each form to change their visibility on mouse events to
provide the same display potental. In their flat state, they should
remain flat with subdued coloring on the form. OnMouseMove, they should
become raised with clear coloration, and OnMouseDown they should either
go to an armed state or give the appearance of response to a mouse
click like a command button or toggle button does when depressed, then
reverting to their raised state OnMouseUp and flat when the mouse moves
away from the control. The type enumeration that I implemented allowed
various different images (and other display data like width and height)
to be assigned to similar but not identical buttons. Setting the
'Control' property on those objects and assigning a reference to a
physical image control allowed me to set events for the class module to
accomplish the above without having to replicate it with three nested
images in each form. It also allowed me to set the events of the
section in which the image is located to return the image to its
default state without having to implement code in every form to provide
the MouseOut functionality.

2. The custom collection, at first, was an experiment based on the MSDN
Class Object article to see if I could get it to work and collect all
of the custom class buttons for easy reference outside of that
particular module (form, class, or otherwise). Obviously, any use of
the custom collection will have to be of adequate scope to remain in
memory as long as I have a need to reference it. I don't presently have
a need for any external reference to the collection or its controls
beyond the level of the form that contains them, so I didn't declare
the collection (or the buttons for that matter) at module level, only
at Form level. I do have a use for the collection at form level,
however. When a group of these controls, say a pair of spinner (single
unit increment/decrement) buttons are placed next to one another with
little or no space between them, I need the individual buttons to
revert to their subdued or flat state when the mouse moves off of the
increment button and onto the decrement button. With no space between
them the OnMouseMove event created for the section defined by the class
element doesn't fire, because the mouse never moves over that section.
Again, I don't think I need to declare this custom collection beyond
the form level because I don't use it for anything fancier than
changing display attributes while the form in question has the focus.

I do have a custom Context Sensitive Help (CSH) button (Type 0 of the
enumerated types of this custom class) which relies on module level
functions and subs to control the Office Assistant and provide
information for the user based on user clicks following the "arming" of
the CSH button on the form. For that, the Assistant can be canceled in
the Assistant's Balloon object as well as on the form itself with a
subsequant click of the CSH button. Since the Assistant may also change
the display of the form's button when cancelled in the balloon, the
object variable that assigns a reference to the actual image control on
the form does have global scope.

The code I'm running now accurately reflects the appropriate mouse and
click events, though I am still working on the custom collection for
the functionality mentioned in #2 above for controls that are in near
proximity.

I also have to dig into the API references I have to try to find an
easy way to intercept clicks after the application is placed in
WhatsThisMode to circumvent the built-in WhatsThis functionality. I'd
still like to keep the "What's This" pointer, but I don't actually want
the help file resource referenced, rather preferring to do that with a
reference table with the necessary information because the point-click
behaviors of HTML Help Workshop are a pain in the ass.

Anybody know of an API to interrupt mouse and click behavior or
interupt calls to the help object?

Feb 23 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2193
by: rufus | last post by:
Hi, I have a custom collection class that inherits from HashTable. When I add a new CustomObject to my CustomCollection I would like to ensure that it will only accept objects of type CustomObject. How would I do this? Thanks in advance. Public Class CustomCollection Inherits Hashtable ' default constructor
0
1937
by: Sundown | last post by:
I am trying to create a custom button control for the web that, when clicked, disables and changes the text of itself and a bunch of other controls (in the collection). My goal is to end up with a button that prevents the user from submitting a form back multiple times and also prevents them from submitting the form and then clicking something else before the postback can finish processing. What I have is a working button that disables...
3
7005
by: Anthony Bouch | last post by:
Hi I've been reading using the XmlSerializer with custom collections. I've discovered that when serializing a custom collection (a class that implements ICollection, IList etc.) the XmlSerializer will only serialize the collection items - with the default root as ArrayofMyItems etc. My custom collection class has some additional public properties that I would like to include in the serialization above the items element array (in
8
3200
by: Tinus | last post by:
Hello all, I've create a custom control (UserControl) and have a custom Item Collection. The control is a custom calendar which is draw using the Graphics Rectangle etc. functions. It is drawn when the control is painted or resized. When the control is drawn it draws also the items found in the collection. So far so good.... I have 3 questions which I'm unable to find a solution
1
1414
by: Jeff S | last post by:
I'm storing a list of widgets in a database. The list changes infrequently (twice per week at most), and is relatively short (200 items at most, with very little detail per item). A small subset of all possible widgets will be displayed on a page (using VB.NET/code behind). I plan to populate a custom collection/class with a list of all possible widgets. The class will include a method that returns the required subset. Of course the logic...
3
1364
by: Matthias S. | last post by:
Hi there, I have a typesafe collection in my application called Countries, which is derived from the ReadOnlyCollectionBase. As you might guess, the item-value is of type Country. Each Country has (for now) and ID and a Name property. Now I'd like to use a CheckBoxList to display the contents of my Countries collection and let the user select some:
2
2453
by: AMDRIT | last post by:
Hello everyone, I have created a custom component and one of its properties is a class object with it's own properties. During runtime, I can assign values to the class object properties just fine. However, when attempting to assing default values as designtime in the propertygrid, nothing is working on the class object. I know that I am doing it wrong, any ideas what it is? Thanks in advance
0
3467
by: Pieter | last post by:
Hi, I'm using NHibernate 1.2 (CR1), and I'm using a custom list (inherited from BindingList(Of T) ) for all my lists. The NHibernate documentation told me that I had to implement IUserCollectionType to my custom list, which I did. But I still get an error when trying to read the object: " {"Unable to cast object of type 'NHibernate.Collection.Generic.PersistentGenericBag`1' to
0
9825
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9673
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10859
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10260
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9388
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5829
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4463
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.