Need to implement drag and drop using GWT with gesture :
Use case: like if we drag a panel with touch only its shadow image (or some grey box) start to drag from there with original panel being at its original location and we should be able to drop that shadow(or pseudo box) at desired droppable pane and some pop up should come up.
My advice is to not use any library for this.
Since browsers change, sometimes these libraries get broken. When you are using these libraries all that happens inside is some black magic and you will have a hard time to fix.
That is why I always implement DND myself. Also basic DND is really very easy to do and only a handfull lines of code. A library is overkill in a lot of situations.
Anyway. Over at G-Widgets a nice guide of how to do DND yourself is available: http://www.g-widgets.com/2015/12/24/drag-and-drop-using-gwt/
Related
I want to implement an Edit box with a spinner control in Unity.
Something like this:
I couldn't find an off-the-shelf component for this. I've also looked up the Unity Forums and haven't found anything relevant. Does anyone know how I could do this?
If you do not find something fitting on the asset store either (there are some comprehensive UI libraries), create a textfield and two buttons. For the arrows you could use special Unicode symbols which are supported by TextMeshPro UI Text renderers. The script to make use of the buttons should be fairly trivial.
Don't forget to turn it all into a prefab for reusage.
I need to make a custom tooltip view for all views of my project. This tooltip view has a specific shape (pentagon), font, font color and background color. Also it should has a typically delay, like the system tooltip, when mouse enter and mouse exit from view. Which is the best way for do this?
Thanks for the answers
I need to make a custom tooltip view for all views of my project.
For all views? Most applications have a lot of views that the user isn't even aware of — views used to contain groups of controls and such. So it'd be strange to offer tool tips for every view. Tool tips are usually used with interface components that actually do something, and their purpose is to tell the user what that something is. That's why you see that NSControl has methods for managing tool tips, but NSView doesn't.
Which is the best way for do this?
First, decide whether you really mean that you want tool tips for every view, or if you actually just want the same kind of tool tips that Cocoa already offers, but drawn differently. If the latter, then you could subclass each type of control you use and override draw(withExpansionFrame:in:) to draw the kind of tool tips you want.
If you really want tool tips for every view, you might do better to implement your own system. One approach might be to have some object in your app monitor mouse moved events. You can start a timer to track elapsed time after each mouse moved event, with each new event invalidating the old timer and starting a new one. If the timer expires, it can add a view displaying your pentagonal "tool tip" view to the window near the mouse.
I am working on a game using GTK3 as a rendering technique (terrible idea, but it's a school project).
My gameobjects are made of Image widgets and are placed in a Fixed container. It's working pretty well, however when i move widgets beoynd right or bottom border, the window automatically grows along with it.
I want the window to stay at the sam size, event if widget leaves its area and becomes invisible. It works when i move widget past the upper or left border.
I tried using gtk_widget_set_vexpand and gtk_widget_set_hexpand. My window is set as not resizable (gtk_window_set_resizable).
Is there any way I can achieve this?
This isn't the right way to use GTK+. GTK+ is intended for laying out widgets in a GUI program.
There are better options for animating 2D elements. One that works with GTK+ natively is the Clutter library. You can also integrate SDL or OpenGL or something like that if you so choose.
That being said, you can also use GtkLayout instead of GtkFixed, or put the GtkFixed in a GtkScrolledWindow and hide the scrollbars and set the scroll policy to prevent scrolling. It's still technically misuse, and in fact GtkFixed (and possibly GtkLayout too but the docs don't say) is really not supposed to be used anymore unless absolutely necessary because it doesn't give you automatic support for tricky UI layout problems, but it doesn't have extra dependencies.
I got an app that allows users to add content to a canvas. I would like to be able to offer the user an ability to move, rotate, resize, reflect this content. Currently I'm doing this with gestures, but would like to know if there is some sort of open-source widget that draws a box around the view and adds 4 buttons to do these functions:
rotate 90 degrees
rotate freely
resize
delete
Can anyone think of an open source framework that I can add to my project to create controls like the ones displayed?
I can probably build this by hand, but debugging gesture recognizers and view rotation is not the most fun thing, so I'm looking for something more polished.
Thank you!
Here's a link to an open source control on cocoa controls that looks like something you could use: TDResizerView.
"TDResizerView is used to resize and rotate an imageview with single finger"
Sounds like a good place to start from, even if you need to modify it.
I've never used this particular control though, so take my word for what it's worth.
edit: Also keep in mind that on iOS, users generally expect gestures. Forcing them to use the handles instead of pinching or rotating may be bad for your user experience, depending on why you want the handles instead.
You know that in a lot of Mac/iPhone applications (such as your Finder), when you are dragging a icon around, all other icons will be "repelled away" from your mouse and leave space for the icon you are dragging.
I am wondering if that's a built-in Cocoa function (in layout constraints etc?). If not, is there any library, or documents on how to implement it?
If you want to get it more-or-less for free, use an NSCollectionView.
If NSCollectionView doesn't fit your needs, it's fairly easy to implement it using NSAnimation. Basically, the way that NSToolbar or NSCollectionView does it (for example), is to figure out where the icon you're dragging would land if you let it go, and it sends the other icons to their new locations using Core Animation to move them smoothly.