BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 02-17-2010, 06:53 AM   #1 (permalink)
New Member
 
Join Date: Feb 2010
Model: None
PIN: N/A
Carrier: None
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Sizing manager to its container

Please Login to Remove!

Suppose I do the following:

Create a MainScreen
Create a VerticalFieldManager (TableManager)
Create a Field (Table)
Add Table to TableManager
Add TableManager to MainScreen

Now suppose that I want Field to use the available height of its manager, and the manager to use the available height of the screen.

However I also want to be able use TableManager in other managers, for example:

Create a MainScreen
Create a VercialFieldManager (TabContent)
Create a VerticalFieldManager (TableManager)
Create a Field (Table)
Add Table to TableManager
Add TableManager to TabContent
Add TabContent to Screen

In this case, TabContent is about 80% the height of the screen.

I want TableManager to be able to size itself to use the height of the container in both situations.

What is best practice when trying to size a field/manager to the space available in its containing manager?

Last edited by Oz_Work : 02-17-2010 at 06:54 AM.
Offline  
Old 02-17-2010, 07:57 AM   #2 (permalink)
New Member
 
Join Date: Feb 2010
Model: None
PIN: N/A
Carrier: None
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

One issue I am having trying to figure this out is how to code getPreferredHeight() for the TableManager

Code:
public int getPreferredHeight() {
	return getManager().getPreferredHeight();
}
That works ok when the container is TabContent because TabContent knows what size it wants to be and returns it. However when the container is MainScreen it fails with a stack overflow.

I could do this

Code:
public int getPreferredHeight() {
	int height = getManager().getHeight();
	if (height == 0) height = getManager().getPreferredHeight();
}
and that works, if I create and push the screen before I add TableManager.

It doesnt feel like the right solution, because it will stack overflow again if the manager is added before the screen is pushed.

Last edited by Oz_Work : 02-17-2010 at 07:58 AM.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Lighting Ceiling Fans PES 4 Lamps Electronic Fluorescent Ballast, 120V,
$30.28
Lighting Ceiling Fans PES 4 Lamps Electronic Fluorescent Ballast, 120V, pictureLumapro 175 watt metal halide core/coil ballast kit
$45.0
Lumapro 175 watt metal halide core/coil ballast kit pictureSylvania Quicktronic QTP2x32T8/UNV electronic ballast lot of 2
$16.0
Sylvania Quicktronic QTP2x32T8/UNV electronic ballast lot of 2 pictureAdvance core/coil ballast kit HID 400w M59 71A6041001D
$79.0
Advance core/coil ballast kit HID 400w M59 71A6041001D pictureRobertson HP1527P Ballast Transformer 277V
$19.0
Robertson HP1527P Ballast Transformer 277V picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.