How can I create a YUI menu where you can click to open the submenus? - iphone

We have a multi-tiered/hierarchical YUI menu activated via a YUI menu button. Everything in this menu works pretty well. If you mouseover a menu item with a submenu, the submenu appears as expected. You can select an item from this submenu just fine.
The problem, however, is that you can also click on the parent items of this menu which closes the entire menu. In fact, I want the opposite. I'd like a click of a parent menu item leave the top level menu open and open the submenu (i.e. I want a click to be identical to a mouseover event in terms of functionality).
Side note: This isn't an issue on a typical web browser (e.g. Firefox) where the click event doesn't matter because you can't have a click without a mouseover. This is an issue on the iPhone which doesn't have a mouseover event.
I've been playing with the autosubmenudisplay properties and keepopen properties, hoping I can just handle the parent item click events to do what I want but, so far, I've been unsuccessful. If I set autosubmenudisplay to false, I can't figure out how to get the submenus to display manually. The keepopen property doesn't seem to work rather I set it on the menu or submenus.
Is there a way to get the behavior I want so our iPhone users are happy?

Todd Kloots, author of the YUI Button and Menu widgets here. Took at look at your request. Unfortunately the current version YUI Button and Menu aren't designed to support the type of interaction you are looking to create. Feel free to file a feature request via SourceForge and I'll try to work on this for a future version of YUI.
Todd

It's not exactly what you asked for, but have you looked at iUI? You may be able to pick up some tricks from the implementation.

Related

How to make Eclipse automatically show selected file in explorer?

In one of my projects, I guess I enabled a setting somewhere that I didn't realize how much I use.
Whenever I click into the main editor, it brings the package explorer to the file automatically and scrolls to it. I can't seem to find this setting anywhere in preferences, does anyone know what it is called?
It's called "Link with Editor", the two-way arrow icon you'll find in the toolbars of various Views.

Where exactly is "scm/change/title"?

I'm trying to add a scm/change/title menu item for some manipulations of the scm changes, but I cannot find where it goes after being added. I've tested with other menus and the command works. The official doc states that
The scm/change/title allows you to contribute commands to the title bar of an inline change.
I'm wondering where exactly is this "title bar of an inline change"? Is it hidden somewhere in the window below? I've tried to right click almost everywhere inside the window but still failed to find it ...
The 1.18 release note shows this:
The doc mentions:
There are five Source Control menu ids where you can place menu items, in order to provide the user with a much richer user interface.
The scm/title menu is located to the right of the SCM view title.
The menu items in the navigation group will be inline, while all the others will be within the … dropdown.

How to highlight MenuItem programmatically in SWT

I open a context menu programmatically. Now additionally I would like to highlight the first menu entry.
This highlighting happens when I move with the mouse over the context menu or press the arrow keys on the keyboard. I am interested how I can trigger this programmatically.
I know the API of MenuItem does not offer this feature out of the box. So I tried to fire some MouseEvents of the type MouseOver and MouseHover, but without any success.
Has anybody an idea how to implement this feature?
I am not sure if you can change menuitem highlight colors, I haven't seen any previous example before. Look at this though: Change eclipse menuitem color
If you want to simulate what the user does and if you happen to know the location of the menu item, you can use Display#setCursorLocation() to position the mouse pointer over the menu item.
Note however, that if and how a menu item is highlighted is platform specific.
You should not use this method other than for demonstration of test purposes. If your application needs to highlight or preselect an entry in a list of choices,
you should probably use another widget. If you more describe your use case, we may be able to find a suitable widget.

Adding New Components in WindowBuilder Design View

At risk of this being a trivial question, I need to know how to add more components (in the components explorer) in WindowBuilder for Eclipse Juno. I'm taking a dive and trying learn how to add a GUI to one of my personal projects. Right now all I have mustered up is just a JFrame that has a button that launches my program in the console with a little notification saying so. But what I am thinking about having is a "Start up Window" with just some stuff and button or something that says Enter application or something. So then I want a new window to pop up as a "Run Window". I have created a new JFrame as a "run window" and hide/set visibility of "startWindow" to false and get the result I want. But I want to be able to edit this new JFrame in the design window along with the default JFrame I started with.
Is there a way to do this? I tried right-clicking in the components window in the design view and it doesn't do anything. I also tried right-click the object from the project explorer and couldn't find anything. Am I missing something? Is this even possible?
The question seems to have 2 parts, so I will try to answer both of them.
1) Adding components directly in the components explorer
The only thing you could do, to get new components into there via right-click is "Surround with". For example you have a JPanel, right-click on it and click "Surround with...". You could try and put a JScrollPanel in there, so you can scroll your JPanel.
But the usual way to add components is by the "Palette", it contains a lot of components, that you can drag&drop into either the components-explorer or directly into your app Window -> Show View -> Palette.
2) Showing a certain window
If I understand this correctly, you want to show one window, click on a button and then show another window which has the same size etc. like the one before.
Setting the visibility for the first window to false and the second does work.
But under certain circumstances it's easier to use CardLayout.
Imagine a stack of cards, you can see only the first card. Then you click a button and now see the second card and so on.
See this: https://docs.oracle.com/javase/tutorial/uiswing/layout/card.html
for information and examples.

Adding menu listener for Paste option in SWT Browser

I have a org.eclipse.swt.browser.Browser instance created in a composite. I would like to know when some content is pasted in the browser using the (platform specific) right click context menu and selecting the paste option.
In the menuDetected() of MenuDetectListener, I get a notification when the context menu is detected in the browser.
How can I know if the Paste option is selected from the context menu?
Regards,
Noopur
No you can't access the selected context menu item. There is no direct provision for that. At least not in eclipse 3.7. Although, you could try different combinations of events for determining the menu item. For example, in windows the internet explorer populates the status bar with 'inserts the clipboard...' when your mouse pointer hovers over the Paste menu item, you can capture this using StatusTextListener event.
Note: The hack is not an elegant solution, even if you get it working, there is still some possibility that it may break with new or older releases of SWT or in fact its behavior may vary with operating systems !!