469,609 Members | 1,829 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Acc2007 - getPressed, should be so simple!

ARC
Ok, this has to be the simplest of all things, but I've searched microsoft's
site, and the entire net!

If you put a toggle button in a ribbon, it is simple enough to get the state
using a callback function: getPressed...

Here's the wrinkle. I have a clear filter button on a form, and I want to
check the state of the toggle button (pushed in or not) from the form, NOT
the toolbar. This should be so simple, but using code like the example below
simply does not work:
Sub CallbackGetPressed(control As IRibbonControl, _
ByRef pressed)

' Callback getPressed

pressed = True

End Sub

Problem is, if you are calling this from a form, you don't seem to have
access to the control and other arguments in the above proc. I simply cannot
find a way to reference this ribbon bar to get the pressed in state. Keep in
mind, I need to find out FROM a button on a form, not from any ribbon xml's
or callbacks.

Help please!~

--
Andy
Jun 27 '07 #1
2 3118
pressed = True

Where is the above value coming from?

When you use call backs, YOUR CODE must set the state of the button.

So, you need to declare a variable to hold the state

m_MybuttionState = true.
I simply cannot find a way to reference this ribbon bar to get the pressed
in state.
You don't reference the bar, you reference YOUR CODE that sets the
state......

The callback code LOOKS TO YOUR code to GET the state. The ribbon no longer
holds the state...YOUR CODE holds the state.

So, you look at YOUR code to get the state...not the ribbon. The ribbon asks
your code what the state of the button is to be...not the other way around.

It is mind set of change that you have to get used to....

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Jun 28 '07 #2
ARC
Many Thanks, Albert. I hope you see this post, as I did finally figure out
that I had to use global variables to store / set the state.

However...A couple big problems:

1) If an error occurs, the global ribbon variable is reset, so any of your
code to set the states no longer work. The only option is to close the
database, and re-open. And I thought maybe I could use the new system
variables of Acces 07, but they won't allow you to set them to objects. I
know I have to get the code bug free, but while I'm doing that, is sure is a
pain to exit the db, and go back in just from a simple error.

2) If 2 ribbons both call the same OnLoad, does this cause a problem? The
onload is simply setting something like: set myribbon = ribbon. But if you
need to access that to do things like getLabel, or onGetPressed, it seems to
cause a problem if 2 separate form ribbons are using the same proc in the
OnLoad.. Hope this makes sense, but I was wondering what the proper way. I'm
sure hoping that each ribbon doesn't need their own global ribbon variable
and separate OnLoad procs... Yikes, that wouldn't be fun.

Thanks again,

"Albert D. Kallal" <Pl*******************@msn.comwrote in message
news:M7Ugi.69903$1i1.9286@pd7urf3no...
> pressed = True

Where is the above value coming from?

When you use call backs, YOUR CODE must set the state of the button.

So, you need to declare a variable to hold the state

m_MybuttionState = true.
>I simply cannot find a way to reference this ribbon bar to get the
pressed in state.

You don't reference the bar, you reference YOUR CODE that sets the
state......

The callback code LOOKS TO YOUR code to GET the state. The ribbon no
longer holds the state...YOUR CODE holds the state.

So, you look at YOUR code to get the state...not the ribbon. The ribbon
asks your code what the state of the button is to be...not the other way
around.

It is mind set of change that you have to get used to....

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com

Jul 4 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by delisonews | last post: by
3 posts views Thread by Patchwork | last post: by
8 posts views Thread by Dan | last post: by
6 posts views Thread by Manuel Collado | last post: by
11 posts views Thread by JKop | last post: by
4 posts views Thread by Steven Blair | last post: by
7 posts views Thread by abcd | last post: by
14 posts views Thread by Giancarlo Berenz | last post: by
reply views Thread by Solution2021 | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.