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
Regular Contributor
prash_bb_dev
Posts: 68
Registered: ‎03-17-2010
My Device: 9000,9500,8900
My Carrier: Airtel,Vodafone
Accepted Solution

Ui Related Problem: Can not add Buttons in status

[ Edited ]

Hi,

 

I am developing a screen in which I have to prepare both header and status with controls like Buttons and EditFields. Please have a look at this code

 

 

editField = new EditField();

updateButton = new ButtonField("Update");

cancelButton = new ButtonField("Cancel");


/**
* set up Status manager
*/
VerticalFieldManager statusVerManager = new VerticalFieldManager();
HorizontalFieldManager statusManager = new HorizontalFieldManager();

/**
* Add fields in status manager
*/
statusManager.add(editField);
statusManager.add(updateButton);
statusManager.add(cancelButton);

statusVerManager.add(new SeparatorField());
statusVerManager.add(statusManager);
/**
* Set status as status manager
*/
setStatus(statusVerManager);

 

 

Here I can see my edit field in status but can not see any of the Update and Cancle Buttons.

 

Previously I have tried it with subLayout() for both the manager but could not show buttons.

 

Waiting for your comments on my code. Atleast Help me to figure out what is going wrong.

 

Thanks in advance folks.

Please use plain text.
Developer
Ekansh
Posts: 468
Registered: ‎08-07-2009
My Device: Curve, Bold, Storm
My Carrier: Blackberry Developer

Re: Ui Related Problem: Can not add Buttons in status

Hi,

 

The code sems to be incomplete.

Tell the pseudocode.

 

 

You haven;t added any field nor the editfield nor the buttons.

 

Thanks

Ekansh

----------------------------------------------------------
feel free to press the kudos button on the left side to thank the user that helped you.
please mark posts as solved if you found a solution.
Please use plain text.
Regular Contributor
prash_bb_dev
Posts: 68
Registered: ‎03-17-2010
My Device: 9000,9500,8900
My Carrier: Airtel,Vodafone

Re: Ui Related Problem: Can not add Buttons in status

@ekansh you're right. Edited in my code.

 

Now can you check the code and tell me what's going wrong?

Please use plain text.
Developer
Ekansh
Posts: 468
Registered: ‎08-07-2009
My Device: Curve, Bold, Storm
My Carrier: Blackberry Developer

Re: Ui Related Problem: Can not add Buttons in status

hi,

 

Instead of writing this  setStatus(statusVerManager);


You need to add the statusVerManager.

 

add(statusVerManager)

----------------------------------------------------------
feel free to press the kudos button on the left side to thank the user that helped you.
please mark posts as solved if you found a solution.
Please use plain text.
Regular Contributor
prash_bb_dev
Posts: 68
Registered: ‎03-17-2010
My Device: 9000,9500,8900
My Carrier: Airtel,Vodafone

Re: Ui Related Problem: Can not add Buttons in status

I know it will work.

 

Ok here is the requirement.

 

It is the twitter client in which the Header should and footer(Status) should be static. It must always be there in screen and scrolling should not move its position. And I know setTitle and setStatus methods can easily achieve this task. That's why i use setStatus() method instead of add().

Please use plain text.
Regular Contributor
prash_bb_dev
Posts: 68
Registered: ‎03-17-2010
My Device: 9000,9500,8900
My Carrier: Airtel,Vodafone

Re: Ui Related Problem: Can not add Buttons in status

Hi

 

Solved the problem my self.

 

Here is the summary what I have done.

 

1. removedStatusVerManager. Actually it was used only to put a separator above the status horizontal manager.

 

2. Called sublayout inside the statusManager and bounded its height and width.

 

3. Called setLayOutChild() to make my edit fiedl fixed width and height.

 

(I had followed procedure upto 3 before what i had done new is from step 4)

 

4.  Called setPositionChild() method. Actually when i lay out a child I must set its position and position of all the child that is going to be added in same manager. So also set the position of other SIBLING controls with it.

 

5. Added the controls in manager.

 

passed it in setStatus. And I am able to render the desired screen.

 

Thanks @ekansh for your replys.

 

Please use plain text.
Developer
Ekansh
Posts: 468
Registered: ‎08-07-2009
My Device: Curve, Bold, Storm
My Carrier: Blackberry Developer

Re: Ui Related Problem: Can not add Buttons in status

Cheers!!!   you got the problem solved.

 

 

----------------------------------------------------------
feel free to press the kudos button on the left side to thank the user that helped you.
please mark posts as solved if you found a solution.
Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: Ui Related Problem: Can not add Buttons in status

Hate to post in the solved threads, but you went way overboard while solving your issue (even though it does work).

 

The main problem in your code is your EditField without parameters.  It has DEFAULT_MAXCHARS as the number of characters, which is ... a million!  That's right - the default of million characters.  No wonder it pushes the buttons off the screen!

 

In order to limit the dimensions of your EditField, pass it a limited number of characters and/or override its layout method to set the extent you wish.  The rest will be done by the default BlackBerry managers (this time, your HorizontalFieldManager) automatically.

 

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.