Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Preselect sub menu item
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Preselect sub menu item

 Post Reply Post Reply
Author
Message
rdeboer View Drop Down
Groupie
Groupie


Joined: 29 April 2004
Location: Netherlands
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdeboer Quote  Post ReplyReply Direct Link To This Post Topic: Preselect sub menu item
    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
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 21 December 2010 at 1:11pm
I think you want Control.Checked property
Back to Top
rdeboer View Drop Down
Groupie
Groupie


Joined: 29 April 2004
Location: Netherlands
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdeboer Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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....
Back to Top
rdeboer View Drop Down
Groupie
Groupie


Joined: 29 April 2004
Location: Netherlands
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdeboer Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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....
Back to Top
rdeboer View Drop Down
Groupie
Groupie


Joined: 29 April 2004
Location: Netherlands
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdeboer Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.