How to make the pressing of a button keep an event occurring at a controlled rate?

Suppose I use a Button[] to make some event occur, how can I make the pressing of this button keep that event occurring at a controlled rate? I tried the following:

x = 0; Button["X", Dynamic[Refresh[x = x + 1, UpdateInterval -> 1]]] Dynamic[x] 

But it doesn’t keep repeating the event x=x+1 if the button keeps pressed. If there is some neater/better alternative without Button[], I’m open to it.

CSS Button effects not working across browsers

Having a few issues with a CSS Button effects not working across browsers.

It displays as I would like it in Chrome, but not Firefox.

Can't seem to find the root of the problem. Here is what I have.


<a class="soft">Button</a>
Code (markup):

a.soft {display: inline-block;font-family:'Varela Round', sans-serif;padding:2rem3rem;font-size:1.25vw;box-shadow:-10px-10px20px0#E6E6E6,10px10px20px0#ABABAB, inset 10px10px20px0#E6E6E6, inset...
Code (CSS):

CSS Button effects not working across browsers

Button Size in Manipulate

Consider the following code

Manipulate[a,  Dynamic@Grid[{     {"Slider", Control[{{a, 0, ""}, 0, 1, .1}]},     {"Checkbox", Control[{{b, 1, ""}, {1, 0}}]}     }, Alignment -> {{Right, Left}, Automatic}],  Delimiter,  Button["Button 1"],  Button["Button 2"],  ControlPlacement -> Left] 

which gives

enter image description here

Now, if we were to include an If statement for one of the buttons, we would need to use Dynamic. For example, we could use

Manipulate[a,  Dynamic@Grid[{     {"Slider", Control[{{a, 0, ""}, 0, 1, .1}]},     {"Checkbox", Control[{{b, 1, ""}, {1, 0}}]}     }, Alignment -> {{Right, Left}, Automatic}],  Delimiter,  Button["Button 1"],  Dynamic[If[a == 0, Button["Button 2"], Button["Button 3"]]],  ControlPlacement -> Left] 

which yields

enter image description here

As one can see, the button alignment changes when I do this. I want to fix this, to keep the same appearance as in the first example. One attempt at trying to solve this was to consider a Dynamic@Grid. That is,

Manipulate[a,  Dynamic@Grid[{     {"Slider", Control[{{a, 0, ""}, 0, 1, .1}]},     {"Checkbox", Control[{{b, 1, ""}, {1, 0}}]}     }, Alignment -> {{Right, Left}, Automatic}],  Delimiter,  Dynamic@Grid[{     {Button["Button 1"]},     If[a == 0, {Button["Button 2"]}, {Button["Button 3"]}]     }],  ControlPlacement -> Left] 

This, however, makes it a bit worse:

enter image description here

I could change the ItemSize within the Grid to get something similar to what I want, but I would have to do it manually. For instance,

Manipulate[a,  Dynamic@Grid[{     {"Slider", Control[{{a, 0, ""}, 0, 1, .1}]},     {"Checkbox", Control[{{b, 1, ""}, {1, 0}}]}     }, Alignment -> {{Right, Left}, Automatic}],  Delimiter,  Dynamic@Grid[{     {Button["Button 1"]},     If[a == 0, {Button["Button 2"]}, {Button["Button 3"]}]     }, ItemSize -> 30],  ControlPlacement -> Left] 

leads to

enter image description here

Still, the alignment with the slider is not perfect, and I’d have to manually adjust it. I wonder if it’s possible to do this in a more “automatic” way, without relying on manually fixing the ItemSize. I could include all controls in a Grid, but the problem with that is that the Delimiter doesn’t seem to format if I use a Grid, and I want to keep it in my Manipulate. Any ideas how to solve this?

Furthermore, how would I deal with the case

Manipulate[a,  Dynamic@Grid[{     {"Slider", Control[{{a, 0, ""}, 0, 1, .1}]},     {"Checkbox", Control[{{b, 1, ""}, {1, 0}}]}     }, Alignment -> {{Right, Left}, Automatic}],  Delimiter,  Dynamic@Column[{     {Button["Button 1"], Button["Button 2"]} // Row,     {Button["Button 3"], Button["Button 4"]} // Row     }, ItemSize -> 15],  ControlPlacement -> Left] 

that is,

enter image description here

Any suggestions are appreciated.

Unintended window opening when pressing Unity’s “Submit” button

I’ve been working on a top down 2D game for a while now, and yesterday I found a strange bug that I just can’t explain to myself whatsoever. I have a loot window for looting enemies, as well as a character panel to equip gear/see stats. I realized that after I open and close a loot window, if I spam the space button (used for attacking, not for opening any windows) it sometimes (seems to depend on screen positioning) opens the character panel. Once I “found” it, I can spam space to open/close the character panel.

Went to the character panels OpenClose() function (all it does is set the canvas group alpha to 0 and block raycast to false and vice versa) which is being called unintendedly, put a debug.log inside to verify if it really was being called, and yes, it is. I look up all references to see where I used it, but I only use it in a single place in the project that is behind an if-statement looking for they keycode C (NOT space). I added a debug.log for the Input.inputstring to see if somehow a magic C button press is ending up in that function, but no. If I press C to open the window, the debug log pops up, if I press space, the inputstring appears to be empty, so the if statement to get to the only place in the code referencing that function cannot be met. Removed the space button from my Player entirely, the behaviour still persists.

Added another debug.log with stackTrace.GetFrame(1).GetMethod().Name to show who is actually running this function, but it turns out that if I run it and press C, it says it’s being opened by the update function in the UIManager (as expected). If I run it the strange, unintended way, it says it is being run by the EventSystems Invoke function. Coupled with the fact that the behaviour persists despite the space button being removed from the player, I realized that it’s Unity’s built in “Submit” button being pressed.

Strange behaviour:

  • If I rename the OpenClose() function that is being called to anything else, the behaviour stops. Looked for all references of the OpenClose string through the entire project, it only shows up in the other 7-8 OpenClose functions for other windows I have, that seem to work normally.
  • It appears to call the submit function on the OpenClose button for the character panel, but only under the circumstance that I closed a loot window and haven’t clicked the mouse anywhere yet afterwards. If I deactivate the button that holds the character panels OpenClose function, the behaviour stops. The button shouldn’t be pressed though, because it is on a canvas group with alpha 0/block raycast=false, just like all the other buttons with the identical function that work fine. The loot window has no idea about the character panel either, and all the windows are properly wired to their own OpenClose function.

So basically my issue is; how do I figure out why this function is being called? It feels as if closing the loot window somehow “caches” the OpenClose button for the character panel onto the submit button, but only until I click elsewhere on the screen. Did you guys have any experience with a similar situation? Could you share some pointers on how to debug this? I’ve spent about 4 hours on this now and don’t know how to get any further.

Thanks for the long read! Any help appreciated.

How to add an extra button on woocommerce shop page and use to to send the product info with image in mail?

I am using a WooCommerce Catalog Mode plugin and with it, I hid the “add to cart” button and add “enquiry” button. I want an extra button beside it which will share product name, image, info with branding and backlink to the webpage in a proper format.

Where could exit button be removed during onboarding process?

My company is re-designing the on-boarding process for Emergency Service within the app. The process as follows:

Page 1: Intro of Emergency Service Page 2: TOS Page 3: Permission Needed from user Page 4-9: Collection of personal/medical data from users for emergency service in the case of emergency situation

There’s an exit button from page 1-3 but not on page 4-9 onwards. However, “Back” button is presented from page 4-9.

My rational to remove exit button from Page 4- 9 as follows: 1. Users have 3 opportunities to exit the process in the beginning 2. Checked other 20 apps and found that all of them have no exit button after you agree on TOS and then start asking for your detailed information

Could anyone chip in or validate the user experience on lack of exit button after Page 3?

Any feedback is appreciated.


Button reaction depending on the x-coordinate

I need to show some boring tables (some dates, some number and some text; no images) with a lot of boring details. Imagine your bank statement.

On mobile, I’ll have to use multiple lines for each entry. Fortunately, this means that the entry is big enough to work as a button.

Unfortunately, I’d need two or three buttons per entry, for actions like

  • show even more details (leading to a new page)
  • mark as read
  • a menu for everything else

Obviously, adding them would take up a lot of space (currently, the users can see about eight entries at once, which may be fine; adding buttons would reduce it to maybe a half).

So I’m thinking about making the entries react differently according to where they get touched, e.g.,

  • left third ⇒ mark as read
  • middle third ⇒ show menu
  • right third ⇒ show more details

Obviously, the user will must some help the first time they use it.

  • Is this a good idea?
  • Are there already some well-known apps doing something similar?
  • Is there a simple and compact way how to visually indicate this functionality?

tab order of help button in dialogs

When I place the help button in dialogs like here:

enter image description here

What tab order should I use? It’s obvious that the content panel uses tabindex values that correspond to the reading order which is supported by the optical layout (which may indeed be questionable in this very case). My question is only about the relation of the order of content, Help, OK, Cancel.

The reading order clearly suggests content, Help, OK, Cancel. Whereas IMHO the fill-in order suggests content, OK, Cancel, Help because you change input controls via tab key, and after completing the form, it would make sense to get to the OK button. To me, this looks like a dilemma, but I have only a limited knowledge of UX.

What is the preferable option from the usability POV?

Placement of Help button: left or right to OK/Cancel

I’m adding help to a Windows desktop application that is being in use since the Windows XP era. All the modal dialogs display the typical OK/Cancel button set placed at the bottom right as shown in this example/placeholder screenshot (in fact no MessageBox has a Help button):

enter image description here

I wish to cause minimal confusion to my users after the next release that’s why I hesitate to place the Help button right to the Cancel button. The standardized order shown by the Win32 MessageBox function when called with MB_OKCANCEL | MB_HELP in the uType parameter would shift the already existing buttons to right (replacing OK by Cancel and Cancel by Help) like this:

enter image description here

I searched the web for this, but it turned out to be very hard to get useful answers when combining help, button, and placement, nevertheless I found some screenshots with help buttons bottom left which looks good and useful from my POV.

Where should I place the Help button to the dialogs of an old-fashioned application?