[AccessD] Ribbon
John Colby
jwcolby at gmail.com
Fri Jan 28 09:32:11 CST 2022
Sorry, I didn't add myself to the To: of the previous message. I am
answering this way because the previous thread was too long to go through
any more.
It absolutely is possible to quickly and easily use a class in a form's CBF.
1) Dim the class variable in the header.
2) In the form's OnOpen instantiate the class and sign to the variable you
just created. Pass in a pointer to whatever control you want to manage to
that class instance. In that class, sink whatever events you want to
respond to.
What this does is remove the event sinking from the CBF of the form and
places said event sinking into the class. Inside of that class (which I
call a "wrapper" class for the gawd awful music they make ;) do whatever
you wanted that control to do. Turn on and off the toolbar or whatever ...
Copy and paste the code you just created in this CBF into every other
form's CBF.
I haven't been following this thread closely. I am just responding really
to the comment "classes are for controls, not forms. NOT the case. They
are for both.
Got it. I doubt highly that you can do what you are aiming to do because a
form has to be instantiated before its object properties and events are
“live”.
On Tue, Jan 25, 2022 at 11:42 AM Ryan W <wrwehler at gmail.com> wrote:
> As for "Class Modules are for controls not forms", I have some class
> modules that control events on forms using WithEvents, thanks to Mr.
Colby.
>
> The question if whether I can instantiate a class module on a closed form
> that would "wake up" when the form is opened was a thought I had.
>
>
>
> On Tue, Jan 25, 2022 at 7:38 AM Bill Benson <bensonforums at gmail.com>
> wrote:
>
> > So even if modifying a ton of forma takes little to no effort, you
aren’t
> > interested?
> >
> > Class modules are for controls not forms. If you want something to
happen
> > in a form event you unfortunately have to put the code in the form.
> >
> > Which I showed how to do easily.
> >
> > On Tue, Jan 25, 2022 at 7:43 AM Ryan Wehler <wrwehler at gmail.com> wrote:
> >
> > > Yes I plan to call a procedure in the form event, I just was looking
> for
> > a
> > > way to do it without modifying a ton of forms. Which is why a class
> came
> > to
> > > mind withevents
> > >
--
John W. Colby
Colby Consulting
More information about the AccessD
mailing list