Wathckit pause group animation when ContextMenu is opened - watchkit

I have the following code which animates the WKInterfaceGroup
self.group.setBackgroundImageNamed(String(format: "progress0", currentImage))
self.group.startAnimatingWithImagesInRange(NSMakeRange(currentImage, 360), duration:remainDuration, repeatCount: 1)
I need to pause the animation of the WKInterfaceGroup and then resume it from that point after the menu is dismissed.
I've tried to call self.group.stopAnimating() in didDeactivate(), but when the menu is dismissed, the animation continues from the point as it was never stopped and I don't understand why.
Is there any other way to pause it?

The reason this isn't working is because you can't update interface elements in didDeactivate. All updates must happen prior to that call (or during/after a subsequent willActivate).
Because of this, and the fact that there is no event fired when a Force Touch menu is displayed, there is no way to stop the animation in this situation.

Are you setting up/starting the animation in willActivate? I ask because willActivate is called when you dismiss the force-touch menu, I believe.

Related

How to make animation for multiple control in parallel with fly in from bottom effect in xamarin forms?

I am making a multiple choice quiz app in xamarin forms as like attached image[https://i.stack.imgur.com/s3A5d.jpg]. when i click next button then next question and answer is coming but i want to put animation on that. I want when i clicked on "next" button four option will come from bottom in fly in effect.any effect is acceptable, no issue. But my actual issue is when i used await TranslateTo or ScaleTo in all button it will happen but the effect is coming one by one. After first button effect complete then second is starting, But i need same effect in all 4 button in same time. if any body suggest it can be helpful to me.
You can add Animations to a parent Animation and then execute all of them togethers.
Here your ask is already answered:
How to execute multiple animation at same time

Mouseup programmatically in Qt?

Background
I'm building an application which runs in the background, and where the mouse cursor is moved programmatically into a dialog when the dialog "pops up". I have done this using QCursor.setPos
Problem
The problem I'm having is that if the mouse button is pressed down when the user is interacting with something outside the application this might lead to unwanted things happening. For example if the user is changing the volume and the mouse is moved the volume might go to max or min
Question
Is there any way (in Qt) to do a mouseup programmatically?
If I do this before changing the position of the cursor it seems to me that there is less risk of problems (though there might be other problems resulting from this approach)

Eventloop is not updating the GUI widget opacity value

I have a button widget I'd like to fade out (self.button1)
def button_slot(self):
fade_effect = QtGui.QGraphicsOpacityEffect()
self.button1.setGraphicsEffect(fade_effect)
hideAnimation = QtCore.QPropertyAnimation(fade_effect, "opacity")
hideAnimation.setDuration(5000)
hideAnimation.setStartValue(1.0)
hideAnimation.setEndValue(0.0)
hideAnimation.start(QtCore.QPropertyAnimation.DeleteWhenStopped)
self.hideAnimation = hideAnimation
The code is in PyQt, but is the same as the original Qt.
For a reason, the when I try the code separately in a test file, it works well.
However, when trying to integrate it in my code, it seems like the fading out animation is running in the background, but not updated in the GUI itself:
The button is stuck at the "clicked" state.
If I minimize and enlarge the window, The button's opacity is right where it's supposed to be (for example, if the duration is 5000ms from 1.0 to 0.0, enlarging the window after 2500ms will show 0.5 opacity).
The button is clickable even though it looks "stuck".
Why could this be happening? How can I force the GUI to update itself at every event iteration?
The only possible explanation I have is that you're blocking the event loop somewhere else in your code. The animation will definitely run, as your test case shows, but it's invoked from the event loop. If your code blocks -- if there's any place in your code where you wait for things, sleep, etc., then that's your problem.
GUI code in Qt and many other frameworks must be written in run-to-completion fashion. Every slot and event handler must execute as quickly as it can, and then return. When you add a breakpoint in a slot, and look at the stack trace when the code stops, you'll see that QEventLoop::exec() is somewhere there. Ultimately, all GUI code is called from the event loop.
Try reducing your code piecewise until the problem vanishes. That's how you'll know where the blocking part is. Qt provides, unfortunately, many methods named waitxxx(), and they tend to be used without understanding that they block the event loop. A blocked event loop means that the application does not respond to user interaction, and eventually the OS will detect it and issue a spinning beachball (OS X), a spinning circle (Vista/Win7) or perhaps a message about a stuck application. A spinning beachball/circle means that the application's main event loop is blocked.

Catching an onReleaseOutside for the stage

Firstly I feel this question is not a duplicate for :
Easiest implementation of onReleaseOutside in AS3?
Now, the problem , I want to do some action when the mouse_down happened inside the stage, but the mouseup happened outside it.
e.g check google finance charts, try dragging the change range divider and then make the drag such that your mouse exists the browser screen, and then do a mouse_up outside the browser, this will trigger some action inside the stage , i.e make the range stick to the position it was, when the mouse exited the window.)
How can this be done in Flex 3/4??
Thanks,
Neeraj
Try this one:
stage.addEventListener(Event.MOUSE_LEAVE, check);

Flex Air RollOver on inactive Native Window

I have a Native Window in Flex AIR. Let's say the window doesn't have a focus. It is inactive. Is it possible to find out when mouse is over such window? The window is always in front. I heard that it is possible by checking stage.mouseX in ENTER FRAME handler. But maybe there is a more elegant solution ?
I would look into using the MouseEvent.MOUSE_OVER event; which I would expect to fire whenever the mouse enters the window.
The only issue I see is that the NaiveWindow class does not document mouse events. So, the mouse event will most likely have to be dispatched from one of the children of the NativeWindow. You may try adding a a transparent image as the background, or something similar, and listen for the event on that image.
Not sure what you mean by you have a NativeWindow, but if you've extended spark.components.Window (which is the way you should be creating a window) and add a MouseEvent.MOUSE_MOVE listener to it then that will be triggered whenever the mouse is moving over the window, regardless of whether or not the window or application itself has focus.

Resources