split screen in two
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); |
Hi genvej,
Use "Manager" class to split your screen. Cheers, ARIF |
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:cry:
could u tell me what im doing wrong here? Quote:
|
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); |
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?
|
Code:
VerticalFieldManager vfm=new VerticalFieldManager(Manager.VERTICAL_SCROLL); tweak it to your needs and try it out. |
Quote:
Ur an ace.... got it:idea: |
Quote:
I write this in the MainScreen constructor... Code:
Manager mgrTitle = new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL); -------------- |leftright | -------------- The solution does not work for me! What wrong with my code? |
what were you expecting?
|
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 |
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; } |
All times are GMT -5. The time now is 02:22 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.