How to Find Control in PopUpBar |
Post Reply |
Author | |
chrisABC
Senior Member Joined: 05 June 2008 Status: Offline Points: 258 |
Post Options
Thanks(0)
Posted: 19 June 2008 at 2:48pm |
Using the RibbonBar Sample
there are buttons added to the File popdown menu, eg. ID_FILE_MYTEST How can I "find" these controls on the popdown menu? CommandBars.FindControl(, ID_FILE_MYTEST) just gives error. so I guess CommandBars is not the correct object to use. |
|
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
What error ?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
chrisABC
Senior Member Joined: 05 June 2008 Status: Offline Points: 258 |
Post Options
Thanks(0)
|
Run Time Error 91
Object Variable or With Block variable not set ALSO: If I pause program and do: For i = 1 to CommandBars(1).Controls.count Debug.Print CommandBars(1).Controls(i).Caption Next This prints out all the buttons on the RibbonBar, but NOT any of the controls on the popdown Menus. How can I access the controls on the Menus?? |
|
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
In FindControl set last parameter to True.
try this code
Debug.Print CommandBars(1).Controls(0).CommandBars.Controls(0).Caption
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
chrisABC
Senior Member Joined: 05 June 2008 Status: Offline Points: 258 |
Post Options
Thanks(0)
|
This does not work.
Setting FindControl last paramter = True makes no difference. CommandBars(1).Controls(0). does not have property CommandBars To see the problem, use your Ribbon MDI sample (ActiveX) Put a Break Point somewhere in FrmMain (eg. in mnuFileOpen_Click()) When program breaks (eg Click on File Open), go to Immediate Window and try: ? CommandBars(1).FindControl(, ID_FILE_MRU_FILE1, False).Caption I get Error 91, Object not set. Same error with ..... (, ID_FILE_MRU_FILE1, True).Caption But if you try: ? CommandBars(1).FindControl(, ID_VIEW_NORMAL, False).Caption This works OK. ID_FILE_MRU_FILE1 is ControlButton on PopdownMenu ID_VIEW_NORMAL is ControlButton on RibbonTab - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please can you tell me how to FIND the ID_FILE_MRU_FILE1 control? |
|
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
When you start read my answers :) In FindControl set last parameter to True.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
chrisABC
Senior Member Joined: 05 June 2008 Status: Offline Points: 258 |
Post Options
Thanks(0)
|
Oh, you mean the OTHER last parameter :-)
OK, now I see how to make it work. Thankyou. (I am not good at crossword puzzles either ) |
|
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |