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



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


National Instruments Mainframe Chassis - NI-PXIe-1071 w/Warranty picture

National Instruments Mainframe Chassis - NI-PXIe-1071 w/Warranty

$690.00



Chroma 6312A DC Electronic Load Mainframe **FOR PARTS ONLY, POWERS ON** picture

Chroma 6312A DC Electronic Load Mainframe **FOR PARTS ONLY, POWERS ON**

$200.00



Agilent E1301B Mainframe  9-slots with multimeter, totalizer, and relay muxes picture

Agilent E1301B Mainframe 9-slots with multimeter, totalizer, and relay muxes

$350.00



Fluke Versiv 2 Modular Mainframe and Remote picture

Fluke Versiv 2 Modular Mainframe and Remote

$3600.00



SHC SYSTEM 6 MAINFRAME + Mixed Modules 6-562,6-201,6-402. picture

SHC SYSTEM 6 MAINFRAME + Mixed Modules 6-562,6-201,6-402.

$99.99



National Instruments NI PXI-1044 Chassis 14-Slot PXI Mainframe 189105E-01 Rev 01 picture

National Instruments NI PXI-1044 Chassis 14-Slot PXI Mainframe 189105E-01 Rev 01

$199.99







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