BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 11-01-2009, 10:18 PM   #1
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Default Set Height of VerticalFieldManager

Please Login to Remove!

I need to have an Option Choice Field (drop downlist) above a VerticalFieldManager with another Option Choice Field below that. Because I will eventually need to have an additional field next to the ones I've listed (above and below the VFM), I'm putting them in a HorizontalFieldMaanager.

I want the VFM to scroll and to have both HFM's stay at the top and bottom of the screen.

I extended VFM and overwrote the getPreferredHeight method. But VFM still has a height of 0 (zero).

Code:
class VFN extends VerticalFieldManager{
	VFN(){
		super();
	}
	public int getPreferredWidth() {
	   return Display.getWidth();
	}
	   
	public int getPreferredHeight(){
		return _height;
	}
	public void setHeight(int h){
		_height = h;
	}
	private int _height;
}

class CashBoxApp extends UiApplication{
	public static void main(String[] args){
		CashBoxApp app = new CashBoxApp();
        app.enterEventDispatcher();	
	}
	CashBoxApp(){
		HorizontalFieldManager hfnTop = new HorizontalFieldManager();
		
		//VerticalFieldManager vfn = new VerticalFieldManager();
		VFN vfn= new VFN();
		HorizontalFieldManager hfnBottom = new HorizontalFieldManager();
		final MainScreen TxnListScreen = new MainScreen();

        TxnListScreen.setTitle("Cash Box");
        
        String[] AcctChoices={"Checking Personal","Savings","CC - CapOne"};
        hfnTop.add(new ObjectChoiceField("", AcctChoices,0));
        
     
        String[] BalChoices={"Ending Balance","Current Balance"};
        hfnBottom.add(new ObjectChoiceField("", BalChoices,0));
        
        vfn.setHeight(Display.getHeight()-hfnTop.getHeight()-hfnBottom.getHeight());
        TxnListScreen.add(hfnTop);
        TxnListScreen.add(vfn);
        TxnListScreen.add(hfnBottom);
        pushScreen(TxnListScreen);
	}		
}
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW
Offline  
Old 11-01-2009, 10:43 PM   #2
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

I think this is typical behavior of VFM - it takes the height required to accomodate it's managed field(s).
Offline  
Old 11-01-2009, 11:11 PM   #3
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Default

So how would I accomplish this task then? I want to have an hfm across the top of the screen, another across the bottom and the area between them allow for vertical scroll.
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW
Offline  
Old 11-03-2009, 05:08 PM   #4
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Default

Anyone have any suggestions? I'm getting so frustrated with this--I've done lots of searches and it looks like others are doing what I'm trying to accomplish. But I'm having trouble doing it myself.
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW
Offline  
Old 11-03-2009, 05:22 PM   #5
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

Where are you adding a field to the vertical field manager? I don't understand what you are trying to accomplish, and neither does the system.

A Manager takes the height required to accomodate the fields contained therein. This Manager has no fields, hence no height.
Offline  
Old 11-03-2009, 08:18 PM   #6
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Default

Ok I've made a lot of progress tonight. I found an example that I understood and now I'm able to set the height of the VFM. For anyone looking to do this, once I added the sublayout method shown below it to started working.

But I'm still having trouble figuring out what the required heights are for the HFMs above and below the VFM.

class VFN extends VerticalFieldManager{
VFN(){
super(VERTICAL_SCROLL|VERTICAL_SCROLLBAR|NO_HORIZO NTAL_SCROLL|USE_ALL_WIDTH);
}
protected void sublayout(int width, int height){
super.sublayout(width, getPreferredHeight());
setExtent(width, getPreferredHeight());
}

public int getPreferredWidth() {
return Display.getVerticalResolution();
}
/*
public int getPreferredWidth() {
return Display.getWidth();
}
*/
public int getPreferredHeight(){
return _height;
}
public void setHeight(int h){
_height = h;
}
private int _height;
}
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW
Offline  
Old 11-03-2009, 08:20 PM   #7
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Default

Quote:
Originally Posted by Dougsg38p View Post
Where are you adding a field to the vertical field manager? I don't understand what you are trying to accomplish, and neither does the system.

A Manager takes the height required to accomodate the fields contained therein. This Manager has no fields, hence no height.
Well no matter how many fields I add to the VFM, I want the height to be the same--the screen height minus the heights of the HFM above and below it.

I'll be adding fields but don't want the HFMs to move when the scroll happens.
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW
Offline  
Old 11-03-2009, 11:55 PM   #8
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

Then you have to limit the extent. Look for a mthod setExtent() (if memory serves).
Offline  
Old 11-04-2009, 12:16 AM   #9
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Default

Wirelessly posted

Yes thanks. I eventually found an something that showed it. The snippet in the other thread was simple enough to understand what was going on. The problem that I have with the "Sample Applications" is that the code is too complex to be able to really figure out what's happening.

There's a difference between seeing code and just copying it vs UNDERSTANDING the code which allows me to decide when to use method X.
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW
Offline  
Old 11-04-2009, 10:51 AM   #10
SamuelD
Knows Where the Search Button Is
 
Join Date: Feb 2009
Location: Quebec, Ca
Model: 8330
OS: v4.5.0.77
PIN: 30293EF0
Carrier: Telus
Posts: 15
Default

An easy way would be to use setBanner(Field field) and setStatus(Field field) for your top and bottom HorizontalFieldManager.

The Banner will stick to the top of the screen and the Status will stick to the bottom. Everything in the screen will scroll between theses two managers (if they are focusable).


Thank you, have a nice day.

--
Samuel D.

Last edited by SamuelD; 11-04-2009 at 10:52 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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Vintage V-Mac Industries Inc. Pipe Threader Vosper Drophead Threader - READ picture

Vintage V-Mac Industries Inc. Pipe Threader Vosper Drophead Threader - READ

$199.00



Vintage Mac Warehouse  3.5” Floppy Disk Solar Powered Calculator Company Swag picture

Vintage Mac Warehouse 3.5” Floppy Disk Solar Powered Calculator Company Swag

$51.80



Vintage White APPLE IMAC EMC 1857 15

Vintage White APPLE IMAC EMC 1857 15" 20GB HDD Mac OSX 10.2 256MB RAM 500MHz

$85.00



Vintage Mac Tools AW343 Series 1/2 Pneumatic Impact Driver  picture

Vintage Mac Tools AW343 Series 1/2 Pneumatic Impact Driver

$50.00



Vintage MAC Tools UVEX Adjustable Safety Glasses Motorcycle Mechanic Lawnmower picture

Vintage MAC Tools UVEX Adjustable Safety Glasses Motorcycle Mechanic Lawnmower

$55.24



VINTAGE RICHARD PETTY #43 MAC TOOLS RACING RED MAGNETIC 90's CAR FENDER COVER picture

VINTAGE RICHARD PETTY #43 MAC TOOLS RACING RED MAGNETIC 90's CAR FENDER COVER

$89.99







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