我创建了一个新的自定义按钮,我可以设置不同的背景图像而不是"圆圈"或"三角形"吗?
谢谢Chanan
exporting: {
enabled: true,
buttons: {
'realTimeButton': {
id: 'realTimeButton',
symbol: 'diamond',
x: -88,
symbolFill: realTimeColor,
hoverSymbolFill: realTimeColor,
_titleKey: "realTimeButtonTitle",
onclick: function(event) {
// handle change to real time
if ( enable_lastRoundsChart_realtime )
{
// disable real time flag
enable_lastRoundsChart_realtime = 0;
// re-create detail in real time mode disabled
createDetail(cache_last_rounds.last_rounds_data, window.show_top_round_ids);
// enable plotBand
if ( pb_master_chart )
{
pb_master_chart.options.chart.events.selection.enabled = 'true';
pb_master_chart.options.chart.zoomType = 'x';
}
}
else
{
// enable real time flag
enable_lastRoundsChart_realtime = 1; …Run Code Online (Sandbox Code Playgroud) 我有这种情况:
<somebutton></somebutton>
Run Code Online (Sandbox Code Playgroud)
...
app.directive("somebutton", function(){
return {
restrict: "E",
scope: {
// not sure what i can do here
},
template: '<button ng-click="loadTemplate()" type="button">Text</button>',
link: function(scope, element){
scope.loadTemplate = function(){
//TODO: append "home.html" template inside body directive
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
...
<script type="text/ng-template" id="home.html">
<div>home</div>
</script>
Run Code Online (Sandbox Code Playgroud)
...
<div body ></div>
Run Code Online (Sandbox Code Playgroud)
执行此操作的其他方法可能是使用html中的按钮而不是模板
<button ng-click="loadTemplate()" type="button">Text</button>
Run Code Online (Sandbox Code Playgroud)
然后可能有一个控制器,其中包含loadTemplate()加载模板的方法
但我不知道如何做到这一点.
混乱?是的:)
有关这个问题的任何想法?
谢谢
嘿家伙,我有一个问题!你能告诉我是否以及如何在同一个按钮上设置一个android:onClick方法和一个OnTouchListener?我真的需要这个我的应用程序.
我知道它们的不同之处并且只使用android:onClick或OnTouchListener确实有效.一旦我尝试两者,只需OnTouchListener工作.
我需要这个用于不同布局的不同功能..
谢谢你的帮助
只是为了更好地理解.使用android:onClick我的意思是你在xml文件中分配这个按钮的方法,比如android:onClick ="InitMethod"
我一直在努力实现这个半透明按钮,但我总是做不到.我已经提到了许多像这样的人.但仍然没有运气.我也尝试android:color="#66FF0000"过,但它不会让它变得半透明.以下是我的代码.
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:text="select"
android:onClick="selectClick"
android:color="#80000000"
/>
Run Code Online (Sandbox Code Playgroud)
我想要这种半透明的矩形按钮,以便按钮的蓝色应该是可见的,活动的绿色也应该是可见的.有人可以建议我吗?在下图中,我无法在按钮上绘制绿色以显示我想要的内容.但我想我的上述解释是可以理解的.
或者,如果无法使蓝色可见,至少我希望它看起来像让用户感觉有一个按钮,绿色应该是可见的.
我正在尝试创建一个上移按钮和一个下移按钮,以移动Microsoft Visual Studio 2012中ListBox中的选定项目.我已经看到了WDF,jquery,winforms和其他一些形式的其他示例但我还没有看过Microsoft Visual Studio的例子.
我尝试过这样的事情:
listBox1.AddItem(listBox1.Text, listBox1.ListIndex - 1);
Run Code Online (Sandbox Code Playgroud)
但Microsoft Visual Studio在其ListBox中没有"AddItem"属性.
有关更多信息,我有两个列表框,我想让我的上下移动按钮工作; SelectedPlayersListBox和AvailablePlayersListBox.有人会非常友好地向我提供Microsoft Visual Studio中"上移"和"下移"按钮的示例吗?谢谢.
我有一个简单的应用程序,我执行以下操作:
public void onClick(View v){
switch(v.getId()) {
case R.id.buttonup:
onButtonUp();
break;
case R.id.buttondown:
onButtonDown();
break;
}
}
public boolean dispatchKeyEvent(KeyEvent event){
int keyCode = event.getKeyCode();
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_UP:
onButtonUp();
return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
onButtonDown();
return true;
default:
return super.dispatchKeyEvent(event);
}
}
void onButtonUp(){
increment_some_static_class_variable;
}
void onButtonUp(){
decrement_some_static_class_variable;
}
Run Code Online (Sandbox Code Playgroud)
问题是,每当我按下音量按钮时,onButtonUp和onButtondown函数都会被调用两次.当我按下屏幕按钮(在onClick(View)中处理)时,不会发生这种情况.我没有找到任何人有这个问题,所以我问这里的人.我是Android新手,这是我的第一个应用程序.使用Log,我发现对onButtonUp和onButtonDown的调用都来自dispatchKeyEvent函数.这可能有什么问题?我希望我能很好地解释这个问题.建议/解决方案是最受欢迎的.
我一直在尝试添加图像,以便我的按钮位于图像的顶部,但只能使图像完全覆盖所有内容,或者强制图像位于按钮覆盖的水平部分下方.
以下是相关代码:
class MainMenu(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.master = master
self.initUI()
def initUI(self):
self.master.title("Adventure")
bg = PhotoImage(file="Background-gif.gif")
newGameButton = Button(self, text="New Game", height=2, width=20, command=self.newGame)
newGameButton.pack(side=TOP, pady=50)
loadGameButton = Button(self, text="Load Game", height=2, width=20, command=self.loadGame)
loadGameButton.pack(side=TOP)
quitButton = Button(self, text="Quit", height=2, width=20, command=self.close)
quitButton.pack(side=TOP, pady=50)
label = Label(self, image=bg)
label.image = bg
label.pack(fill=BOTH, expand=1)
self.pack()
Run Code Online (Sandbox Code Playgroud)
非常感谢.
使用标签作为按钮我遇到了一些挑战.我有一个标签定义为UILabel,并在我的.h文件中声明了字符串变量:
IBOutlet UILabel *l1;
@property(strong)NSString *myvariable;
Run Code Online (Sandbox Code Playgroud)
在xib中,选中标签后,在Identity Inspector视图的Document下,将设置带有所需标签名称的Label字段 - 例如:l1.我在标签中也有一些静态文本.
在文件的所有者连接检查器中,我将l1插座连接到l1标签.
我的目标:当触摸标签时,我想简单地为字符串变量分配一个文本值,例如可能在.m文件中执行的操作:
self.myvariable = l1.text;
Run Code Online (Sandbox Code Playgroud)
我尝试失败的事情: - 在我的.h中设置UIButton, - 尝试在.m中设置UIButton - 在XIB Identity Inspector视图中,在Accessibility下,尝试选中按钮Traits复选框以启用标签为一个按钮
我还没弄明白.这可能是一个简单的标签问题,我对标签的大多数经验都包括静态文本显示,或使用纪元时间显示基于当前日期的倒计时.任何指导将不胜感激!
提前致谢!抢
我在我的C#中有一个组合框,其名称frmMain 是以button1_Click我的设置形式中添加(使用按钮)产品命名的自动填充frmSettings.当我点击button1_Click我要重新加载的按钮时,frmMain将会显示新添加的产品.
我试过用
frmMain main = new frmMain();
main.Close();
main.Show();
Run Code Online (Sandbox Code Playgroud)
我知道这段代码很有趣,但它不起作用.:d
这是Windows窗体!
编辑
请参阅我的程序图片以便更好地理解.这是我的frmMain

这是我的设置frmSettings形式的样子.因此,正如您所看到的,当我单击提交按钮时,我想要frmMain重新加载,以便我添加到设置的更新值对frmMaincomboBox 可见.

当我单击由for循环创建的每个按钮时,我正在尝试打印出按钮编号.以下是我的尝试.
import Tkinter as tk
root=tk.Tk()
def myfunction(a):
print a
for i in range(10):
tk.Button(root,text='button'+str(i),command=lambda:myfunction(i)).place(x=10,y=(10+(25*i)))
root.mainloop()
Run Code Online (Sandbox Code Playgroud)
但不是打印出每个按钮编号,而是每次都给我最后一个按钮编号.有什么我可以这样做,当我点击按钮1,它将打印1,2为2,依此类推?