newbie ribbon Qu: set checkbox value (1 Viewer)

ozinm

Human Coffee Siphon
Local time
Today, 23:57
Joined
Jul 10, 2003
Messages
121
hi all,
I thought it was high time I got to grips with how to implement custom ribbons.
I've managed to write some xml and subs that trigger when buttons, etc are pressed.

what i can't figure out is, with checkboxes, how I set their value dynamically.

I have a form with a boolean field in it.
I'd like to have a checkbox on the form's ribbon to display the field value.

From what I can make out, the ribbon can directly reference the field data but I'm assuming I can write a OnCurrent to update the ribbon value to match the records boolean field value.

The problem is I haven't been able to figure out how I set the value on the ribbon.

Can some kind person, please point me in the right direction?

Thanks in advance
M.
 

Avelino

Registered User.
Local time
Today, 19:57
Joined
Dec 10, 2009
Messages
56
Hi
You change the values of a ribbon, at runtime, through the use of attributes GETS. (getVisible, getEnabled, getLabel, ...).

The "gets" automatically trigger when the ribbom is first loaded. To trigger any of the attibutes "gets" again, use the method Invalidate or InvalidateControl.

Here's an article that teaches how to use the attributes gets.

http://www.ribbon01.com/tutoriais/tuto10eng.asp#inicio


If not resolved, I can mount an example for you.

Good study
 
Last edited:

ozinm

Human Coffee Siphon
Local time
Today, 23:57
Joined
Jul 10, 2003
Messages
121
thanks for the response.

Looking at the link you posted, I think I'm correct in thinking that:
I have to define a get parameter in the XML that will call a vbfunction which returns the value I want to set for the checkbox.

The vbfunction is only called when the ribbon is first opened so I have to get the ribbon to refresh using invalidate or invalidatecontrol method.

All of that shouldn't be a problem to implement.

One question I still don't get though....
What xml get[parameter] stores the checkbox ticked/unticked value?
e.g. is it: getenabled, getlabel, getvisible etc. - none of them sound suitable.
 

Avelino

Registered User.
Local time
Today, 19:57
Joined
Dec 10, 2009
Messages
56
For the checkbox you have the attribute getPressed
your procedure:

Sub fncGetPressed (control as IRibbonControl, ByRef bolReturn)
'Callback Checkbox State
Select Case control.ID
Case "MyCheckBox"
'Here do you change the condition of bolReturn conforms to your form
bolReturn = True/false
End Select
End Sub

Xml:

...
<Checkbox id = "MyCheckBox" label = "My CheckBox"
getPressed = "fncGetPressed"
OnAction = "fncOnAction" />
..
 
Last edited:

ozinm

Human Coffee Siphon
Local time
Today, 23:57
Joined
Jul 10, 2003
Messages
121
Hi Avelino,
Thanks for all your help. Worked like a charm!

For anyone else getting started with this -
I'm not sure if this helps but It took me a while to wrap my head around the concept. I don't directly set values on the Ribbon. Instead it sets values by calling subs that I define.
Now I've got that straight in my mind it's not so difficult!
 

Avelino

Registered User.
Local time
Today, 19:57
Joined
Dec 10, 2009
Messages
56
Thanks for your feedback and success in your project.
 

Users who are viewing this thread

Top Bottom