标签: cancel-button

在调用cancelButton之后,将UISearchBar隐藏在UINavigationBar下面

我通常使用[self.tableView setContentOffset:CGPointMake(0,40)];以隐藏在navigationBar下面的UISearchBar(我将其设置为tableView的标题).在viewDidLoad中一切正常:加载视图时,searchBar位于navigationBar下方.然后我把相同的代码行

[self.tableView setContentOffset:CGPointMake(0,40)]
Run Code Online (Sandbox Code Playgroud)

- (void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller
Run Code Online (Sandbox Code Playgroud)

但它可以做任何事情:单击取消按钮时,searchBar仍然可见.怎么了?

iphone cancel-button uisearchbar uisearchdisplaycontroller

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

JavaFX - 如何知道是否按下了取消

如何在此JavaFX对话框中知道是否按下了"确定"或"取消"按钮.

对话代码:

public String delimiter;

public void delimiterYES() throws IOException {
    delimiter=new String();
    TextInputDialog dialog = new TextInputDialog();
    dialog.setTitle("Delimiter");
    dialog.setHeaderText("Enter the delimiter");

    Optional<String> result = dialog.showAndWait();
    if (result.isPresent()) {
        delimiter=result.get();
    }
}
Run Code Online (Sandbox Code Playgroud)

java dialog javafx cancel-button

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

C#CancelButton关闭对话框?

(VS2005,.Net 2.0)

我有一个使用ShowDialog()方法显示为对话框的表单.表单的CancelButton属性设置为窗体上的按钮.即使我将该按钮的DialogResult设置为None,单击该按钮仍会关闭对话框.我不希望这种情况发生 - 我希望能够控制对话框是否关闭.

表单的AcceptButton不会出现此问题 - 将该按钮的DialogResult设置为none,我可以进行必要的处理,然后决定是否手动设置表单的DialogResult以使其关闭.

我认为如果按下Escape,则CancelButton属性意味着指示应该"点击"的按钮(就像在按下Enter时,AcceptButton只应指示按钮"点击").我错了吗?我错过了我的表格结束的其他原因吗?或者这是一个错误?

编辑:添加了代码.这是带有取消按钮(按钮1)的对话框表单(表单2).取消按钮只是表单的CancelButton,它没有将DialogResult设置为Cancel,但按下按钮仍然关闭表单

    private void InitializeComponent()
    {
        this.button1 = new System.Windows.Forms.Button();
        this.SuspendLayout();
        // 
        // button1
        // 
        this.button1.Name = "button1";
        this.button1.Text = "button1";
        // 
        // Form2
        // 
        this.CancelButton = this.button1;
        this.Controls.Add( this.button1 );
        this.Name = "Form2";
        this.Text = "Form2";
        this.ResumeLayout( false );
    }
Run Code Online (Sandbox Code Playgroud)

c# modal-dialog cancel-button

4
推荐指数
2
解决办法
3万
查看次数

将参数传递给 backgroundWorker(用作取消按钮)

我是 C# 和面向对象编程的新手。我一直在尝试在我的 GUI 中实现一个“取消”按钮,以便用户可以在过程中停止它。

我读过这个问题:如何实现停止/取消按钮?并确定 backgroundWorker 对我来说应该是一个不错的选择,但是给出的示例没有解释如何将参数传递给 backgroundWorker。

我的问题是我不知道如何将参数传递给 backgroundWorker 以使其停止进程;我只能让 backgroundWorker 停止自己。

我创建了以下代码来尝试了解这一点,其中我的表单有两个按钮(buttonStart 和 buttonStop)和一个 backgroundWorker(backgroundWorkerStopCheck):

using System;
using System.ComponentModel;
using System.Windows.Forms;
using System.Threading;
using System.Timers;

namespace TestBackgroundWorker
{
    public partial class Form1 : Form
    {
        public Form1()
        {         
            InitializeComponent();

            // Set the background worker to allow the user to stop the process. 
            backgroundWorkerStopCheck.WorkerSupportsCancellation = true;
        }

        private System.Timers.Timer myTimer;

        private void backgroundWorkerStopCheck_DoWork(object sender, DoWorkEventArgs e)
        {
            //If cancellation is pending, cancel work.  
            if (backgroundWorkerStopCheck.CancellationPending)
            { …
Run Code Online (Sandbox Code Playgroud)

c# multithreading backgroundworker argument-passing cancel-button

4
推荐指数
1
解决办法
6105
查看次数

单击取消按钮时如何绕过必要的字段验证?

我已经使用HTML输入类型为我的文本框使用所需的属性.现在我的困境是,如果不填写具有必需属性的字段,我就无法离开页面.我已经尝试将causeValidation设置为false但它不起作用.我无法将我的文本框更改为asp文本框,因为它将在页面中进行大的更改.还有其他方法吗?

<asp:Button runat="server" ID="buttonCancel" CssClass="cu-btn-direction" style="float:right; margin-right: 15px; margin-bottom: 60px;" Text="Cancel" CausesValidation="false" />
Run Code Online (Sandbox Code Playgroud)

编辑:

我尝试添加验证组但没有工作...什么有效将UseSubmitBehavior设置为false http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.usesubmitbehavior%28v = vs.110%29.aspx但是如链接中所解释的那样,如果没有启用js,它将无法工作.任何其他方式?

html vb.net cancel-button required-field

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

按下取消按钮后如何保持范围栏?

我有一个UITableView,顶部有一个搜索栏.我使用UISearchDisplayController来实现相同的功能.它还有一个带两个按钮的示波器栏.默认情况下,当我启动应用程序时,将显示范围栏.当我在搜索后单击取消按钮时,示波器条消失了.因此,即使在我按下"取消"按钮后,还有任何方法可以保留范围栏.我使用了以下代码,但它不起作用.

- (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar
{
    [searchBar setShowsScopeBar:YES];
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

谢谢 :)

iphone cancel-button uitableview uisearchbar uisearchdisplaycontroller

3
推荐指数
1
解决办法
3334
查看次数

引导程序应用程序回滚

我正在尝试创建一个安装我的 msi 的 Wix burn 引导程序。引导程序 exe 工作正常,但唯一的问题是,每当我尝试中途取消安装时,msi 中添加的自定义操作都不会停止。任何人都可以告诉如何在单击取消按钮时停止并回滚安装。提前致谢。

wix rollback bootstrapper cancel-button burn

3
推荐指数
1
解决办法
1199
查看次数

Woocommerce 中我的帐户订单列表上的条件取消按钮

这是参考使用 Woo Cancel for Customers 插件回答我的帐户订单列表上的添加取消按钮

我还尝试将函数添加到 functions.php 中,但也得到了参数太少的错误: 在此处输入图片说明

我做了 LoicTheAztec 提供的相同功能:

add_filter( 'woocommerce_valid_order_statuses_for_cancel', 'custom_valid_order_statuses_for_cancel', 10, 2 );
function custom_valid_order_statuses_for_cancel( $statuses, $order ){

// Set HERE the order statuses where you want the cancel button to appear
$custom_statuses    = array( 'pending', 'processing', 'on-hold', 'failed' );

// Set HERE the delay (in days)
$duration = 3; // 3 days

// UPDATE: Get the order ID and the WC_Order object
if( isset($_GET['order_id']))
    $order = wc_get_order( absint( $_GET['order_id'] ) …
Run Code Online (Sandbox Code Playgroud)

php wordpress cancel-button orders woocommerce

3
推荐指数
1
解决办法
3150
查看次数

Yii2 CRUD:如何实现取消按钮

我只是在学习Yii 2框架.我很好奇在典型的CRUD应用程序的创建/更新表单中实现取消按钮的最佳做法是什么.我从Yii 2.0生成了CRUD应用程序.教程https://www.yiiframework.com/doc/guide/2.0/en/start-gii.然后我在_form.php视图中添加了Cancel按钮

<div class="country-form">

<?php $form = ActiveForm::begin(); ?>

<?= $form->field($model, 'code')->textInput(['maxlength' => true]) ?>

<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

<?= $form->field($model, 'population')->textInput() ?>

<div class="form-group">
    <?= Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-success']) ?>
    <?= Html::submitButton(Yii::t('app', 'Cancel'), ['name' => 'cancel', 'class' => 'btn btn-primary']) ?>
</div>

<?php ActiveForm::end(); ?>
Run Code Online (Sandbox Code Playgroud)

并修改了CountryController的actionUpdate方法:

public function actionUpdate($id)
{
    $model = $this->findModel($id);

    $request = Yii::$app->request;



    if(null !==(Yii::$app->request->post('cancel'))) {
        return $this->redirect(['index']);
    }


    if ($model->load($request->post()) && $model->save()) {
        //return $this->redirect(['view', 'id' => $model->code]); …
Run Code Online (Sandbox Code Playgroud)

crud cancel-button yii2

3
推荐指数
1
解决办法
853
查看次数

如何使取消按钮像"X"按钮一样工作?

在我的XAML文件中,我有一个窗口,我正在尝试使用它,无论用户单击"X"按钮,还是单击"取消"按钮,行为都是相同的.

我的删节代码如下:

public partial class Dialog : Window
{
    .
    .
    .

    private void Window_Closing(object sender, CancelEventArgs e)
    { 
        e.Cancel() = true; //Works as expected
    }

    private void CancelButton_Click(object sender, RoutedEventArgs e)
    {
        e.Cancel() = true; //Compile error
    }
}
Run Code Online (Sandbox Code Playgroud)

所以我意识到我的问题是RoutedEventArgs没有Cancel()方法.有谁知道如何使RoutedEventArgs更像CancelEventArgs?

c# wpf xaml cancel-button

2
推荐指数
1
解决办法
1746
查看次数