Coder Social home page Coder Social logo

Assign widgets a Menu as a ContextMenu about xwt HOT 6 OPEN

mono avatar mono commented on August 16, 2024
Assign widgets a Menu as a ContextMenu

from xwt.

Comments (6)

slluis avatar slluis commented on August 16, 2024

I'm ok about adding the ContextMenu property, but we need a way to have a more control on the position where the menu will be shown. For example, if you are implementing a widget in a Canvas and you want to show a context menu when clicking on specific regions of the canvas.

from xwt.

luiscubal avatar luiscubal commented on August 16, 2024

BTW, click events are not a good way to trigger popup menus.

For instance, my keyboard has a "context menu key"(left of right ctrl, right of right windows key), so it definitively should be possible to trigger popup menus without mouse events.

As for the specific position for the menu to show up, wouldn't this sort of thing be automatic behavior? Wouldn't the popup menu just automatically appear on the mouse location? Why would we even need to worry about this on XWT?

It also has a "declarative feel" that click+popup() lacks, which means a HTML/XUL/XAML-like language for XWT would also benefit from this.

In other words, I like this proposal.

That said, I still think there should be some way to programatically trigger the popup menu.

from xwt.

ermau avatar ermau commented on August 16, 2024

I'm ok about adding the ContextMenu property, but we need a way to have a more control on the position where the menu will be shown. For example, if you are implementing a widget in a Canvas and you want to show a context menu when clicking on specific regions of the canvas.

When or where? It sounds like you're asking for two different things.

from xwt.

slluis avatar slluis commented on August 16, 2024

For instance, my keyboard has a "context menu key"(left of right ctrl, right of right windows key), so it definitively should be possible to trigger popup menus without mouse events.

Yes, we need an event specifically for showing the context menu, since it may not be triggered using the keyboard.

As for the specific position for the menu to show up, wouldn't this sort of thing be automatic behavior? Wouldn't the popup menu just automatically appear on the mouse location? Why would we even need to worry about this on XWT?

Actually, you're right. That should work in most cases (although it doesn't cover all cases, so the Popup method is still useful).

from xwt.

mhutch avatar mhutch commented on August 16, 2024

When the event is activated from the keyboard, it doesn't make sense to position it at the mouse cursor. It should be beside the selected item or at the widget's origin.

Wouldn't it be better to have a Func<some,args,Menu> to create the menu, so it can be created/populated when it's needed?

from xwt.

ermau avatar ermau commented on August 16, 2024

When the event is activated from the keyboard, it doesn't make sense to position it at the mouse cursor. It should be beside the selected item or at the widget's origin.

Hmm, true. For most things this is a non-issue, but for the aforementioned issue this is still a problem.

Frankly I'd just say whatever is being custom needs to be done in such a way that there's a layer of widgets so the platforms can all handle this naturally. Not sure if it's feasible, but at least worth considering.

from xwt.

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.