Print Page | Close Window

Preselect sub menu item

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=17710
Printed Date: 06 October 2024 at 4:23am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Preselect sub menu item
Posted By: rdeboer
Subject: Preselect sub menu item
Date Posted: 21 December 2010 at 12:56pm
Hi,

How do i pre select a submenu item in CommandBars?

For instance i have a menu: File -> Zoom and Zoom has 3 items (zoom1, zoom2, zoom3)

I want to preselect Zoom3, but not execute it yet.

Something like:

CommandBars.Controls(ID_ZOOM3).Selected = true

 


-------------
Product: Xtreme Suite Pro (ActiveX) version 11
Platform: Windows XP SP3 (32bit)
Language: Visual Basic 6.0 SP6



Replies:
Posted By: SuperMario
Date Posted: 21 December 2010 at 1:11pm
I think you want Control.Checked property


Posted By: rdeboer
Date Posted: 21 December 2010 at 1:17pm
I'm not sure if its checked property.

I want to select PageWidth item directly from code. Something like CommandBars.Controls(ID_PAGEWIDTH).Selected = True

Look at this picture as example:




-------------
Product: Xtreme Suite Pro (ActiveX) version 11
Platform: Windows XP SP3 (32bit)
Language: Visual Basic 6.0 SP6


Posted By: Aaron
Date Posted: 22 December 2010 at 8:45am
Hi,
 
Try this:
 
CommandBars.FindControl(, ID_MENU_ITEM, True, True).Execute 'Opens menu item
CommandBars.FindControl(, ID_MENU_SUBITEM, True, True).SetFocus 'Selects subitem
 
 
 
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: rdeboer
Date Posted: 22 December 2010 at 11:48am
That seems to work in that sample, now im trying to get it to work in the RibbonSample, with the menu you get when you click the logo on the left top, but your code doesn't seem to work on this one :(









-------------
Product: Xtreme Suite Pro (ActiveX) version 11
Platform: Windows XP SP3 (32bit)
Language: Visual Basic 6.0 SP6


Posted By: Aaron
Date Posted: 22 December 2010 at 12:51pm
Hi,
 
Of course it doesn't work, you need to "open" menu first. With "normal" menu use above code and with Ribbonbar you need to "simulate" ControlSystemButton click
 
Dim RibbonBar As RibbonBar
Set RibbonBar = CommandBars.ActiveMenuBar
RibbonBar.ControlSystemButton.Execute 'Shows menu
 
.....
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: rdeboer
Date Posted: 23 December 2010 at 9:36am
That worked!

Thanks again for your help!

Happy holidays!




-------------
Product: Xtreme Suite Pro (ActiveX) version 11
Platform: Windows XP SP3 (32bit)
Language: Visual Basic 6.0 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