button 相关问题

按钮是图形用户界面中的简单元素,可以将鼠标点击或手指点击(在移动设备上)作为输入。

我可以用什么代码让我的按钮向左掉落

我正在设计一个应用程序,但我似乎想不出一个 CSS 规则集来使按钮向左倾斜。 所以我基本上是想让重置按钮落在数字的左边,也就是...

回答 2 投票 0

如果输出到电子纸,Raspberry Pi 的按钮会触发两次

我正在尝试创建一个程序来跟踪婴儿换尿布的情况。这个想法是在 Raspberry Pi 4 上连接三个按钮,以及一个 LCD 显示屏和一个电子墨水显示屏。当你清理...

回答 0 投票 0

页面没有按钮居中

我一直在努力,但没有任何效果, https://jsfiddle.net/lucianopinochet/fzse5962/ 如果有人有想法,我会非常感谢你。 .容器文章按钮{ 对齐自我:中心; } 我一直在努力,但没有任何效果, https://jsfiddle.net/lucianopinochet/fzse5962/ 如果有人有想法,我会非常感谢你。 .container article button{ align-self: center; } <div class="container"> <article> <h3>Free</h3> <h4>Forever Free Plan</h4> <p>Our generous free forever plan provides you with plenty to get started and get addicted to the tools that will take your work to the next level. No credit card required to get started.</p> <ul> <li>Unlimited pages & links</li> <li>Up to 5 gigabytes of storage</li> <li>Up to 20 databases</li> <li>Share up to 50 pages via URL</li> <li>Up to two guest users per page</li> </ul> <button>Sign Up Now</button> </article> </div> 试试这个: div{ width:100%; display:flex; align-items:center; justify-content:center; } <div> <button>submit</button> </div> 垂直和水平按钮将通过此代码居中。

回答 1 投票 0

按下按钮时执行的操作,而不是释放按钮时执行的操作(swiftui)

是否可以在按下按钮而不是松开按钮时更改数字?我尝试了各种选项,包括 simultaneousGesture (DragGesture(minimumDistance: 0)),但都没有用。 小...

回答 0 投票 0

不使用 Tkinter 的 Mpl 财务添加按钮

我想在不使用 Tkinter 的情况下使用 mpl 财务图形界面添加一个按钮,因为我失去了一些与 Tkinter 的功能。 怎么做 ?应该通过 Matplotlib 来完成吗? 请写...

回答 0 投票 0

如何在 React Native 中使用 Button 的 onPress 属性?

下面的代码不起作用,请告诉我这段代码有什么问题? 从'expo-status-bar'导入{StatusBar}; 从“反应”导入反应; import { StyleSheet, Text, View,Button } from 'react-n...

回答 1 投票 0

Android AlertDialog 单按钮

我想要一个 AlertDialog 构建器,它只有一个按钮,上面写着 OK 或 Done 或其他东西,而不是默认的是和否。 可以用标准的 AlertDialog 来完成吗,或者我有...

回答 10 投票 0

android studio:点击时自动推送/组织按钮

我目前正在为我的学期做一个小项目,当时我在设计 figma 时遇到问题,准备实施。 问题很简单,当用户按下其中一个 ...

回答 1 投票 0

Leaflet easyButton - 按钮文本未显示(无法调试 addTo)

我在使用 leaflet-easyButton 时遇到了问题。我已经将它安装到我的项目中: npm 安装 --save leaflet-easybutton 因此, /node_modules 中存在一个文件夹,我可以将其导入...

回答 1 投票 0

我可以调用使用单个 createElement 生成的多个按钮的不同效果吗? (在 Javascript 中)

我想使用 createElement 生成许多按钮,但我无法让按钮在单击时执行不同的操作。在这个例子中,我想要一个按钮来制作

回答 1 投票 0

角15提交按钮未启用验证码验证[关闭]

嗨,我是角度平台的新手,请有人帮助我 当我单击登录表单中的提交按钮时,角度为 15 的提交按钮未启用用户名、密码和验证码验证 如果我...

回答 0 投票 0

使用安卓应用程序运行脚本

我有这个 shell 脚本: #!system/bin/sh 尽管 : 做 同步 echo 3> /proc/sys/vm/drop_caches echo "脚本已经启动" 睡30m 完毕 退出 0; 我希望使用 Android 应用程序运行此脚本。 ...

回答 4 投票 0

尝试在 VBA 中编写一个提交按钮,将用户窗体数据插入数据库,但我似乎无法在标题下方插入第一行

全面披露,我在 VBA 方面非常糟糕,基本上只是将工作簿的所有代码与 Stack 解决方案、YT 教程、免费 UDEMY 课程和 ChatGPT 混合在一起。 我有...

回答 0 投票 0

WPF 多绑定按钮。已启用文本框

我是 WPF 的新手,我在网上找不到解决方案。我的问题是我希望仅当四个文本框没有有效性错误时才启用我的按钮。 我的代码是: 我是 WPF 的新手,我在网上找不到解决方案。我的问题是我希望仅当四个文本框没有有效性错误时才启用我的按钮。 我的代码是: <Button Content="Action" Click="Action_Click" > <Button.IsEnabled> <MultiBinding Converter="{StaticResource ValCon}"> <Binding ElementName="textBox1" /> <Binding ElementName="textBox2"/> <Binding ElementName="textBox3"/> <Binding ElementName="textBox4"/> </MultiBinding> </Button.IsEnabled> </Button> 我的多值转换器是这样的: class ValidityConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { bool b = true; foreach (var x in values) { TextBox y = x as TextBox; if (Validation.GetHasError(y)) { b = false; break; } } return b; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } 我注意到这只在开始时有效。当用户修改其中一个文本框时,它不会。我的值转换器是否需要实施 INotifyPropertyChange?在 WPF 中做这样的事情的正确解决方案是什么?感谢您的帮助。 编辑 我已经做过这样的事情并且它正在工作: <Button Click="Button_Click" > <Button.Style> <Style TargetType="Button"> <Setter Property="IsEnabled" Value="False"/> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding Path=(Validation.HasError), ElementName=textBox}" Value="False"/> <Condition Binding="{Binding Path=(Validation.HasError), ElementName=textBox1}" Value="False"/> <Condition Binding="{Binding Path=(Validation.HasError), ElementName=textBox2}" Value="False"/> <Condition Binding="{Binding Path=(Validation.HasError), ElementName=textBox3}" Value="False"/> </MultiDataTrigger.Conditions> <Setter Property="IsEnabled" Value="True"/> </MultiDataTrigger> </Style.Triggers> </Style> </Button.Style> </Button> 我所做的是使用您的 MultiTrigger 解决方案,但在我的情况下,我希望仅当 3 个文本框的长度为零时才激活按钮,因此我的解决方案适用于以下代码.. <Button.Style> <Style TargetType="Button"> <Setter Property="IsEnabled" Value="True"/> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding Path=Text.Length, ElementName=activationKeyTextbox}" Value="0"/> </MultiDataTrigger.Conditions> <Setter Property="IsEnabled" Value="False"/> </MultiDataTrigger> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding Path=Text.Length, ElementName=serialDayStartbox}" Value="0"/> </MultiDataTrigger.Conditions> <Setter Property="IsEnabled" Value="False"/> </MultiDataTrigger> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding Path=Text.Length, ElementName=serialNumdaysbox}" Value="0"/> </MultiDataTrigger.Conditions> <Setter Property="IsEnabled" Value="False"/> </MultiDataTrigger> </Style.Triggers> </Style> </Button.Style> 我不会实现 IMultiValueConverter,因为我们在这里没有转换任何东西。 BindingGroup 可以满足您的目的。 使用 MVVM/INotifyPropertyChanged 的同样有效的方法如下:- 将按钮的 IsEnabled 属性绑定到布尔属性(比如 IsValid)。 将所有文本框绑定到不同的属性。 OnPropertyChange 任何这些文本框,调用一个通用函数(比如 Validate()) IsValid 可以根据 Validate() 设置为 true 或 false,这将依次切换(启用/禁用)按钮的状态。 我知道这是旧的,但我有类似的需求,不想编写绑定组和验证...注意这是我的第一个 wpf 应用程序,也是第一次使用 mvvm! <Button Name="AddBtn" Content="Add" Grid.Row="2" Grid.Column="2" Height="30" Width="100" Command="{Binding AddCmd}" CommandParameter="{Binding Pending}" > <Button.IsEnabled> <MultiBinding Converter="{StaticResource multiButtonEnabled}" > <Binding ElementName="tb1" Path="(Validation.Errors)[0]" /> <Binding ElementName="tb2" Path="(Validation.Errors)[0]" /> <Binding ElementName="tb3" Path="(Validation.Errors)[0]" /> </MultiBinding> </Button.IsEnabled> </Button> 转换器看起来像这样 [ValueConversion(typeof(ValidationError), typeof(bool))] class TxtBoxMultiEnableConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { int i=0; foreach (var item in values) { if (item as ValidationError != null) { i++; } } if (i!=0) { return false; } return true; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) { throw new NotSupportedException(); } } 我正在使用 IDataErrorInfo 来捕获模型中的错误,并绑定到一个双精度数。 WPF 很好,在绑定时会为您抛出解析错误,但它们并没有真正为您提供挂钩它们以更改显示给用户的消息或为您提供一个属性来检查是否有错误标记的方法很烦人,但这使您可以捕获解析中的错误,而不必检查验证规则中的解析错误。我敢肯定我的无知正在表现出来,但我们都必须从某个地方开始! 正如迈克所说,文本框没有改变。 您可能应该绑定 textbox.Text 属性。 在你的例子中: <Button Content="Action" Click="Action_Click" > <Button.IsEnabled> <MultiBinding Converter="{StaticResource ValCon}"> <Binding ElementName="textBox1" Path="Text"/> <Binding ElementName="textBox2" Path="Text" /> <Binding ElementName="textBox3" Path="Text"/> <Binding ElementName="textBox4" Path="Text"/> </MultiBinding> </Button.IsEnabled> </Button> 免责声明 这是我的第一个 StackOverflow 答案,所以它可能不准确或需要调整以遵循 StackOverflow 协议。 至于这条评论:https://stackoverflow.com/a/23504690/14654255(无法直接评论) 我已经尝试使用这个建议;但是,没有另一种机制来手动更新 MultiBinding 是不够的。 我的建议是: FormConverter.cs: using System; using System.Globalization; using System.Windows; using System.Windows.Controls; using System.Windows.Data; namespace WpfApp.Converters { /// <summary> /// This class will be used to determine whether the form submission button should be enabled /// </summary> [ValueConversion(typeof(Control), typeof(bool))] public class FormConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { foreach (Control control in values) { //Relevant inside the scope of the current iteration only string text = null; //Any validation error if (Validation.GetHasError(control)) return false; //No value selected if (control is DatePicker datePicker) if (datePicker.SelectedDate == DateTime.Today) return false; else continue; if (control is ComboBox comboBox) if (comboBox.SelectedIndex == -1) return false; else continue; //Left blank if (control is TextBox textBox) text = textBox.Text; else if (control is PasswordBox passwordBox) text = passwordBox.Password; if (text != null && text.Length == 0) return false; } return true; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { throw new NotSupportedException(); } } } MainWindow.xaml.cs: using System.Windows; using System.Windows.Controls; using System.Windows.Data; namespace WpfApp { class MainWindow : Window { private MultiBindingExpression buttonBinding = null; public MainWindow() { InitializeComponent(); buttonBinding = BindingOperations.GetMultiBindingExpression(button, button.IsEnabledProperty); } private void UpdateButton(object sender, RoutedEventArgs e) { if (registerButtonBinding == null) return; buttonBinding.UpdateTarget(); } } } MainWindow.xaml: <Window x:Class="WpfApp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:converters="clr-namespace:WpfApp.Converters"> <Window.Resources> <converters:formConverter x:Key="formConverter"/> </Window.Resources> <StackPanel HorizontalAlignment="Center"> <TextBlock Text="First name"/> <TextBox x:Name="firstNameTextBox"/> <Button x:Name="button"> <Button.IsEnabled> <MultiBinding Converter="{StaticResource formConverter}"> <Binding ElementName="firstName"/> </MultiBinding> </Button.IsEnabled> </Button> </StackPanel> </Window> 来源: https://stackoverflow.com/a/23504690/14654255 https://stackoverflow.com/a/19356651/14654255 https://stackoverflow.com/a/5676257/14654255

回答 5 投票 0

在不移动其他元素的情况下将选择按钮添加到 HTML

我创建了一个包含多个按钮的 HTML 文档。我已将这些按钮添加到名为“buttons”的 DIV id 中。我现在想向 HTML 页面添加一个排序按钮。这个排序按钮...

回答 2 投票 0

设置按钮在不同班级可见

所以我有 5 个按钮可以将可见性设置为 false。但是我不能在设计师的课堂上做,我需要在这个课堂上做。我不确定我是否应该通过按钮或者是否有一个更好的......

回答 2 投票 0

在 flutter 中重置 Slide_to_act 小部件的状态

当我滑动我的 slide_to_act 小部件时我遇到了一个问题它工作正常并将我推送到另一个页面。但是当我使用 nav.pop 时(当我返回旧页面时)我的 slide_to_act 按钮看起来完成了。我...

回答 2 投票 0

Python - 我的 tkinter 按钮看起来总是被按下

非常愚蠢的问题,但在我的 Python 2.7 程序(完美运行)中,每当我点击它们时,我的 tkinter GUI 的按钮总是占据它们的图形推送位置。这是一个已知问题吗?...

回答 1 投票 0

点击状态变量为字符串更改按钮的图像?

我们可以在按钮的帮助下使用状态变量作为布尔值来更改图像。但是我们如何使用字符串变量来实现呢? 例如: 如果状态变量是布尔值:- 图片(系统名称:s ...

回答 1 投票 0

禁用提交按钮或数据验证

我是创建脚本的新手,或者说使用脚本的知识为 0。我能够设法创建一个数据库,一个简单的清单,使用 google 表格和来自您网站示例的 appscript。曾经...

回答 0 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.