Make WKInterfaceButton keypress clearer in watchOS 2 - watchkit

I find the graphical feedback when pressing buttons (WKInterfaceButton) in watchOS2 is very weak. It is hard to see and even Apple seems to thinks this is the case as they e.g. in the unlock screen change the background to white on active buttons. The default behaviour is to dim the whole button.
How can I make a button press cleared in watchOS 2? I can e.g. change the button text color on activity but how do I easily change it back when it is no longer active?

There is currently no way to detect touch-down, or other events, on WKInterfaceButtons like you can on UIButtons on iOS. The only touch event you can detect is touch-up-inside, which calls the IBAction method.
Therefore what you wish to accomplish cannot be accomplished. Something you might consider is animating the button appearance once the action has been triggered. For example in my app upon button tap I animate the button's background color, then animate it back to the original color. That provides more visual confirmation to the user so they are certain the button was tapped.
I'd encourage you to file an enhancement request at bugreport.apple.com if you'd like to have more control with touch events.

Related

How to listen for two simultaneous touch events in React Native?

Our goal is to have two button-like views in our React Native game. They will each consist of a View wrapping around some animated image or alike. The views should be touchable at the same time.
This means: We want to trigger some action on the onTouchStart (like add a symbol to a text) and change the state of the view while it is pressed (for example to change the image in the background or something like that).
Using onTouchStart did not work, since on Android (and only there) we had a Problem: When keeping the first button pressed, pressing the second button with a second finger caused the first callback to trigger, not the second one.
How should we implement this correctly without messing with native code?

iOS7 Custom Button Fading with UIActionSheet

I'm running into an issue where for navigation, we have to use a custom back button, which we are matching to iOS7. So we're creating a UIButton with a background image and then setting it as a custom view of a UIBarButtonItem.
The issue is that when an Action sheet is presented by iOS7, the background is faded. However, the custom button does not and it looks mismatched. Question is - is there a property that can be set to provide the image for the faded state? (though this can be done with delegation, I wanted to see if there was a simpler solution before going that route).
I have tried to set a faded image for UIControlStateDisabled, UIControlStateSystem, UIControlStateReserved with no avail.
Screen shot below:
I ended up using delegation. When the action sheet is presented, my controller received a message and switched the button to faded. When action sheet was dismissed, my controller again received a messaged and switched button to normal.
Actionsheet was subclassed here, which is why I had to do this dance.
I have actually resolved this issue without delegation. The solution is to have a png with clear background. So just the blue of the back arrow. In that case, iOS handles the fading and desaturating. If you add background, it will not.

Keyboard control of GUI dialogs - Should default button change with focus?

In GUI dialogs, most applications provide for keyboard control as follows:
Enter key - presses the default button. (Default is usually indicated with a bold button border.)
Esc key - presses the Cancel or close button.
Space key - presses widget that currently has keyboard focus.
Tab key - advances focus to next widget.
Question is, when keyboard focus is on a widget that is a button, should the default button be changed to be the one with focus?
I see some issues with this behavior:
The display noise of redrawing buttons to unbold the outline of original default button and rebold the button under focus as being new default.
The Space key is now somewhat redundant with Enter key.
There is no keyboard accelerator to get the normal default button now (Usually the OK button).
However, it seems the trend has been in this direction to change the default button with focus change to another button. What is the rationale for this departure from the early GUIs? It would seem to provide less functionality given there is no way to press the original default button. Did people find that the original model was too complicated for users to understand? I would think keyboard control of dialogs would be a task for advanced users who would have no trouble understanding the model and prefer to have accelerator for current button (Space) and original default button (Enter) at all times.
Note that Qt for one is supporting the change: QPushButton's autoDefault property is responsible for the behavior of changing the default button. By default its value is true. Therefore, you must take extra action to set it to false for all buttons, to prevent them from becoming the default button when focused.
This is not a "departure from the early GUIs", at least not if by "early GUIs", you mean Windows 1.0. The behavior that you describe has been this way since the beginning.
The focused button is always "pushed" when the Enter key is pressed. The default button is only triggered in the following two situations:
The default button has the focus (which it does by default), or
The focus is on a control that does not process Enter key presses (such as a static control, or a single-line textbox that does not have the ES_WANTRETURN style flag set).
The famous Win32 blogger Raymond Chen has a post explaining this behavior (focus specifically on the last two quoted paragraphs):
A dialog box maintains the concept of a "default button" (which is always a pushbutton). The default button is typically drawn with a distinctive look (a heavy outline or a different color) and indicates what action the dialog box will take when you hit Enter. Note that this is not the same as the control that has the focus.
For example, open the Run dialog from the Start menu. Observe that the OK button is the default button; it has a different look from the other buttons. But focus is on the edit control. Your typing goes to the edit control, until you hit Enter; the Enter activates the default button, which is OK.
As you tab through the dialog, observe what happens to the default button. When the dialog box moves focus to a pushbutton, that pushbutton becomes the new default button. But when the dialog box moves focus to something that isn't a pushbutton at all, the OK button resumes its position as the default button.
The dialog manager remebers which control was the default button when the dialog was initially created, and when it moves focus to something that isn't a button, it restores that original button as the default button.
The behavior that I would expect is:
If I press enter when the window just pop up, it should press the default button
If I press tab, I start navigating through the widgets. In this case there are two options:
2.1 I press enter - this event should be delivered to the focused widget. There's no need to change the default button - simply hand the event to the focused widget.
2.2 I press escape. In this case, everything should go back to the state after the window is created.
Notes:
I come from a mixed background - I don't know if I learned this in windows, linux or Mobile OSes! This is just how I expect things to work out.
I don't use the space key (didn't know it's functionality)

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.

GWT designing a Button

I would like to do some notification stuff for my website.
I am done with the backend coding but i would like to display properly in the VIEW.
So exactly what i need to do is when ever there is a message i would like my button to change its color.I mean i want to do something which indicates that there is a message waiting for the user.
So basically i need to make my button blinking or change color so that it indicates the user that he has some message waiting for him
So can you please suggest me any button which can have an image as a display and a corresponding css file which i need to use which can blink when ever there is a message.
Both PushButton and ToggleButton allow setting an image as the face of the button. However, you should be able to make a normal Button "blink" just by using CSS and a Timer. Use addStyleName() and removeStyleName() in combination with the Timer - on new message, add your "blink" style (it's up to you to come up with it ;)), add a Timer and in its run() method removeStyleName() the "blink" style.
PS: See this blog post, to see how the Google team created the cross-browser, customizable buttons in GMail - but that's an overkill in this situation, IMHO ;)

Resources