BlackBerryForums.com : Your Number One BlackBerry Community
     

»Sponsored Links


BlackBerryApps.com Best Sellers



Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
doni49 Offline
Thumbs Must Hurt
 
Posts: 82
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Default Set Height of VerticalFieldManager - 11-01-2009, 10:18 PM

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
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
Dougsg38p Offline
CrackBerry Addict
 
Posts: 793
Join Date: Mar 2008
Location: Austin, TX
Model: 8320
PIN: N/A
Carrier: T-Mobile
Default 11-01-2009, 10:43 PM

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

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
   
Reply With Quote
  (#4 (permalink)) Old
doni49 Offline
Thumbs Must Hurt
 
Posts: 82
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Default 11-03-2009, 05:08 PM

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
   
Reply With Quote
  (#5 (permalink)) Old
Dougsg38p Offline
CrackBerry Addict
 
Posts: 793
Join Date: Mar 2008
Location: Austin, TX
Model: 8320
PIN: N/A
Carrier: T-Mobile
Default 11-03-2009, 05:22 PM

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.
   
Reply With Quote
  (#6 (permalink)) Old
doni49 Offline
Thumbs Must Hurt
 
Posts: 82
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Default 11-03-2009, 08:18 PM

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
   
Reply With Quote
  (#7 (permalink)) Old
doni49 Offline
Thumbs Must Hurt
 
Posts: 82
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Default 11-03-2009, 08:20 PM

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
   
Reply With Quote
  (#8 (permalink)) Old
Dougsg38p Offline
CrackBerry Addict
 
Posts: 793
Join Date: Mar 2008
Location: Austin, TX
Model: 8320
PIN: N/A
Carrier: T-Mobile
Default 11-03-2009, 11:55 PM

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

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
   
Reply With Quote
  (#10 (permalink)) Old
SamuelD Offline
New Member
 
Posts: 12
Join Date: Feb 2009
Location: Quebec, Ca
Model: 8330
OS: v4.5.0.77
PIN: 30293EF0
Carrier: Telus
Default 11-04-2009, 10:51 AM

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.
   
Reply With Quote
Reply


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





Copyright © 2004-2009 BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.