Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - [SOLVED] Finding each control with same ID
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[SOLVED] Finding each control with same ID

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


Joined: 13 May 2009
Status: Offline
Points: 71
Post Options Post Options   Thanks (0) Thanks(0)   Quote sforces Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED] Finding each control with same ID
    Posted: 07 August 2010 at 3:27pm
I am using RibbonBar and directly on it I have a checkbox control to "Enable XYZ" and ID_OPTION_ENABLE_XYZ.

I also have a "Options" popup control and a button control there is also "Enable XYZ" and ID_OPTION_ENABLE_XYZ.

I thought that if I use same ID (as they are really same) that when I use "FindControl" method, it would toggle the Checked property for both of them. But it only finds one and the other isn't toggled.

1) Is it a bad idea to have same ID?
2) I thought about using a for each loop on the commandbars objects, checking the ID and checked state but I don't think that's very efficient. How do I efficiently find all controls with same ID and toggle them?
Product: Xtreme Suite Pro (ActiveX) version 16.3.1

Platform: Windows XP SP3 (32bit)

Language: Visual Basic 6.0 SP6
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 07 August 2010 at 4:07pm
I think you should be using Actions in this case - check out the Actions sample that comes with the suite.

With actions, you can associate multiple controls with a single action, and then enable/disable an action and all of the associated controls will be enabled/disabled accordingly.
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
sforces View Drop Down
Groupie
Groupie


Joined: 13 May 2009
Status: Offline
Points: 71
Post Options Post Options   Thanks (0) Thanks(0)   Quote sforces Quote  Post ReplyReply Direct Link To This Post Posted: 09 August 2010 at 9:58am
Thank you. This is exactly what I was looking for!

Originally posted by jpbro jpbro wrote:

I think you should be using Actions in this case - check out the Actions sample that comes with the suite.With actions, you can associate multiple controls with a single action, and then enable/disable an action and all of the associated controls will be enabled/disabled accordingly.
Product: Xtreme Suite Pro (ActiveX) version 16.3.1

Platform: Windows XP SP3 (32bit)

Language: Visual Basic 6.0 SP6
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 09 August 2010 at 11:36am
Glad to help!
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

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.