button

How to programmatically create/initialise a Button with a custom style?

試著忘記壹切 提交于 2020-01-04 09:08:09
问题 I am trying to programmatically create some Buttons to add them to an existing ViewGroup. This works fine, but I am not able to init the buttons with the right style. I am aware, that it is not possible to set/change the style of view once it has been created. But all solutions I found so far say, that it should be no problem to create a view with a custom style (from a API level 11 up I think and I am using 14+): Button button = new Button (getActivity(), null, R.style.MyButtonStyle); The

Creating image variable not working

醉酒当歌 提交于 2020-01-04 06:31:30
问题 So I write the following code in eclipse: package myProgram; import com.sun.glass.ui.Screen; import com.sun.prism.paint.Color; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.geometry.Rectangle2D; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.StackPane

Change text for multiple buttons in one operation

纵然是瞬间 提交于 2020-01-04 06:07:14
问题 I have a form which consist of many buttons (50+) and they all have the same name except for the suffix number. ( btn_0 , btn_1 , btn_3 , etc.) I want to change the text of those buttons in one operation. Is there a way of treating buttons like arrays? btn_[i].Text = "something"? Maybe execute a string? "btn_{0}.Text=\"something\"" 回答1: you will need to access each button at a time to do this. Do it in a loop like this foreach(var btn in this.Controls) { Button tmpbtn; try { tmpbtn = (Button)

Detect when a user moves off of a button in Android

本秂侑毒 提交于 2020-01-04 05:20:21
问题 Is it possible to detect anytime a user moves their finger off of a button after they have been pressing down on it? I have determined that onTouchListener will get an action when the user moves off of the button vertically (It gives an action: ACTION_CANCEL), but I have not been able to find a way to determine when a user moves off the button horizontally. public boolean onTouch(View arg0, MotionEvent arg1) { switch(arg1.getAction()){ case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION

Set button height equal to the button width

社会主义新天地 提交于 2020-01-04 04:38:06
问题 I've seen this question a lot on the internet, but all solutions didn't work for me.. So this is the problem. I want a button that has 50% width of the screen (that works fine). But now I want it to have the same height the as the width. Somehow this doesn't work: Button button1 = (Button) findViewById(R.id.button1); int btnSize = button1.getLayoutParams().width; button1.setLayoutParams(new LinearLayout.LayoutParams(btnSize, btnSize)); See this for the code: Activity1.java: package nl.jesse

jQuery validation works with input type=“submit”, but not html button element. Why?

二次信任 提交于 2020-01-04 04:23:05
问题 Using ASP.NET, why is it that the bassistance.de jQuery validation plugin prevents form submission when using input type="submit" elements, and not html button elements? The validation fires when using an html button (type="submit") tag, but the form is still submitted. Is there a way to make the jQuery validation plugin work with html button elements? A quick example: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <script type="text/javascript"> $(document).ready(function

Prevent button from being clicked programmatically

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-04 02:41:08
问题 I have the following button: <input type="button" disabled onClick=document.location.href="?hash=blabla" tabindex="-1" class="btn btn-transparent btn-xs cbut0" /> Now the button is disabled and using another script to re-enable it on mouse-over event, however it seems users can still click the button programmatically by loading a simple external javascript such as: window.onload = setTimeout(function(){ $('input.btn.btn-transparent').click(); }, 10000); Is there any way to prevent this

How to set size of button Xamarin

浪子不回头ぞ 提交于 2020-01-04 02:06:15
问题 left label code xaml <Label x:Name="presentBtn" Text="선물함" FontSize="16" HorizontalOptions="Start" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Column="0" BackgroundColor="#A8D2F1"> c# presentBtn.HeightRequest = 45.0 * (double)App.ScreenWidth / 720.0; presentBtn.WidthRequest = 150.0* (double)App.ScreenWidth / 720.0; . . . right button code xaml <Button x:Name="ticketBtn" Text="티켓충전" HorizontalOptions="End" FontSize="16" Clicked="changeTicketCharge" Grid.Column="1"

Kivy - editing label when button clicked

妖精的绣舞 提交于 2020-01-04 02:03:06
问题 I wish button1 to edit Label 'etykietka' when clicked, but i don't know how. Have you got some ideas? class Zastepstwa (App): def build(self): lista=WebOps().getList() layout = BoxLayout(orientation='vertical') etykietka = Label(text='aa', font_size=10) button1 = Button(text='aa') button1.bind(callback) layout.add_widget(etykietka) layout.add_widget(button) return layout def callback (instance): newLabelText='kkk' #? 回答1: you need to pass your label to callback, a nice way to do it is to use

How to incorporate a g:link into an ordinary button?

↘锁芯ラ 提交于 2020-01-03 18:42:42
问题 In my grails application there is a view with a a g:link tag - it works fine, but the visuals are kind of awkward. Therefore, I want to disguise that g:link with an ordinary button. I've tried a span class and input type="button" but this did not do the trick. Side note : I don't want a g:form with an submit action. Any help is really appreciated! 回答1: Amit Jain's answer worked but had some problems in ie 8 & 7 (looked like some kind of style overlapping error). This solution worked in all