标签: button

Android 按钮打开错误的活动

我的主页上有三个按钮。当我尝试点击它们时会发生一些奇怪的事情。例如,当我单击 NewGame 按钮时,它首先显示分数按钮应显示的内容,然后如果我单击后退按钮,它将继续显示它打算显示的活动。使用“关于”按钮,我必须单击返回两次(它显示 newGame 活动和分数活动。发生这种情况有什么原因吗?

public class Sakurame extends Activity implements OnClickListener {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);

    //set up click listeners for buttons
    View HighScoreButton = findViewById(R.id.highscore_button);
    HighScoreButton.setOnClickListener(this);
    View newButton = findViewById(R.id.new_button);
    newButton.setOnClickListener(this);
    View aboutButton = findViewById(R.id.about_button);
    aboutButton.setOnClickListener(this);

}

@Override
public boolean onCreateOptionsMenu(Menu menu){
    super.onCreateOptionsMenu(menu);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item){
    switch (item.getItemId()){
    case R.id.settings:
        startActivity(new Intent(this, Prefs.class)); …
Run Code Online (Sandbox Code Playgroud)

android button android-intent android-activity

0
推荐指数
1
解决办法
1403
查看次数

从按钮打开一个新的 JFrame

我想通过单击按钮 (btnAdd) 打开一个新的 JFrame;我试图创建一个动作监听器,但我没有运气;代码运行但单击按钮时没有任何反应。有问题的方法是以下代码中的最后两个。任何帮助深表感谢!

package AdvancedWeatherApp;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ListSelectionListener;

import weatherforecast.FetchWeatherForecast;

public class MainFrame extends JFrame implements ListSelectionListener {

private boolean initialized = false;
private Actions actions = new Actions();

private javax.swing.JScrollPane jspFavouritesList = new javax.swing.JScrollPane();
private javax.swing.DefaultListModel<String> listModel = new javax.swing.DefaultListModel<String>();
private javax.swing.JList<String> favouritesList = new javax.swing.JList<String>(
        listModel);

private javax.swing.JLabel lblAcknowledgement = …
Run Code Online (Sandbox Code Playgroud)

java swing button jframe actionlistener

0
推荐指数
1
解决办法
5万
查看次数

Django-Html 模板中的取消按钮通常是如何实现的?

我正在 Django 中学习 Web 开发。有一个页面 createInfo.html 用户输入信息,有两个按钮,保存和取消。这是我为取消按钮编写的内容

<input type="submit" value="Cancel" onclick="cancel()"/>


<script>
    function cancel() {
        c=confirm("Do you really want to cancel?");
        if (c==true)
        {

        }
        else{
        }
</script>
Run Code Online (Sandbox Code Playgroud)

如何实现脚本,以便

  • 如果用户在弹出的取消按钮上点击确定-->停留在这个页面,但是所有的数据都被清除了,即一个新的createInfo页面
  • 如果用户在弹出窗口中单击取消--> 保持原样(所有数据保持不变)

谁能帮忙提供一些关于如何实现取消按钮的代码?或者如果我的设计不正确,通常如何实现。非常感谢。

html button

0
推荐指数
1
解决办法
1937
查看次数

MVC 按钮应在新窗口/选项卡中打开 url

目前尚不清楚正确的语法应该是什么,我已经尝试了一些示例,但没有运气,这是我当前可以工作的按钮代码,我需要它在单击时保持作为按钮在新窗口/新选项卡中打开操作

<input type="button" title="Read" value="@T("Account.DownloadableProducts.Read")" onclick="location.href='@Url.Action("GetDownload", "Download", new { orderItemId = Model.DownloadMappingIds[product.Id].guid })'" />
Run Code Online (Sandbox Code Playgroud)

谢谢

asp.net-mvc button target

0
推荐指数
1
解决办法
7085
查看次数

WPF 按钮工具提示 InitialShowDelay 不起作用

有我的按钮:

<Button  Style="{DynamicResource MetroCircleButtonStyle}" HorizontalAlignment="Right" Grid.Column="3"  Width="40" Height="40" Command="{Binding NewConnectionCommand}">
                <Rectangle Width="20" Height="20">
                    <Rectangle.Fill>
                        <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_add}" />
                    </Rectangle.Fill>
                </Rectangle>
                <Button.ToolTip>
                    <ToolTip ToolTipService.InitialShowDelay="5000">
                        <StackPanel>
                            <TextBlock FontWeight="Bold">Add connection</TextBlock>
                            <TextBlock>Open the dialog to create the new connection.</TextBlock>
                        </StackPanel>
                    </ToolTip>
                </Button.ToolTip>
            </Button>
Run Code Online (Sandbox Code Playgroud)

我正在尝试将 initialShowDelay 设置为 5000 毫秒,就像你们看到的那样,但工具提示总是在默认时间显示......

我做错了什么?

wpf button tooltip

0
推荐指数
1
解决办法
536
查看次数

向GMSMapView(Google Map)添加一些按钮并更改图片按钮

我尝试但无法显示按钮

码:

btnLokasiSaya = UIButton(frame: CGRect(x: 341, y: 28, width: 100, height: 30))
self.viewMap.addSubview(btnLokasiSaya)
Run Code Online (Sandbox Code Playgroud)

故事板:

在此处输入图片说明

输出:在仿真中找不到我的按钮

在此处输入图片说明

button ios gmsmapview swift3

0
推荐指数
1
解决办法
177
查看次数

在Java中为按钮添加(内置?)图标?

我已经提供了一个类,它创建了一个按钮布局,但只有文本内部.我想知道是否还有相应的图标添加到按钮:

        public ShapeButtons(View view){
            String[] buttonLabels = { "Circle", "Rectangle", "Square", "Squiggle", "Polyline" };

            for (String label : buttonLabels) {
                Button button = new Button(label);
                button.setMinWidth(100);
                this.add(button, 0, row);
                row++;
                button.setOnAction(this);
    }
Run Code Online (Sandbox Code Playgroud)

对于按钮的构造函数,我知道有一种方法可以做Button(文本,节点图形),但我似乎无法弄清楚如何做到这一点?

java javafx button javafx-8

0
推荐指数
1
解决办法
80
查看次数

如何在R Shiny数据表中添加自定义按钮?

有一个选项可以在datatables.net网站上添加自定义按钮。如何在R Shiny应用中进行编码?一个按钮和观察者的基本R代码示例将非常有趣。

这是来自https://datatables.net/extensions/buttons/examples/initialisation/custom.html的 JS代码

$(document).ready(function() {
    $('#example').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            {
                text: 'My button',
                action: function ( e, dt, node, config ) {
                    alert( 'Button activated' );
                }
            }
        ]
    } );
} );
Run Code Online (Sandbox Code Playgroud)

谢谢 !

user-interface r button shiny dt

0
推荐指数
1
解决办法
1137
查看次数

如何使用动态创建的按钮在onclick事件上运行过程,并通过

这是在德尔福帕斯卡尔

我已经动态创建了一个二维的按钮数组。我希望这样,当您单击这些按钮时,按下的按钮将消失。(这是制作扫雷游戏)。

目前,我有这些按钮的数组,并且正在尝试将onclick事件设置为过程,并将该按钮的x和y索引传递给过程,以便它可以隐藏正确的按钮。

这是我用来链接到过程的内容: buttons[x,y].OnClick := buttonClicked(x,y);

x和y由for循环组成,以便我可以拥有2d数组。

这是我得到的错误。

E2010 Incompatible types: 'TNotifyEvent' and 'procedure, untyped pointer or untyped parameter'

步骤如下:

过程TMainPage.buttonClicked(buttonx:整数; buttony:整数);
开始
   button [buttonx,buttony]。可见:= False;
结束;

我认为问题是您无法通过OnClick事件发送变量。我不确定要做什么,所以可以提供指导。

delphi dynamic button

0
推荐指数
1
解决办法
114
查看次数

有没有一种方法可以简化使用数组的代码?

有没有一种方法可以通过使用数组来简化以下代码?例如,当单击HTML中的按钮1(索引为0)时,是否可以将其用于获取另一个数组中索引0处的值?

function f1() {
  document.getElementById("dis").innerHTML = "JoeMae";
}

function f2() {
  document.getElementById("dis").innerHTML = "TanakaMae";
}

function f3() {
  document.getElementById("dis").innerHTML = "James";
}

function f4() {
  document.getElementById("dis").innerHTML = "Deus";
}
Run Code Online (Sandbox Code Playgroud)
<button onclick="f1()">no.1</button>
<button onclick="f2()">no.2</button>
<button onclick="f3()">no.3</button>
<button onclick="f4()">no.4</button>
<p id="dis"></p>
Run Code Online (Sandbox Code Playgroud)

javascript arrays button

0
推荐指数
1
解决办法
68
查看次数