How can i make a moving button in GWT, so that users can move it to anywhere they want? - gwt

I just want to make a moving button , Is there a way to do that in GWT? Thanks in advance.
BS

Out of the box, you can use a DialogBox to display your button. DialogBox can be moved around, but you will need to display something in a Caption that is used for dragging.
Another option is to use PopupPanel. It can be completely invisible (no Caption), but you will have to implement dragging functionality on your own. The advantage is that a PopupPanel floats on top of all the other layers in your UI.
Finally, you can simply add dragging functionality to a regular button. Just remember to check for the boundaries so that a user cannot drag your button outside of the visible browser area - or obscure some important elements of the UI.

Related

Gtk/Glade How to change window content

I Want to change whole window content after button press. What is the best way to do that? Someting like "Next" button on installers but with custom buttons.
You probably want a GtkStack with your own buttons to change the visible child (but do have a look at GtkStackSwitcher and GtkAssistant for more ready-made but less flexible solutions).

GWT implement something like a Desktop Icon

I have a VerticalPanel consisting of an Image and a Label with some text in it. What I'm trying to implement is something like a Desktop Icon - when you click it - it gets 'marked' and probably a menu will appear. When you click outside of the icon - the menu should disappear and the icon will get unmarked.
Currently I'm trying to achieve this by wrapping the VerticalPanel in a FocusPanel and playing with some focus handling but I have not achieved any satisfying results so far.
I would appreciate if you could give me some guidance on how to best implement this.
Thanks.
You're on the right track with the FocusPanel wrapper. The key point about the FocusPanel for what you want to do is that it captures clicks (by implementing HasClickHandlers). You can then handle clicks and assign the panel CSS rules e.g. border-width, border-color, or background-color, etc., according to however you'd like to indicate your icon as pressed/selected.
Its seems that you need a ToggleButton and a basic PopupPanel

How to have a popup scrolling in the same way that others elements?

I can not solve my problem. As example, my website : www.mananaseguro.com.
In the home page, I have some popup appearing just under movies's poster (when the mouse is over the poster). But when I scroll UP (for example), the popup will not appear just under the poster. Their is a space between them. I tried to add the popup to the home's page panel but it did not succeed.
So is it possible to simulate the good popup behavior? (the popup must stay under the poster).
Or more precisely, is it possible to attach a DecoratedPopupPanel to another panel inside the page in order to have the popup scrolling in the same way that others elements?
Try using the PopupPanel#showRelativeTo() method.
You can achive good popup behavior by using below property.
popup.setPopupPosition(left, top)
Pass movie image x and y index position in top and left. and make consistent look and fill.

how to do tooltip on button in iphone?

I am having download icon on my page i want that when the user takes his finger over the button a tooltip should show as showing download in text.
is there any option in iphone to show a tooltip???
Dan is absolutely right on how to do it but I'd answer you should rethink your design to not need the tooltip at all.
There's a reason that there isn't one by default - what if the user presses down on the button to see what it does, reads the tooltip and realises that's not what they want. They then have to be very careful not to let go while still over the button or it will press and do the wrong thing. (And most users don't know that they can press down over a button, move their finger off it and release it to cancel the press.)
You should rethink your design to make it obvious what the buttons do without the user having to interact with them first.
However, if you definitely still want a tooltip, Dan's method is fine.
Nothing built-in, no. If you think about it, generally a tooltip appears when you mouse over the target item. There's no "mousing over" with a touch interface.
You can definitely roll your own, though. Start by placing a view containing your tooltip contents exactly where you want it with an alpha of 0%. Make a custom button with no content that outlines your download icon, and hook its "touch down inside" action to a method that animates the tooltip view to an alpha of 100%. Hook your button's "touch up inside" , "touch down outside" and "touch up outside" actions (and maybe some others--you might want to experiment with that) to a method that animates the tooltip view back to an alpha of 0%.
There isn't native support for this in iOS. But you can create your own.
I ended up creating my custom tooltip/popover class.
Can be initalised with any content view and dynamically adjusts it's frame.
Hope it helps.
https://github.com/akeara/AKETooltip

GWT DnD: Keep draggable within an AbsolutePanel

I made a MultiSlider widget using the GWT and the gwt-dnd addon to rate texts. On the screenshot, you can see the slider button with value 50 dragged outside the slider bar. It can't be dropped outside the bar, but it can be dragged outside of it.
alt text http://lt3.hogent.be/hendi_docs/stackoverflow/gwt-dnd-multislider.png
Is there a way in GWT to always keep the slider buttons inside the slider bar?
EDIT:
The slider bar is an AbsolutePanel, and it is also the only droptarget for the slider buttons. The slider bar panel is also the boundary panel for the drop controller. Dropping outside of the bar panel is not possible, but dragging is.
Now what I really like to know is if it's possible to keep the mouse pointer on the bar panel. If a button is dragged out of it, it will remain on its old position when dropped (so that's OK). Is it possible to allow only vertical DRAGGING? Can the mouse position be set while dragging?
I've used dragController.setConstrainWidgetToBoundaryPanel(true), and I think dragController.setBehaviorConstrainedToBoundaryPanel(true) does the same thing. For more information, check out the javadoc for your version.
The method you're looking for is defined in AbstractDragController with this signature;
void setBehaviorConstrainedToBoundaryPanel(boolean constrainedToBoundaryPanel);
The boundary panel (often passed in in the first parameter to the drag controller constructor) in this case should be an AbsolutePanel which wraps the slider.
It may also be helpful to visualize the absolute panel if things are not working as expected:
absolutePanel.getElement().getStyle().setProperty("border", "1px dashed red");