How to get submenu item count and submenu name in barsubitem ribbon VB.NET - vb.net

I have a winform with ribbon menu and i want to hide barbuttonitem in barsubitem on ribboncontrol.
The question is how can i get count on barsubitem? and how to get barbuttonitem name in barsubitem? and how to set visibility on barbuttonitem in barsubitem?
if possible i need this answer ASAP.
Tq

You can use the BarSubItem.ItemLinks collection to access items and use the BarItemLink.Visible property to hide it. Like:
int count = barSubItem1.ItemLinks.Count;
BarItemLink itemLink = barSubItem1.ItemLinks.OfType<BarItemLink>().First(link => link.Item.Name == "your_name");
itemLink.Visible = false;

Related

How to access ScrollRect items and get it selected and clicked?

I am using Myo so my inputs are not the same as keypress and mouse.
I am trying to access items in the scroll UI Panel. Here is a snapshot of my Unity3D hierarchy.
http://imgur.com/f0cIJWl
As you can see, I have
-StoreMenu
-ScrollPanel
-ScrollRect
-ShopItems (list of items)
How can I possibly scroll and highlight the list of item. And on certain input gesture, get it selected ?
I'ved only managed this far:
scrollpanel = GameObject.Find("ScrollPanel");
scrollRect = scrollpanel.GetComponent<ScrollRect>();
scrollRect.GetComponent<ScrollRect>();
scrollRect.verticalNormalizedPosition = 0.5f;
I can get the scrollrect, move to certain position in the scroll but items are not highlighted.
Thanks in advance.
TRY THIS : http://docs.unity3d.com/462/Documentation/ScriptReference/EventSystems.EventSystem.SetSelectedGameObject.html
This can be used to Set the object as selected

Robotium ListView with Buttons, can't click on the buttons in the list

I have a dragablelistview with a title and imagebuttons for each item to delete that item.
How do I click on the imageview?
clickInList(int , int) does not work (unless i am doing it wrong?)
Try
clickOnText(String) or clickOnImage(int) clickOnImageButton(int) instead
Try to obtain the view of the list item, something like this :
//get the list view
ListView myList = (ListView)solo.getView(R.id.list);
//get the list element at the position you want
View listElement = myLyst.getChildAt(position);
//click on imageView inside that list element
solo.clickOnView(solo.getView(listEelement.findViewById(R.id.image_button)));

Get index of NSMenuItem (sender) in parent menu

I'm having a NSMenu (application dock menu) and several items in it with the same action.
How can I figure out the index of the sender item (the one triggering the action) within its container menu? (I'm not interesting in the title, since that might be a duplicate)
That's what I tried, but it keeps returning 0 (zero).
- (void)myAction:(id)sender
{
NSMenuItem* mi = (NSMenuItem*)sender;
int index = [[[mi parentItem] submenu] indexOfItem:mi];
NSLog(#"Clicked item with index : %d",index);
}
Any ideas? (Is there any better approach to achieve the very same thing?)
You could use the menu items' representedObject to store a reference to some object in your app. In your case, you would probably use the document that the menu item refers to:
[aMenuItem setRepresentedObject:yourDocument];
You could then access the object in the action like so:
- (void)myAction:(id)sender
{
NSMenuItem* mi = (NSMenuItem*)sender;
YourDocument* doc = (YourDocument*)[sender representedObject];
//do something with doc
}

Checked ToolStrip Submenu Items

I'm trying to create a menu in VB.Net where one item in the menu has a submenu that sprouts off to the side when the user hovers over it. In other words, a completely ordinary submenu that everyone's used a million times.
My main menu items are of class ToolStripMenuItem. I can get close to the behavior I want by using the item's "DropDown" member. This creates the submenu behavior correctly, but I also need to be able to check and uncheck the items in the submenu. I've set the submenu items' "CheckOnClick" property to True, but checkboxes are still not displayed when I run the program.
Is it possible to get this behavior? Is it possible with ToolStripMenuItem?
Here's the code I currently have, which gets close, but doesn't give me checkboxes:
Dim mainItem As ToolStripMenuItem = New ToolStripMenuItem()
mainItem.Text = "Click For Submenu"
Dim subMenu As ToolStripDropDown = New ToolStripDropDown()
For Each item As ToolStripMenuItem In listOfItems
item.CheckOnClick = True
subMenu.Items.Add(item)
Next
mainItem.DropDown = subMenu
Try getting rid of that subMenu variable and change the code this way:
For Each mi As ToolStripMenuItem In listOfItems
mi.CheckOnClick = True
mainItem.DropDownItems.Add(mi)
Next

Issue of TextCompletion of AutoCompleteBox in silverlight

I have created my own cutom control in combination of two :
button and a autocompletebox in silverlight.
On a click event of a button i bind the itemsource of a autocompletebox and do this :
acb.ItemsSource = p.ToArray();//list of an object of a class(person)
acb.MinimumPrefixLength = 0;
acb.IsDropDownOpen = true;
And on a textchanged event of a autocompletebox i call a service method to fetch persons based on the search text and do this :
ReferringProvider.ItemsSource = searchproviders;
this.ReferringProvider.tbComboValue.MinimumPrefixLength = 0;
this.ReferringProvider.tbComboValue.IsDropDownOpen = true;
But i lose TextCompletion, the text is not completed with the first item of drop downlist?
Any idea why so? or any suggestions
Please Thanks in advance.
I wrote a blog sometime back on autocomplete text box, but I did not use button. I am not sure you need button to initiate autocomplete. Corrent me I am wrong.
http://csharprambling.wordpress.com/2011/01/26/autocompletebox-to-auto-complete-data-entry/