Custom Radio Buttons
Can anyone please tell me if we can customize a radio button. I need two thigns to be done in here
1. Change the radio button image. The color of the circle when selected.
2. Display the radio button from right to left. I need radio buttons to be displayed on right side with text on the left.
Thanks in advance!!!
You will have to create your own field or extend the existing RadioFieldButton and override it's layout and paint functions.
Maybe this article helps you to start:
How To - Create custom fields
Thanks for ur reply...thats what I have been trying to achieve here..but the problem that I am facing is ..i have customized all the elements like, layout, labels, buttons everything...but when i try the same for the radio buttons...i get the error...do u have any idea about how we can do it???
Hope to hear from you soon
Never tried to extend the RadioFieldButton, but it should work if you do all the painting by yourself without calling paint() of the super class.
Do you have some code for us?
I can give the code for buttons, field managers etc. but not for radio button...not able to create one :(
You mentioned that you get en error, which is it?
Ohh...m sorry that was about tryin to align the radio button to right side and put a lebel field with the text on the left side...I was thinking about a custom layout with fixed height and varying height to put the labelfield with the text and put the radio button on the right side. The problem here I faced was that the setExtent() method require both height and width and I only want width to be fixed to the 80% of the screen and height should depend on the content.
If i dont use setExtend, then it uses the whole screen...That was the issue....
Either we get the radio button customized or else we can manage the fieldmanager to have fixed width and varying height...any of them will work...
can you post the code for the manager?
Here it is...all we have to do is to provide the height and width of the vertical manager...
import net.rim.device.api.ui.container.VerticalFieldManag er;
public class CustomVerticalLayout extends VerticalFieldManager
int Width = 318;
int h= 120;
protected void sublayout(int maxWidth, int maxHeight)
setExtent(Width, h);//This is where i want only the width but not the height...
public int getPreferredWidth()
public int getPreferredHeight()
The height should remain incremental...which m not able to do right now...
It is still difficult for me to understand what you are trying to achieve. If your manager should be scrollable, it needs a fixed size on the visible screen.
Can you give more information about the behaviour of your user interface?
to calculate the height of your manager depending on the fields in it you can try this:
OK..lets take it this way....I want half of the screen width to be used to display a label with multiple lines of text i.e. to accomodate the content the height should be increased but width should remain teh same, Now the point here is the custom layout can have a fixed width and height. But I dont know how many lines the text will occupy and hence cannot provide the height.
this should work.
Also take a look at the TextBox field from the developer journal:
BlackBerry - BlackBerry | Wireless Handheld Devices, Software & Services from Research In Motion (RIM)
YOU ROCK MY FRIEND......this took the toll on me...you just got it right..i used my already existing custom text field for the content and it did exactly what I wanted to do. Now i ll do the same using labelfield.
I ll bother you again should i face any trouble......;-)
Thanks a million for ur help!!!!!!!!(y)
|All times are GMT -5. The time now is 01:11 AM.|
Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.