简体   繁体   English

使用GQuery向小部件分配ID

[英]Assigning ID to a widget using GQuery

I need to wrap a widget with an ID, so I used GQuery to do that, like so: 我需要用ID包装一个小部件,因此我使用GQuery来做到这一点,就像这样:

GQuery g = $(signupButton);
g.id("signupButton");

Now I need to get the instance of the actual Button or Widget using the GQuery object, is that possible? 现在,我需要使用GQuery对象获取实际的Button或Widget的实例,这可能吗?

Will the g.get(0) return the wrapped instance of that Button/Widget? g.get(0)返回该Button / Widget的包装实例?

use the widget() method 使用widget()方法

Button b = g.widget();

//later if you want to query your button via its id
Button b = $("#signupButton").widget()

Julien 朱利安

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM