button

Flutter Enable/Disable Button based on TextFormField content

这一生的挚爱 提交于 2020-12-03 11:24:09
问题 How can I activate/deactivate a button based on the content of a TextFormField? I want to make sure a user can only press Button X if the TextFormField has 10 entered numbers (if it's a mobile number). Thanks! 回答1: A simple way would be to set the autovalidate property of our TextFormField to true . This will automatically detect for changes on our TextFormField widget. We can then try to check if our TextFormField's value has a String length of 10 characters on the validator property . After

Onclick CSS button effect

会有一股神秘感。 提交于 2020-11-30 10:53:02
问题 I'm creating a CSS button and I'm trying to make an onclick effect: when the user clicks on the button it would push down the button text by 1px. My problem here is that it's pushing the whole bottom of the button. How would you proceed? <div class="one"> <p><a id="button" href=#>Button</a></p> </div> Here's the CSS: #button { display: block; width:150px; margin:10px auto; padding:7px 13px; text-align:center; background:#a2bb33; font-size:20px; font-family: 'Arial', sans-serif; color:#ffffff;

Onclick CSS button effect

纵饮孤独 提交于 2020-11-30 10:40:51
问题 I'm creating a CSS button and I'm trying to make an onclick effect: when the user clicks on the button it would push down the button text by 1px. My problem here is that it's pushing the whole bottom of the button. How would you proceed? <div class="one"> <p><a id="button" href=#>Button</a></p> </div> Here's the CSS: #button { display: block; width:150px; margin:10px auto; padding:7px 13px; text-align:center; background:#a2bb33; font-size:20px; font-family: 'Arial', sans-serif; color:#ffffff;

leaflet Js custom control button add (text, hover)

霸气de小男生 提交于 2020-11-30 06:39:57
问题 I followed this control-button-leaflet tutorial and it worked for me. Now I want to: show some text when i hover over the button (like with the zoom buttons) Change the color of the button when i hover over it be able to write text inside the button instead of an image. Here's the code: var customControl = L.Control.extend({ options: { position: 'topleft' }, onAdd: function (map) { var container = L.DomUtil.create('div', 'leaflet-bar leaflet-control leaflet-control-custom'); container.style

How to drag and drop button onto GridPane?

人走茶凉 提交于 2020-11-30 00:37:47
问题 I'm working on a school project creating a simple battleship game and i want to use the Drag And Drop function to drag buttons from HBox on the bottom of the screen to the GridPane that the player uses to place ships on. But i can't get it to work properly. Here's a picture of my board per now. I have tried to use the button.setOnMouseDragged(e -> {CODE HERE}); but it doesnt work. Here is the code i used for my window public class GridOrganizer { private BorderPane borderPane; public

How to drag and drop button onto GridPane?

北城以北 提交于 2020-11-30 00:32:55
问题 I'm working on a school project creating a simple battleship game and i want to use the Drag And Drop function to drag buttons from HBox on the bottom of the screen to the GridPane that the player uses to place ships on. But i can't get it to work properly. Here's a picture of my board per now. I have tried to use the button.setOnMouseDragged(e -> {CODE HERE}); but it doesnt work. Here is the code i used for my window public class GridOrganizer { private BorderPane borderPane; public

Changing the shape of tkinter widgets

孤者浪人 提交于 2020-11-29 10:24:49
问题 So I have a simple button: f1button3=Button(text="Database", command = lambda: DatabaseWidgets()).place(x=1,y=30) The buton is always a rectangle, but I want it to have curved edges, or possibly even change the shape. Is this at all possible? 回答1: I hit the same problem. My solution was to use an image, then bind that to a click. Here is the code I used: from Tkinter import * from PIL import ImageTk, Image app = Tk() def do(event): print("Button Clicked!") #... img = ImageTk.PhotoImage(Image

Android scale button on touch

天涯浪子 提交于 2020-11-28 07:47:12
问题 I know how to scale the button to a determinated value, but is there a way to increase/decrease the button size per time as long the user is touching it? Something like this: Button myButton = (Button)findViewById(R.id.myButton); myButton.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { // Some timer action here or is there a better way? v.setScaleX(v.getScaleX() + 0.1f); v