GWT DnD: Is it possible to drag disabled widgets? - ajax

I have a composite widget that contains a disabled TextArea on an AbsotutePanel. Now I want to be able to drag the composite widget, starting from anywhere on it, including the disabled text area.
Is that possible?

If you want to drag a composite widget, you need to have a reference to the "drag handle" wich is one of the elements in the composite widget that implements HasAllMouseHandlers. The easiest (and in my mind, cleanest) way to do this is to have the composite widget extend the interface HasDragHandle wich requires the composite to have the method:
Widget getDragHandle(); the interface does not explicitly tell you so but the returned widget must be a widget implementing the HasAllMouseHandlers interface (or you'll get a runtime error).
(Non-composite widgets implementing HasAllMouseHandlers can be used directly)
I'd reccomend using a Label as a drag handle (it doesn't need to contain any text it could just be styled so the user understands it can be used for dragging), and not a form element because then you're overloading it's behaviour in a way the user most likely won't expect. I'm not really sure how a disabled element would work as a drag handle, quite possibly disabling an element will stop any mouse listners from working to so it won't work as a drag handle (haven't tried it though).

Or, try putting your widget into a FocusPanel, which is already enabled for drag 'n drop anyway. I've done this with a TextBox and a button, and it seems to work fine. Disabling the widget inside of the FocusPanel also keeps it from accidentally being activated.

Related

When to use ARIA role attribute

I'm attempting to make my website compliant with WCAG. Is a custom radiobutton that overlays the native HTML control with a styled div the proper use case for the role="radio" attribute?
It depends which element will receive the keyboard focus. If focus goes to the native element (<input type="radio">), then the screen reader will announce it properly and you're good. If it goes to your custom element, then you'd need an ARIA role (and a role for the container too, role="radiogroup").
Note that if focus goes to the native radio, then make sure you custom element is hidden (aria-hidden="true") from the screen reader. It would be confusing to be able to put the screen reader focus on both radios.

(NSWindowButton) NSWindow.standardWindowButton button not highlighting

When i use the following to create a button
NSWindow.standardWindowButton(NSWindowButton.ZoomButton, forStyleMask: 0)
I get a button that doesn't react to mouse hover events. I can augment this by creating a container view with a NSTrackingArea and manually triggering the highlight method but it produces a clicked state.
Is there a way to somehow force the button into the expected behavior state without the darkened background?
I have been trying to avoid subclassing NSButton, but it seems like i may have to, and I'm just in a state of denial.
I could not get this working for the life of me so my solution was to write my own custom buttons. This works fine for me because my NSWindow is already custom so there wont be a clash of style.
https://gist.github.com/icodeforlove/a334884e59784b4c2567
Another viable solution is to use https://github.com/indragiek/INAppStoreWindow as #xhruso00 mentioned, but it seemed like overkill.

Scroll management for LongListMultiSelector

In my WP8 application I use LongListMultiSelector and I would like to save it's scroll position when application is closed or tombstoned and then restore it when application is opened again. I will also need to scroll it programmatically to a specified item or specified position with animation when application is active.
The problem is that so far I can't find any methods on LongListMultiSelector that will allow me to scroll it with or without animation to a specified item or position. I also can't find methods that will allow me to get a list of all current items so I could choose of them to which one to scroll.
It can't be that scrolling is unmanageable on LongListMultiSelector so I'd like to get your advice on how I can get to this scroll functionality.
LongListSelector is kind of a "smart" controls. It means it has very complex behaviour but if you need to change it - better you shouldn't...
You have two options:
Write your own behavior on top of the content of the LongListMultiSelector. It contains primitives:ScrollBox control inside it.
Use standard LongListSelector and implement native ScrollTo method and your own multiselection. Multiselection is a simple task, ScrollTo is quite tricky since you basically can't scroll to position, only to item.

Move controls with the mouse in Cocoa

I want to build a simple forms designer in Cocoa and need to move controls around on a form using the mouse (click, hold, move around, release).
Do I need to inherit new classes from all control classes to intercept those events ? Is there a way to implement it generically for any control?
One way might be to have a single large custom view that fills all the space the controls will be in. Implement the necessary methods to implement mouse events in this view, doing hit detection on the control views and moving them around. This approach requires only 1 custom subclass of NSView, and you can use any views or controls you want to move around without subclassing them.
Write a custom view to contain the controls. Override -hitTest: to ignore the controls and return self instead. Then when you receive mouse events, figure out which control they apply to and move as appropriate.

Silverlight 2.0 RC Drag and drop ordering of a ListBox

I am trying to give a ListBox drag and drop ordering functionality and I have hit a wall. I got it to work when I specify the list box items in xaml but it does not work when I bind to a list it no longer works because the items are no longer of a listboxitem type.
I found this code http://blog.dobaginski.com/josh/?p=52 that allows me to get the underlying ListBoxItem but I can't get the mouse move event to fire.
I have went through other tutorials but have not been able to find one that deals with a ListBox. Has anyone done this with a ListBox.
The events I am using are SelectedChange, MouseMove, and LeftMouseButtonUp (I think that name is right). I am not using LeftMouseButtonDown because I couldn't get it to fire.
As far as i know you cannot get at the listbox item container when using data binding. YOu could in Beta 1.
You also cannot set a mouse event handler in the style, you must use a data template, just so you know.
You will likely have to use the mouse move event from a parent element, probably the UserControl or main layout control that hosts the listbox.
State changes and animations need to be in the style though so... you still cant get at the listbox item, just the element inside it in the data template.
Oh and if doing drag and drop HitTest is now protected so that will make the Drop harder.
since today you can download the final 2.0 version of Silverlight with some add ons, check the Scott's web log
I've been trying to do the same thing in WPF,
but have only found many buggy implementations.
One person has guided me towards the blog of Beatriz Costa,
and from what I remember she's one of those rare geniouses,
so I suggest you read that as well... I know I will
Blog of Beatriz Costa

Resources