Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 100
Registered: ‎06-21-2010
My Device: Not Specified

GUI Buttons

Hi all,

 

I just want to have 3 big buttons to fill up the screen.

 

How do i do this?

 

I currently have three buttons, but they are way too small and are clugged up together at the centre of the screen. I want them to be big, covering the width and height of the screen like so

 

-----------------------------------------------------

|                            Titile                                 |

|----------------------------------------------------|

|                                                                     |

|                                                                     |

|                     Button 1                                 |

|                                                                     |

|--------------------------------------------------- |

|                                                                     |

|                                                                     |

|                     Button2                                  |

|                                                                     |

|--------------------------------------------------- |

|                                                                     |

|                     Button 3                                 |

|                                                                     |             

|                                                                     |

-----------------------------------------------------

 

I have been messing around with styles but it doesnt seem to change the slightlest look of the buttons which is a bit frustrating.

 

Also if i could add gradients and pictures in the buttons that would be nice. could anyone kindly show me how to do this. Or point towards the direction of any resource related to this?

 

Thanks

 

Dan

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: GUI Buttons

Best thing I find is to do random searches on the forum to find stuff like this.

 

in this case, "image button" might be a good term for you to start with.

 

Good luck.

Developer
Posts: 146
Registered: ‎07-24-2008
My Device: none
My Carrier: none

Re: GUI Buttons

Hi

Create a class which overrides ButtonField. Override the folowing methods.

 

Here yourwidth and yourheight  needs to be passed externally.



        public int getPreferredWidth() {
                return yourWidth;
        }

        public int getPreferredHeight() {
              
                return yourheight;
        }

 

 public void layout(int width, int height) {
                setExtent(getPreferredWidth(), getPreferredHeight());
        }

 

it will fix the issue.

 

Let me know if you face any problem.

please mark posts as solved if you found a solution.

Thanks

Ankit

 

 

 

Thanks & Regards,
Ankit Dubey
Module Lead Software Engineer, mLabs
Impetus InfoTech (India) Pvt. Ltd.
Developer
Posts: 100
Registered: ‎06-21-2010
My Device: Not Specified

Re: GUI Buttons

Thanks Peter,

 

I am a little bit sceptical about using the search. Most of my searches although sounding very well-used, almost always fail to produce meaningfull results.

 

But i will try on your recommendation.

 

One thing though, whats the difference between Board Search, Community Search, Knowleadge Base and Users?

 

Why cant it just search All for any meaningfull information?

 

Thanks

Developer
Posts: 109
Registered: ‎03-13-2010
My Device: BlackBerry 8520 Curve Smartphone
My Carrier: -

Re: GUI Buttons

Hi dan,

 

Even you can design your buttons using CustomItems. I hope it will work best for you.

 

Regards

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: GUI Buttons

Board Search is just this forum,

 

Knowledge Base is just the KB

 

Community is all the forums I think

 

Users you should only use when searching fro other users.

 

Most of the time you will want Board, you will probably find useful references to the KB in many Board posts. 

Developer
Posts: 100
Registered: ‎06-21-2010
My Device: Not Specified

Re: GUI Buttons

Thank you Ankit!

 

 You have solved a huge chunk of my problems.

 

would you happen to know how to set the button colour, gradient, onclick property or anything of the sort.

 

I just dont want it looking like the default standard button.

 

Thanks

Developer
Posts: 100
Registered: ‎06-21-2010
My Device: Not Specified

Re: GUI Buttons

HI nikhil,

 

Can you post a link to a usefull example of GUI using CustomItems?

 

Thanks

 

Dan

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: GUI Buttons

I suspect you will like this:

http://naviinaengine.appspot.com/home/code/iphone_style_field_for_blackberry/

 

Other code available if you wonder around.

Developer
Posts: 109
Registered: ‎03-13-2010
My Device: BlackBerry 8520 Curve Smartphone
My Carrier: -

Re: GUI Buttons

Hi,

 

Following links have goood explaination on CustomItems

 

Using Custom Items in MIDP 2.0

Custom GUI development with MIDP 2.0

 

Regards