I have tooltips in flex but when a component is clicked the tooltip disappears and the user has to move mouse out of the control and then back into the control to display the tooltip.
Is there a way to prevent the tooltip from getting destroyed on mouse click.
I tried calling
e.stopImmediatePropagation();
e.preventDefault(); on mouse click event of button. also tried handling and preventing tooltipEnd and tooltipHide events but they are not fire when the button is clicked.
Thanks.
I have fixed the issue by adding a event handler to the mouseDown event and then calling preventDefault and stopImmediatePropagation there this prevents the tooltip from vanishing and the button is still clickable.
Related
Can anyone explain me what the difference between focus, focusleave and focusenter on button method with extjs, I'm lost because it seems to be the same when I add event listener. Thanks
kind regards
difference between focus, focusleave and focusenter on button method
with extjs
Method? I guess you mean the events right? Cos:
The focus method will focus your button when you call it.
As you can see on the picture the middle button has focus, you can change the focus on the webpage usually by using TAB key. ExtJS supports full control over your app using keyboard.
The focus, focusenter, focusleave events. If you are not sure what to use - just use "focus"
The focus event should be clear - it's simply fired when the button has focus.
The focusenter is fired when the component get's focus but as the docs states it's also fired in the whole component hirearchy. That means that if the button is in panel which is in view and you focus the button - the focusenter will be fired on the view, panel, button.
main -> panel -> button
Events
The focusleave is the same as focus enter. Fired when focus is lost on the component - again fired in the whole hirearchy. So if the focus went completly away form the page you would see focus leave on the button -> panel -> view
I have an MFC button control and I am trying to handle the "OnPressed" event of it by starting a timer on click and making it go through my event in the OnTimer function. This all works fine but the focus remains on the button and if I click outside of the button area, the app carries out the OnPressed event. Any suggestions on how to kill the focus on the button when the mouse is pressed outside of the button area? My code for getting the focus and button ID.
void Dlg::OnTimer(...)
{
CWnd * pFocus = GetFocus();
int btnID = 0;
if (pFocus != NULL && pDialog->IsChild(pFocus))
btnID = pFocus->GetDlgCtrlID();
// Carry on my button pressed activity
Buttonpressed();
}
So basically I am getting the proper button press and I can carry out the desired action using the Buttonpressed() function given above. Now my problem is, once that button is pressed, it gets focus and the focus remains even after I leave the mouse and move out of the area of the button. Because of this behaviour, if I click outside of the button area, the application still thinks that I am in the mouse area and pressing the button. Is there a way I could remove focus after the mouse is moved out of the button area and then bring focus back in again when it is in the button area?
Looking forward to your suggestions.
I am creating a Flex Panel, which has an image on it. I have set the "buttonMode" and "useHandCursor" property of the image to true. So, whenever I do a mouse over, the cursor changes into a hand tool. I am able to set the mouse-down, mouse-up, mouse-move events on it. But, I see that the mouse-move events only get triggered when I move the mouse inside my Flex panel. I also want to capture the mouse-move event when user moves the mouse outside the Flex panel.
For eg, when user clicks on the image in Flex panel and then drags the mouse(while mouse down) outside the Flex panel, I want to get the current position of mouse while user is dragging the mouse.
Is there any way to get the mouse position outside the Flex panel??
Thanks!
The solution for this is "Mouse-Move" event only.
I need to do the following:
1. Capture mouse-down event on the image.
2. Register for mouse-move and mouse-up event inside the mouse-down event.
3. Inside the mouse-move event get the position of cursor.
4. Inside the mouse-up event unregister mouse-move event.
In flex, I am using the following:
mx:TextInput mouseOver="tester(event)"
It works fine. My pointer goes over the textInput and it calls the function. But when I click inside the textInput to enter some text( focus is on the textInput) and then move the mouse (not taking mouse pointer outside of the boundary of textinput), the mouseover event is not trigerred.
If I use click event, then even if I am entering text ( or the focus is on the textinput) and then click, it will call the function.
How can I call the tester function on mouseover when the focus is on textInput?
The mouseOver event fires when the mouse is moved over the control.
Maybe you want to try the mouseMove event which will fire every time the mouse moves?
Keep in mind that mouseEvents and focusEvents are not inherently related. I would expect the mouseOver event to fire when the mouse rolls over your textInput regardless of whether or not that textInput has the focus.
I am using a box element to add a transparent overlay to a column of buttons. I want to add a click event to the buttons. However, when you click a button the click event is only triggered on the overlaying box. Is there anyway to pass the event to the underlying button or perhaps a better way to display an overlay without blocking the click event?
If you want a DisplayObject (which nearly all visual things subclass in Flex) to be treated as "transparent" to the mouse (i.e. it won't intercept click events), set that object's mouseEnabled property to false.
e.g.
transparentBox.mouseEnabled = false;