基本上我想在代码中模拟用户点击windows按钮.我知道有SendKeys允许我将按键发送到Windows,如果我得到它们的句柄,但我无法弄清楚我需要处理以发送Windows按钮命令.例如Windows按钮+ L.稍微读了一下,看来CTRL-ESC也应该弹出开始菜单,但不知道如何告诉它将密钥发送到Windows(如果这是可能的话).任何帮助将非常感激.
干杯!
我有一些radiobuttons但是toucharea是小的.toucharea取决于图像大小.有没有一种优雅的方法来扩展触摸区域与cocos2d而不使用更大的图像或使用cgrect我自己的触摸区域?setContentSize做我想要的.不幸的是,图像移动到内容大小的左下角.设置anchorpoint会移动内容,但图像会保留在左下角.
CCMenuItem* pickEasy = [CCMenuItemImage itemFromNormalImage:@"radiobutton_off.png" selectedImage:@"radiobutton_on.png" target:self selector:@selector(pickEasyTapped:)];
pickEasy.position = ccp(ss.width * 0.40, ss.height * 0.78);
[pickEasy setContentSize:CGSizeMake(50, 50)];
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我只是在学习Python而且我已经掌握了基本概念,并且已经有一些命令行程序.我现在正在学习如何使用Tkinter创建GUI.
我创建了一个简单的GUI来接受来自Entry窗口小部件的一些用户信息,然后,当用户单击提交时,它应该弹出一个对话框.
对话框应询问名字和姓氏.
问题是当用户点击提交时我不知道如何处理事件.
这是我的代码:
from Tkinter import *
class GUI(Frame):
def __init__(self,master=None):
Frame.__init__(self, master)
self.grid()
self.fnameLabel = Label(master, text="First Name")
self.fnameLabel.grid()
self.fnameEntry = Entry(master)
self.fnameEntry.grid()
self.lnameLabel = Label(master, text="Last Name")
self.lnameLabel.grid()
self.lnameEntry = Entry(master)
self.lnameEntry.grid()
self.submitButton = Button(self.buttonClick, text="Submit")
self.submitButton.grid()
def buttonClick(self, event):
""" handle button click event and output text from entry area"""
pass
if __name__ == "__main__":
guiFrame = GUI()
guiFrame.mainloop()
Run Code Online (Sandbox Code Playgroud) 我正在尝试模拟TButton的下拉菜单,如下所示:
procedure DropMenuDown(Control: TControl; PopupMenu: TPopupMenu);
var
APoint: TPoint;
begin
APoint := Control.ClientToScreen(Point(0, Control.ClientHeight));
PopupMenu.Popup(APoint.X, APoint.Y);
end;
procedure TForm1.Button1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
begin
DropMenuDown(Button1, PopupMenu1);
// ReleaseCapture;
end;
end;
Run Code Online (Sandbox Code Playgroud)
问题是,当菜单被删除时,如果我再次单击该按钮,我希望菜单关闭,但它会再次下降.
我正在寻找专门针对通用Delphi TButton而非任何第三方等效的解决方案.
我找到了很多例子来说明进度条和轮子的使用情况; 我只能找到一个javascript示例来显示省略号(点 - 点)来引用进度,因此我想问这个问题.我的应用程序不是很复杂 - 它只有几个复选框和一个按钮.最近我的团队要求进行改进,并希望保持简单.
在配置所需设置后,用户单击了一个名为"GO"的按钮.它背后的代码也非常简单 - 它在click事件后禁用按钮并调用一个独立的exe使用ProcessStartInfo它执行三个动作'reconcle','post'和'publish'.我使用该WaitForExist()方法重新启用按钮.
我的团队要求我在按钮上显示"当前进程".他们只是希望按钮文本显示Reconciling.调和......调和......(定期说,1秒),然后以类似的方式发布和发布.
知道实现这一目标的最合适方式会很高兴.提前致谢.
我正在开发一个带有自定义弹出警报的iPhone应用程序.在设计中,这些警报都有"取消"按钮,但由于在这些情况下无法取消,我想将它们更改为"正常"按钮.
我的问题是:关于这些按钮标签的Apple指南是什么?应该是"Okay"(这是我个人的偏好),还是应该是"OK"(我不喜欢它,因为它看起来像青少年文字说话或俄克拉荷马州的缩写).
我找到了关于将按钮的边框设置为透明的主题.这工作正常,但我想将此用于按钮背景而不是边框.
链接中的解决方案我已经放入<Window.Resources>...</Window.Resources>:
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="Green"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
Run Code Online (Sandbox Code Playgroud)
来源:如何在WPF中更改Button MouseOver的背景?
如何编辑这段代码,以便我可以使用它来将我的按钮的背景设置为透明而不是它的边框?
我在OS X上显示一个本地NSUserNotification,代码如下:
NSUserNotification *notification = [[NSUserNotification alloc] init];
[notification setTitle:@"Some Title"];
[notification setHasActionButton:YES];
[notification setActionButtonTitle:@"Snooze"];
NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter];
[center setDelegate:self];
[center scheduleNotification:notification];
Run Code Online (Sandbox Code Playgroud)
我面临的问题是,如果单击通知本身或"操作按钮",我只会收到一条消息,但如果单击"其他"按钮(关闭按钮),我还想执行一些代码.如果NSUserNotification被解除或点击关闭按钮,有没有办法得到通知?userNotificationCenter:didActivateNotification:单击关闭按钮时不会触发NSUserNotificationCenter .
如果这是不可能的,有没有办法在其Reminder应用程序中创建Apple使用的下拉按钮(如果用户持有操作按钮,则会打开一个菜单).
谢谢!
cocoa notifications button nsusernotification nsusernotificationcenter
我了解到在Qt中我们确实有一些方法来制作QpushButton:
我期待在Kivy中使Buttons行为类似.可能吗 ?我了解到我们可以将背景图像更改为具有圆角形状的图像 更改Kivy中按钮的背景颜色
但这并不令人满意,因为按钮看起来仍然很正常.没有阴影效果.即使我们点击按钮外的角落,如果单击按钮,也会对其进行处理.
我已经阅读了Kivy Button以及Label的文档,并尝试更改按钮的行为和外观.有人可以建议如何使按钮看起来更好我们可以尝试:
下面是我刚刚为了探索Kivy中的按钮而创建的代码:
__author__ = 'pbatra'
#Good info about background
#https://stackoverflow.com/questions/20181250/changing-the-background-color-of-a-button- in-kivy/20181407#20181407
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.properties import ObjectProperty
from kivy.uix.image import Image
from kivy.graphics import Color
gui = '''
<MenuScreen>:
canvas.before:
BorderImage:
# BorderImage behaves like the CSS BorderImage
border: 10, 10, 10, 10
texture: self.background_image.texture
pos: self.pos
size: self.size
GridLayout:
size_hint: .1, .1
pos_hint: {'center_x': .5, …Run Code Online (Sandbox Code Playgroud) 我目前正在尝试使用scala对扫雷进行编码,但我无法找到右键单击按钮的方法.
我已经在互联网上搜索了它的方法,但我肯定无法找到它.
如果有人能帮助我,我会非常感激:)
谢谢,
Schnipp
(注意:Scala对我来说是一种新语言,我不是Java用户,所以如果我的问题听起来很笨,我很抱歉)
编辑:
我试图找到(或实现)一个功能'ButtonClickedRight',可以听到右键单击按钮.
像这样
import scala.swing._
import scala._
import scala.swing.event._
object Right extends MainFrame with App {
title = ""
visible = true
val b = new button("")
listenTo(b)
reactions += {
case ButtonClicked(`b`) => *code*
case ButtonClickedRight(`b`) => *code*
}
}
Run Code Online (Sandbox Code Playgroud)
编辑2 -
我想知道用户是否点击了按钮"1".我遇到的问题是,当我点击标签而不是按钮时,此代码会打印"鼠标点击"+ e.point +"type"+ e.modifiers.
object App extends SimpleSwingApplication {
lazy val ui = new GridPanel(2,1) {
contents += new Button("1")
contents += new Label("2")
listenTo(mouse.clicks)
reactions += {
case e: MouseClicked …Run Code Online (Sandbox Code Playgroud)