Giter Site home page Giter Site logo

Comments (8)

ifurnadjiev avatar ifurnadjiev commented on June 16, 2024

Probably adding the method is enough. As seen from the code the toolTip text is set on the menu shell. Shell#setToolTipText is already available.

from org.eclipse.rap.

phermsdorf avatar phermsdorf commented on June 16, 2024

Compile-wise this works, but no Tooltip shows up when hovering over the MenuItems. (which works in SWT)
Should I anyway make a PR to integrate that as first step?

from org.eclipse.rap.

ifurnadjiev avatar ifurnadjiev commented on June 16, 2024

I've double checked the SWT implementation and it is different at least on Windows:

public void setToolTipText (String toolTip) {
	checkWidget ();
	if (toolTip == null && itemToolTip != null) {
		itemToolTip.setVisible (false);
		itemToolTip = null;
	}
	if (toolTip == null || toolTip.trim().length() == 0
			|| (itemToolTip != null && toolTip.equals(itemToolTip.getMessage()))) return;
	itemToolTip = new MenuItemToolTip (this.getParent().getShell());
	itemToolTip.setMessage (toolTip);
	itemToolTip.setVisible (false);
}

There is an internal class MenuItemToolTip extends ToolTip that handles the MenuItem tooltip.
The tooltip visibility is controlled by the method

void showTooltip (int x, int y) {
	if (itemToolTip == null) return;
	itemToolTip.setLocationInPixels (x, y);
	itemToolTip.setVisible (true);
}

which is called by the Menu class.

from org.eclipse.rap.

ifurnadjiev avatar ifurnadjiev commented on June 16, 2024

Here it is: https://github.com/eclipse-platform/eclipse.platform.swt/blob/master/bundles/org.eclipse.swt/Eclipse%20SWT/win32/org/eclipse/swt/widgets/MenuItem.java#L1070

from org.eclipse.rap.

ifurnadjiev avatar ifurnadjiev commented on June 16, 2024

Maybe this is the way to go in RWT as well.

from org.eclipse.rap.

ifurnadjiev avatar ifurnadjiev commented on June 16, 2024

I'll try to come with complete JS implementation here, similar to the other widgets.

from org.eclipse.rap.

phermsdorf avatar phermsdorf commented on June 16, 2024

I tried to adapt that, but the tooltip does not show up when hovering over the MenuItem's.
I think "nobody" handles the hovering and calling getTooltipText().
I tried to adapt it like eg. ToolItems tooltip handling:

  • I added WidgetLCAUtil.preserveToolTipText( item, item.getToolTipText() ) in MenuItemLCA like it's done in ToolItemLCA
  • and added case "rwt.widgets.MenuItem": in
    getConfig : function( widget ) {
    if( widget.getParent() instanceof rwt.widgets.CoolBar ) {
    return this._getClickableConfig( widget );
    }
    switch( widget.classname ) {
    case "rwt.widgets.ControlDecorator":
    return this._quickConfig;
    case "rwt.widgets.Label":
    return this._getLabelConfig( widget );
    case "rwt.widgets.Button":
    case "rwt.widgets.TabItem":
    case "rwt.widgets.CTabItem":
    return this._getClickableConfig( widget );
    case "rwt.widgets.Text":
    case "rwt.widgets.Spinner":
    case "rwt.widgets.Combo":
    case "rwt.widgets.DateTimeDate":
    case "rwt.widgets.DateTimeTime":
    return this._fieldConfig;
    case "rwt.widgets.ToolItem":
    return this._getClickableConfig( widget );
    case "rwt.widgets.ProgressBar":

    like the ToolItem but it still does not work
    (not that I'm really knowing what I'm doing here but I just tried to do the same like ToolItem does ...)

Any ideas?

from org.eclipse.rap.

ifurnadjiev avatar ifurnadjiev commented on June 16, 2024

@phermsdorf I've created a fully working implementation and a pull request. What is probably missing for you are the changes in MenuItemHandler.js.

from org.eclipse.rap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.