Print Page | Close Window

How to Find Control in PopUpBar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=11115
Printed Date: 26 April 2024 at 10:36am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to Find Control in PopUpBar
Posted By: chrisABC
Subject: How to Find Control in PopUpBar
Date 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



Replies:
Posted By: Oleg
Date Posted: 19 June 2008 at 3:26pm
What error ?

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: chrisABC
Date Posted: 19 June 2008 at 5:50pm
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


Posted By: Oleg
Date Posted: 20 June 2008 at 1:30am
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


Posted By: chrisABC
Date Posted: 20 June 2008 at 3:40am
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


Posted By: Oleg
Date Posted: 20 June 2008 at 3:17pm

When you start read my answers :)

In FindControl set last parameter to True.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: chrisABC
Date Posted: 20 June 2008 at 6:51pm
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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net