I have the following labelfield that I want to be clickable and also catch/handle its focus/unfocus events.
titleField = new LabelField(title,FOCUSABLE|USE_ALL_WIDTH){
public void paint(Graphics graphics)
{
graphics.setColor(Color.BLUE);
graphics.drawText(_title, 30,0);
super.paint(graphics);
}
protected boolean navigationClick(int status,int time)
{
if(panel != null) panel.takeAction();
return true;
}
protected void onFocus(int dir)
{
super.onFocus(dir);
panel.setSelectedIndex(_index);
}
protected void onUnfocus()
{
if(!_collapse){
_prevIndex = _index;
panel.setPreviousSelectedIndex(_prevIndex);
}
}
};
So far, the code works as expected on my os5 simulators, but on os6/7 simulators, the labelfields just appear blank (I even tried removing the super.paint(graphics); call but still got the same results). Any ideas what's happening? Thanks
i figured it out... actually in my layout (horizontal) i have a checkboxfield then a labelfield.. for some strange reason the checkboxfield is taking up all the horizontal space on os6/7 simulators even though i did not specify USE_ALL_WIDTH. By overriding layout and specifying the dimensions for the checkboxfield, the layout's behaving properly now. Thanks for the tips :)