Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Index param in AddItem Method
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Index param in AddItem Method

 Post Reply Post Reply
Author
Message
jamauss View Drop Down
Newbie
Newbie


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote jamauss Quote  Post ReplyReply Direct Link To This Post Topic: Index param in AddItem Method
    Posted: 27 January 2004 at 12:18pm
I am using the ActiveX XTremeCommandBars. I am putting a combo box into my toolbar. When I call the AddItem method and pass a string and an index value, no items show up in my combo box unless [index] is 1 and then only goes 2, 3, 4 as I add more items. Why does it do this? Is it a requirements to only have sequential index values starting at 1?
Back to Top
robs View Drop Down
Groupie
Groupie


Joined: 09 November 2003
Status: Offline
Points: 84
Post Options Post Options   Thanks (0) Thanks(0)   Quote robs Quote  Post ReplyReply Direct Link To This Post Posted: 04 February 2004 at 9:09pm

jamauss,

I think this is normal. It appears that the 'index' parameter is like the 'before' parameter in a VB collection (although the object doesn't support named arguments).

 c.AddItem "Test1", 1
 c.AddItem "Test2", 2
 c.AddItem "Test3", 2

Is like saying:

add Test1 before anything

add Test2 before the 2nd item (if it exists)

add Test3 before the 2nd item (if it exists)

So the list would be: Test1,Test3, Test2

 

rob



Edited by robs
Back to Top
jamauss View Drop Down
Newbie
Newbie


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote jamauss Quote  Post ReplyReply Direct Link To This Post Posted: 05 February 2004 at 7:19pm

OK, then why don't any of the items in my list appear?

Try adding items using index values like 3, 4, and 5 (in that order) and you'll see that no items appear in your combo box.

Also - there is no "ItemData"-type property for the combo boxes then so you can associate ID values with combo list items? That's practically the whole purpose for having combo boxes. Some functionality is severely lacking here.

Back to Top
robs View Drop Down
Groupie
Groupie


Joined: 09 November 2003
Status: Offline
Points: 84
Post Options Post Options   Thanks (0) Thanks(0)   Quote robs Quote  Post ReplyReply Direct Link To This Post Posted: 05 February 2004 at 8:14pm

Yep, I see what you are saying.

I think what I said before is correct, with an exception:

c.AddItem "Test2",2 will add "Test2" before item 2 if it exists-however, if it does not then it won't add it at all.

I agree with you that the combo boxes are lacking. One would expect them to behave like a standard combo box.

Perhaps the folks at Codejock with recognize this as a bug, or consider it for a future enhancement.

Would you consider using a custom control (standard ComboBox) instead? Then you should have the functionality of a standard combobox. It's not the best sollution but...

Drop a combo on your form (Combo1)

Dim mCustom     As ICommandBarControlCustom

Set mCustom = CommandBars.Add(xtpControlCustom, id, label)
With Combo1
   mCustom.Handle = .hWnd
   .AddItem "Item1"
    .AddItem "Item2"
    .ListIndex = 1
End With

 



Edited by robs
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.172 seconds.