04-24-2012 11:09 PM
CustomButtons do not seem to take the .USE_ALL commands like the buttonfield, is there a way to incorporate this feature into the custombutton? If not I'd need to get the available width for the button, what might be the best way to go about doing this?
04-25-2012 04:56 AM
My experience is that the CustomButtons from these samples do USE-ALL_WIDTH. So perhaps use one of these buttons or look at the code to see how to do it?
04-25-2012 08:06 AM
final ButtonField Option2 = new ButtonField("Inactive",
ButtonField.USE_ALL_WIDTH)
A custombuttonfield does nto allow you to include a use all width like this when created. It returns that a long is not present in the constructor. I'll just use a different way
04-25-2012 08:12 AM
Not sure I understand what you are saying.
You are right that the standard RIM ButtonField does not use or respect USE_ALL_WIDTH.
But the CustomButtonField supplied in the sample code I pointed you at, does respect USE_ALL_WIDTH. So if you used that Field instead of the standard ButtonField, you could achieve what you are trying to do.
If you want to do it with a standard RIM ButtonField, than I think you are out of luck.
04-25-2012 08:24 AM
Thanks peter, I'll show you a little better, I'm just trying to do this:
CustomButtonField Option1 = new CustomButtonField("Off", 0xFFFFFF,
0xFFFFFF, CustomButtonField.USE_ALL_WIDTH)
but it gets an error, saying that the long USE_ALL_WIDTH is not in the constructor CustomButtonField(string, int, int)
whereas a buttonfield will let me do this:
ButtonField Option2 = new ButtonField("Inactive",
ButtonField.USE_ALL_WIDTH)
and this is acceptable. I was just wondering why this is and how to go about an alternative. Thanks for your info though, I appreciated the link and your time.
04-25-2012 09:10 AM - edited 04-25-2012 09:11 AM
If it is your custom button field then you need to place a input value for the long to be accepted. The error you are getting is telling you the issue. Your constructor is expecting a string and two ints but you are passing a string two ints and a long. You need to make a new constructor that will accept the values you are trying to pass to it.
ie.
public class CustomButtonField {
public CustomButtonField(String txt, int width, int height, long style){
..........
}
............
}