Android. How do I keep a button displayed as PRESSED until the action created by that button is finished?

I used a function like void setHighlighted(boolean highlight) { button.setBackgroundResource( highlight ? R.drawable.bbg_pressed : R.drawable.button_background); } where button_background is a selector defined in button_backgroung.xml: <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android” > <item android:state_pressed=”true” android:drawable=”@drawable/bbg_pressed”></item> <item android:state_focused=”true” android:drawable=”@drawable/bbg_selected”></item> <item android:drawable=”@drawable/bbg_normal”></item> </selector> That is, this code does not interfere with the pressed state used by the Android framework; … Read more

Generate Tkinter Buttons dynamically

I think the problem is that the lambda is picking up the final value of i after the for loop ends. This should fix that (untested): import Tkinter as tk for i in range(boardWidth): newButton = tk.Button(root, text=str(i+1), command=lambda j=i+1: Board.playColumn(j, Board.getCurrentPlayer())) Board.boardButtons.append(newButton) Update BTW, this worked by adding an argument to the lambda function … Read more

Android: Creating shaped button

I use a crapload of irregular shaped buttons on my app, and to change the “hot zone” or “clickable area” of the button, I just use the Bitmap.getPixel() method to check for alpha on the image used. If the method returns 0, then don’t perform click event. Example: (1) Create your button as usual, whichever … Read more

Adding a remove button to a column in a table

Here is sample working version. public class TableEditorTest { /** * @param args */ public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); TableViewer viewer = new TableViewer(shell); viewer.getTable().setHeaderVisible(true); viewer.getTable().setLinesVisible(true); viewer.setContentProvider(new ArrayContentProvider()); TableColumn column = new TableColumn(viewer.getTable(), SWT.NONE); column.setText(“First Name”); column.setWidth(100); TableViewerColumn firstNameCol = new TableViewerColumn(viewer, … Read more

Button click not working inside update panel

Try this set ChildrenAsTriggers to true and add EventName=”Click” in asp:AsyncPostBackTrigger <asp:UpdatePanel ID=”updatePanel2″ runat=”server” UpdateMode=”Conditional” ChildrenAsTriggers=”true”> <ContentTemplate> <asp:Button ID=”btnBlock” class=”Button” Text=”BlockCalls” runat=”server” onclick=”btnBlock_Click” Enabled=”True” Width=”100px” /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID=”btnBlock” EventName=”Click”/> </Triggers> </asp:UpdatePanel>

Custom Button in SwiftUI List

In standard variant List intercepts and handles content area of tap detection, in your custom style it is defined, by default, by opaque area, which is only text in your case, so corrected style is Update for: Xcode 13.3 / iOS 15.4 It looks like Apple broken something, because listRowBackground now works only inside List … Read more