Glist中用的问题

chatlist.itemProvider = GetItemProvider;
chatlist.itemRenderer = RenderItem;

protected string GetItemProvider (int index) {
Message msg = _messages[index];
if (msg.fromMe)
return "ui://ChatWhat/ChatRight";
else
return "ui://ChatWhat/ChatRight";
}

void RenderItem (int index,GObject obj) {
GButton item = obj.asButton;
Message msg = _messages[index];
if (!msg.fromMe)
item.GetChild ("name").text = msg.sender;
item.icon = UIPackage.GetItemURL ("ChatWhat", msg.senderIcon);

//Recaculate the text width
GRichTextField tf = item.GetChild ("msg").asRichTextField;
tf.emojies = _emojies;
tf.width = tf.initWidth;
tf.text = ChatWhatMgr.inst.Parse (msg.msg);
tf.width = tf.textWidth;
}
运行的时候RenderItem方法中获取到的item这个GButton是空的
已邀请:

谷主

赞同来自:

那就asButton返回空呗,自己想想,不要问别人。

要回复问题请先登录注册