I have one celltable and I need to add handler on its row for "mouseenter" event.
I have tried something like following, but its not working for "mouseenter" althought it works for "mouseover".
cellTable.addCellPreviewHandler(new CellPreviewEvent.Handler<Test>(){
#Override
public void onCellPreview(CellPreviewEvent<Test> event) {
if ("mouseenter".equals(event.getNativeEvent().getType())){
Window.alert("mouse entered");
}
}
});
Is not working properly for mouseenter events because apparently is only implemented by IE and Opera, since you're Chrome, you can just wait until they implement it.
Unfortunately Firefox, Chrome, and Safari still haven’t copied this brilliant Microsoft invention, that has even made it to the spec. Come on, guys!
From this source.
Related
This question already exists:
Closed 10 years ago.
Possible Duplicate:
in Chrome not getting an onClick() on a FocusPanel when focus was on a TextArea that has registered onChange and onBlur handlers
In my GWT app I register a BlurHandler on a TextArea so that I can save the changes and go from edit mode back to view mode if the focus moves elsewhere. This works, but also seems to defeat the effect of the event that moved the focus, at least on Chrome in devmode. For example, if the user clicks on an Anchor, the TextBox gets the onBlur() and then the Anchor does not get the onClick(); whereas before I registered the onBlur, the Anchor would get the onClick(). This seems to be quite reliable (again, in Chrome in devmode). I am being careful to not call event.stopPropagation() or event.preventDefault(). Any ideas how I can get the onBlur and also the onClick() ?
I had a similar issue. I was not able to track the source problem though. I did enable dev toolbar / firebug and set event breakpoints to test; it does look like the click event was not triggered after the blur action. After playing around for many hours (and I'm not quite sure what inspired me to try this), I dropped the onblur action in a timer with executed delay at about 300ms. That seemed to work for me. I think it might have something to do with the fact that my action slightly modified the page and visibility of items, witch re-rendered the page and I can only guess that the single-threaded browser model killed the click event which was not longer on the right area.
textBox.addBlurHandler(new BlurHandler()
{
#Override
public void onBlur(BlurEvent event)
{
Timer delayTimer = new Timer()
{
#Override
public void run()
{
//do stuff
}
};
delayTimer.schedule(300);
}
});
anchor.addClickHandler(....)
I tried to create a fileUploader with GWT.
Here is the problem, while I was adding ChangeHandler to fileUploader, I found that the behavior of IE and Chrome are different. If I choose the same file I uploaded, IE will trigger the onChange(), while Chrome won't. That's too weird. Can anybody tells me if it is a bug of GWT of not??
FileUpload fileUploader = new FileUpload();
fileUploader.addChangeHandler(new ChangeHandler(){
#Override
public void onChange(ChangeEvent event)
{
submitButton.setEnabled(true);
}
});
There are browser discrepancies that GWT cannot hide. The only mean to really reset a FileUpload in a cross-browser way, is to create a new one to replace the previous instance.
I've been writing a GWT app that does various simple things with images like pan, zoom, brighten, etc. when you click and drag the mouse. Everything is working really well in all the browsers, except Safari. Well, Chrome 3 was also a problem but my app now works fine in Chrome 4.
The problem is capturing the middle mouse down events. I've added mouse handlers to a widget class like this:
public class InteractiveThingy extends Composite implements
HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseUpHandlers,
HasMouseWheelHandlers
{
#Override
public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
return addDomHandler(handler, MouseDownEvent.getType());
}
...
}
and I can subscribe to the mouse events elsewhere and handle them. I can see which button was pressed and apply the appropriate operation.
However, in Safari and Chrome 3, the handlers are never called when I press the middle mouse button. Instead, the multi-way scroll icon pops up. The middle mouse down event comes through on IE, FireFox and Chrome 4 just fine.
Is there some extra event handling (like event preview) needed to stop Safari from handling the middle mouse before my code gets its chance? Or perhaps I need to wait until Safari fixes the issue like Google did with Chrome.
I've ported my GWT app to 1.7.0 from 1.5.2 and widgets that are used as a control on a GoogleMap no longer get ClickEvents. I've checked that the DOM insertion of the control is the same and there are no differences there. Since GWT 1.6 introduced a significant change in the way events are handled I'm thinking something has gone amis there.
I use a GWT image as a a GoogleMaps control:
Image control = new Image("/oeg/images/info_32.png");
Which I place on the map using the Mapitz GMaps lib (yes I know its old, but I have kept supporting a working version that is updated - if anyone is interested just ask)
GControlPosition infoPosition =
new GControlPosition(GControlAnchor.G_ANCHOR_TOP_RIGHT(),
new GSize(7, 30));
getGmap().addControl(new GControl(control, infoPosition));
I've checked the compiled code and it literally just puts the html element on the map as a GControl just the way you'd expect and as I said I've checked the DOM to make sure nothing looks funny.
to get ClickEvents I used to do this...
control.addClickListener(new ClickListener() {
public void onClick(Widget sender)
{
doTipOfTheDay();
}
});
which I changed to this in the 1.6.0 world,
control.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent ce)
{
doTipOfTheDay();
}
});
I've also tried explicitly sinking the click event with
control.sinkEvents(Event.ONCLICK);
but none of this works in GWT-1.6.0/1.7.0 and it all worked fabulously in 1.5.2
Can anyone shed some light on this? Has anyone else run into event issues w/ controls on GMaps with GWT 1.6 and above?
FYI with other Gmaps objects I have no problems. I'm getting mouse clicks on the map surface, on markers etc.
but controls, not so much
I would like to trigger a click on the browse button on a hidden FileUpload widget.
The following code works fine on IE 6+, but doesn't work in FireFox.
final FileUpload upload = new FileUpload();
upload.setVisible(false);
upload.setName("uploadFormElement");
panel.add(upload);
panel.add( new Button("Select File", new ClickListener()
{ public void onClick(Widget pSender)
{ jsClickUpload( upload.getElement() ); } }));
native void jsClickUpload( Element pElement ) /*-{ pElement.click(); }-*/;
How can I achieve the same in FireFox (and possibly other browsers)?
The solution can be read here:
http://www.quirksmode.org/dom/inputfile.html
in the last paragraph:
The click() method allows you to
simulate a click on a form field.
Checkboxes get toggled, radios
selected, and so on. Unfortunately
Mozilla and Opera haven't added this
method to file upload fields. I wonder
why, adding it is not really a
security risk since the worst that can
happen is that the file selection
window pops up.
have you tried calling the onClick() method directly?
The click method is currently in the process of being implemented in FF 4. It is being discussed what security rules will be implemented and it sounds like it will be similar to Window.open and must be the direct result of a user action and not a timer or load.