MenuItem in Compact Framework 3.5 - compact-framework

Is there anyway to programmatically force a MenuItem to raise their popup event? Basically, if you click on it with your stylus or finger, it shows the MenuItem collection for that specific MenuItem. I'd like to be able to do by using a button that I capture.

If you add your menu items to a ContextMenu you can then call ContextMenu.Show with a position and it will show the context menu at that position.
So you could do that in your button click event. Or did you want to 'fake' taps on the menu buttons on the soft menu bar?

Related

How to hide a panel when mouse leave/mouse hover

I have multiple buttons in a Panel. I want to hide the Panel on mouse leave of the panel, or buttons.
The problem is that when my cursor hovers on one button and hovers again on another button, the panel that holds the button will hide because I have panel.hide() code on each mouse_Leave event in the button and on the panel. I want to hide it when the cursor leaves the panel or the button.
It sounds like you basically want the panel hidden at all times unless the cursor is over it, and when the cursor isn't the panel hides again?
You could try keeping the panel hidden by default so it's always that way unless the mouse enter's over it, then it shows. That way, when the mouse leaves the panel again it'll automatically hide.

Location of context menu strip

I have a context menu strip on my form which is displayed on right click on the datagridview.
Problem is the menu is displayed on the upper right corner while I want to show it on the location where mouse is clicked.
Please advise.
Thanks
A ContextMenuStrip could be automatically shown by a DataGridView at the location of the MouseDown click event.
For this to happen it is necessary to associate the property ContextMenuStrip to the actual instance of your menu strip. You could do this either by code or directly in the designer
DataGridView1.ContextMenuStrip = ctxMenu;

How to get the Spotlight-like text input effect in menu bar?

I want to have an icon in the menubar in my Mac app - and the icon should spawn a menu upon clicking. While having more entries in the menu, I would like to have a top row as a universal text entry field - like it is in Spotlight:
http://dl.dropbox.com/u/3943878/_mine/Screen%20shot%202011-07-16%20at%2012.29.18.png
Is it possible to add such a field to NSMenu? Or should I do it as a panel-type window?
If you're using xcode 4 , make a custom view in interface builder and add a textfield or anything you want to it. In IB also drag and drop a "Menu" from the objects library with as many items as you want in it. Then simply ctrl+click the menu item you want to make into the text field (In your case it would be the top one) and drag to the custom view and select "view". Now when you open the menu, instead of showing a menu item in that space, it shows whatever was in your custom view.
EDIT: As for your comment here's what you should do. Make your menu an outlet by opening the assistant editor view and ctrl+click from your menu to the header file that you want to use. now, simply make a method that will run whenever the menu will open, conveniently apple already made this, it's called menuWillOpen.
- (void)menuWillOpen: nameOfYourMenu{
[self performSelector:#selector(methodExecutedWhenMenuIsClicked) withObject:nil afterDelay:0.0 inModes:[NSArray arrayWithObject:NSRunLoopCommonModes]];
the delay at 0 will make it happen immediately, it must be done in the common modes run loop so that the menu will be updated even while it's open. Now just make the methodExecutedWhenMenuIsClicked and set it so the text field responds.
- (void)methodExecutedWhenMenuIsClicked{
[[yourTextfiled window] makeFirstResponder:yourTextField];
You can put any view in a menu using -[NSMenuItem setView:]. See the long comment in NSMenuItem.h and the section Views in Menus in Application Menu and Pop-up List Programming Topics.
You're probably going to struggle quite a bit. I just tried doing the same thing, and reading the Views in Menus in Application Menu and Pop-up List Programming Topics document referenced by Ahruman, I found this:
A view in a menu item can receive all mouse events as normal, but keyboard events are not supported. During “non-sticky” menu tracking (that is, manipulating menus with the mouse button held down), a view in a menu item receives mouseDragged: events.
I think we're SOL. Apparently Spotlight pops up a borderless window instead.

ToolBar on top of keyboard

How can i show toolbar with "Next" and "Previous" buttons on top of the keyboard on iPad like in ShareKit(when logging in)? I have many of text fields, and i need switching between this text fields by using toolbar buttons
Design your toolbar however you prefer, then set it to the InputAccessoryView property of the UITextField whose keyboard it should accompany. It will be automatically displayed above the keyboard whenever it appears.

Problem with toolstrip renderer in VB.net

I'm using the toolstrip renderer in vb.net, found the source over at:
http://63.236.73.220/showthread.php?t=539578
Now, it works great however the style doesn't seem to stick when I click a button on the toolbar. I use a toolstrip sort of like tabs, and what I'd like is if a toolstrip menu is clicked the style stays so I can visually see what tab is clicked.
Can someone help me out with that?
I figured out the issue... Turns out the default toolstrip renderer supports the clicked item state, so I had to turn on the "checkonclick" to true and then when the the toolstrip button is clicked it shows the selected state, then in the code on the click event I did a loop to uncheck all other buttons in the toolstrip so now it functions exactly like a tab interface using the fancy toolstrip renderer :)