BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 09-07-2007, 01:53 AM   #1
genvej
Thumbs Must Hurt
 
Join Date: Jul 2007
Model: 8800
PIN: N/A
Carrier: TDC
Posts: 115
Default split screen in two

Please Login to Remove!

Hi.

Is there anyway i can split my screen in two so my components will always have the same location on screen??



------------------

ObjectChoiceField

------------------

button

-----------------

My problem is that my ObjectChoiceField text varies in size, which makes my button bounce up and down for each entry

dropDown=new ObjectChoiceField("choose a plant: ",choiceItems,0,ObjectChoiceField.FIELD_LEFT);

Last edited by genvej; 09-07-2007 at 02:04 AM..
Offline  
Old 09-08-2007, 10:43 PM   #2
arifzaman
Thumbs Must Hurt
 
Join Date: Jun 2007
Location: Bangladesh
Model: 8800
PIN: N/A
Carrier: EDGE
Posts: 93
Default

Hi genvej,

Use "Manager" class to split your screen.

Cheers,
ARIF
Offline  
Old 09-12-2007, 02:53 AM   #3
genvej
Thumbs Must Hurt
 
Join Date: Jul 2007
Model: 8800
PIN: N/A
Carrier: TDC
Posts: 115
Default

well thats what i originally though i would do, however it doesnt seem to work for me. My problem is that sometime my choiceItems is really long in size and therefore makes my stuff in the next manager to jump up and down

could u tell me what im doing wrong here?

Quote:
VerticalFieldManager vfm=new VerticalFieldManager(Manager.VERTICAL_SCROLL);
dropDown=new ObjectChoiceField("vælg en plan: ",choiceItems,0,ObjectChoiceField.FIELD_LEFT);
vfm.add(new LabelField(""));
vfm.add(dropDown);
vfm.add(new LabelField(""));
add(vfm);
Bitmap DocBitmap=Bitmap.getBitmapResource("100Dossier.jpg ");
BitmapField DocBitmapField=new BitmapField(DocBitmap,BitmapField.FIELD_RIGHT);


add(new LabelField(""));
FieldListener sendListener = new FieldListener();
ButtonField sendButton = new ButtonField("Bekræft",ButtonField.CONSUME_CLICK);
sendButton.setChangeListener(sendListener);

HorizontalFieldManager hfm=new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL);
hfm.add(DocBitmapField);
hfm.add(sendButton);

add(hfm);

Offline  
Old 09-12-2007, 10:07 AM   #4
bemshaswing
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Default

You seem to be trying to use a vertical and a horizontal field managers to split. If you want to do a vertical split screen as in

-------
|Top Half|
|Bottom Half|
-------

create one vertical field manager and add two horizontals
if you want to do it like:
-------------------
|Left Half|Right Half|
|Left Half|Right Half|
-------------------
use one horizontal and two vertical.

Note that in your example you are adding vfm and hfm directly to the screen. You'll have to create a manager in the above examples and then,
[superManager].add(submanager);
[superManager].add(submanager);
Offline  
Old 09-12-2007, 12:50 PM   #5
genvej
Thumbs Must Hurt
 
Join Date: Jul 2007
Model: 8800
PIN: N/A
Carrier: TDC
Posts: 115
Default

Im absolutely positive your right in this matter... however im not smart enough to make it work. Do you by any chance have a sample code?
Offline  
Old 09-12-2007, 02:13 PM   #6
bemshaswing
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Default

Code:
VerticalFieldManager vfm=new VerticalFieldManager(Manager.VERTICAL_SCROLL); 

Bitmap DocBitmap=Bitmap.getBitmapResource("100Dossier.jpg ");
BitmapField DocBitmapField=new BitmapField(DocBitmap,BitmapField.FIELD_RIGHT);

HorizontalFieldManager left =new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL);
left.add(DocBitmapField);

HorizontalFieldManager right  =new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL);
right.add(sendButton);

vfm.add(left);
vfm.add(right);

add(vfm);
i haven't tested this but this is more or less what you want for a split left right. note you may have to create custom horizontal managers and restrict the width as regardless of Manager.USE_ALL_WIDTH being part of the style, sometimes it tries to fill the screen with them.

tweak it to your needs and try it out.
Offline  
Old 09-12-2007, 03:44 PM   #7
genvej
Thumbs Must Hurt
 
Join Date: Jul 2007
Model: 8800
PIN: N/A
Carrier: TDC
Posts: 115
Default

Quote:
Originally Posted by bemshaswing View Post
Code:
VerticalFieldManager vfm=new VerticalFieldManager(Manager.VERTICAL_SCROLL); 

Bitmap DocBitmap=Bitmap.getBitmapResource("100Dossier.jpg ");
BitmapField DocBitmapField=new BitmapField(DocBitmap,BitmapField.FIELD_RIGHT);

HorizontalFieldManager left =new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL);
left.add(DocBitmapField);

HorizontalFieldManager right  =new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL);
right.add(sendButton);

vfm.add(left);
vfm.add(right);

add(vfm);
i haven't tested this but this is more or less what you want for a split left right. note you may have to create custom horizontal managers and restrict the width as regardless of Manager.USE_ALL_WIDTH being part of the style, sometimes it tries to fill the screen with them.

tweak it to your needs and try it out.

Ur an ace.... got it
Offline  
Old 09-18-2007, 05:12 PM   #8
TheDoor
New Member
 
Join Date: Sep 2007
Model: 7250
PIN: N/A
Carrier: bell
Posts: 1
Default

Quote:
Originally Posted by genvej View Post
Ur an ace.... got it
I use your solution to do the same thing:
I write this in the MainScreen constructor...

Code:
Manager mgrTitle = new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL);
Manager mgrLeft = new VerticalFieldManager(Manager.VERTICAL_SCROLL);
Manager mgrRight = new VerticalFieldManager(Manager.VERTICAL_SCROLL);

mgrLeft.add(new LabelField("left", LabelField.FIELD_LEFT));
mgrRight.add(new LabelField("right", LabelField.FIELD_RIGHT));

mgrTitle.add(mgrLeft);
mgrTitle.add(mgrRight);

add(mgrTitle);
The result are:
--------------
|leftright |
--------------

The solution does not work for me!
What wrong with my code?
Offline  
Old 09-19-2007, 09:48 AM   #9
bemshaswing
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Default

what were you expecting?
Offline  
Old 09-19-2007, 10:39 AM   #10
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

you could use a fixed layout.
Extend Manager, give it arrays with coordinates and your fields and use it to place the components on specific coordinates.
Your button would be on the same place every time but if your ObjectChoiceField gets to big it will be overlapped.

HfM/VfM are good if you want to have your layout flexible, in your case a fixed layout would work better if i understood your request right.

gs
simon
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 12-04-2008, 06:26 PM   #11
youarenumber1
New Member
 
Join Date: Sep 2008
Model: 8330
PIN: N/A
Carrier: verizon
Posts: 6
Default

When using vertical custom layout manager, why scroll arrow don't appear? The following is my testing code, could anybody help me? I really appreciate...........


class Napolean extends UiApplication {


public static void main (String[] args)
{

Napolean theApp =new Napolean();
theApp.enterEventDispatcher();

}


public Napolean()
{





MainScreen myScreen = new MainScreen();

CustomManager_test Layout_test = new CustomManager_test();
for (int i=0; i<10; i++) {
ButtonField btn = new ButtonField( "test"+i);

Layout_test.add(btn);
}

myScreen.add(Layout_test);
pushScreen(myScreen);

}
}




class NP_RegisterScreen2 extends MainScreen {

NP_RegisterScreen2()
{
CustomManager_test Layout_test = new CustomManager_test();


MainScreen myScreen = new MainScreen();




for (int i=0; i<10; i++) {
ButtonField btn = new ButtonField( "test"+i);

Layout_test.add(btn);
}

myScreen.add(Layout_test);

}
}




class CustomManager_test extends Manager
{

public CustomManager_test()
{
super( Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR );


}


protected void sublayout(int mywidth, int myheight)
{

Field field;
int numberoofFields =getFieldCount();
int column_no=3;


int x=0;
int y=0;
for (int lcv = 0; lcv < numberoofFields; lcv++)
{
field = getField(lcv);
setPositionChild(field, x, y);
layoutChild(field, mywidth , myheight);
x=0;
y+=30;

}


setExtent(mywidth, 120);



}

public int getPreferredWidth()
{
int width=20;
return width;

}

public int getPreferredHeight()
{

int height = 230;
return height;

}
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


Ferraz Shawmut A50P125-4TA Semiconductor Fuse picture

Ferraz Shawmut A50P125-4TA Semiconductor Fuse

$199.99



Peak, Atlas DCA55 Semiconductor Tester,  picture

Peak, Atlas DCA55 Semiconductor Tester,

$97.99



Semiconductor Refrigeration Cooler Thermoelectric Peltier Cold Plate 240W SALE picture

Semiconductor Refrigeration Cooler Thermoelectric Peltier Cold Plate 240W SALE

$32.30



Fuse, Semiconductor, Blade, FWP, 175A, 700V picture

Fuse, Semiconductor, Blade, FWP, 175A, 700V

$283.43



WESTCODE SEMICONDUCTOR 12-679126-04 NEW 1267912604 picture

WESTCODE SEMICONDUCTOR 12-679126-04 NEW 1267912604

$150.00



NEW OPEN BOX Siemens 3RF2310-1BA02 Semiconductor Contactor STOCK 5420 picture

NEW OPEN BOX Siemens 3RF2310-1BA02 Semiconductor Contactor STOCK 5420

$120.00







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