05-26-2009 06:03 PM
Using JDE 4.5.
I need to set fields (LabelField, ButtonField, etc.) in arbitrary positions on the application screen. The official methods that I have found seem to deal with left and right, but I need my fields to appear in other places. I did get something that works though. Here is the essence of my solution, where I place two Labels where I want them.:
verticalFieldManager = new VerticalFieldManager(...);
LabelField labelField = new LabelField("blah");
VerticalFieldManager vfm = new VerticalFieldManager();
LabelField labelField2 = new LabelField("foo bar");
VerticalFieldManager vfm2 = new VerticalFieldManager();
As you see, the secret sauce is setPadding() -- which I read about in these forums. But it's undocumented... Now of course I'm delighted to be a part of a secret cabal... But I wonder what is the official way of doing this.
Thanks for any help --fd
Solved! Go to Solution.
05-26-2009 11:39 PM
Have a look at this link
this will help you.setPositionChild() is the method which should help you in achieving the desired result.
05-27-2009 01:57 AM
I had found that thread, but I was hoping for something simpler. On studying it more carefully though, I think I understand it, and it's not all that hard. I'll give it a shot.
03-23-2010 04:40 AM
I think setPadding and setMargin is very useful.
It makes life of GUI developer much easier than using setPosistionChild (which we have to create a wrapper manager). I just don't understand the implication of RIM when they try to remove those method (or at least make them deprecated and undocumented).
Is there any explanation for this behaviour from RIM?
03-23-2010 05:07 AM
I also have somewhat similar query & I think this is the only & the best way to add our components the way we want.
But as mentioend in the link, they have buttonFields in the LayoutManager class itself. In my case, I want to add Labels, EditField & ButtonFields. All need to be listened, so need to add Listener. If they are declared in LayoutManager itself, how can I access them in my Screen class or add listener to them.
If I declare & initialize them in screen class, & add them in LayoutManager class, is that possible! Then I will have to set x, y locations for my all fields in sublayout(), correct. And then will I be able to access those components in the screen class too.
This is what is bothering me & am not able to find solution for the same. I want the components to be accessed in Screen & layout manager class.
Thanks for yout help & assistance.