BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 07-15-2005, 10:32 PM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2005
Model: 7520
Posts: 31
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default FlowFieldManager fails it

Please Login to Remove!

Has anyone had any luck with FlowFieldManager (or HorizontalFieldManager)? Seems no matter what I do the first field added to the manager gets the full width of the parent frame (MainScreen), even though it's an edit field with max chars of 3.

Googling turned up a couple of links which recommended overriding getPreferredWidth() in the edit field, but this has no effect - the method never gets called using HorizontalFieldManager, and the value is ignored using FlowFieldManager.

Has anyone implemented either of these managers successfully (i.e. having more than one edit field on one horizontal row) without requiring custom paint code?
Offline  
Old 07-15-2005, 11:00 PM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2005
Model: 7520
Posts: 31
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well (to reply to my own post), I've now found a little success overriding the layout() method.. still I'd be interested to share experiences with others who've tried using the various FieldManagers.

I've included the relevant code in case anyone finds it useful. These methods form part of your custom edit field class.

Code:
public int getPreferredWidth()
{
   // If you don't want the field resizing as text is added (an empty field will
   //  have zero input width, therefore), change getText() to some known
   // string, for example the longest string you want displayed.
   return getFont().getAdvance(getLabel() + getText());
}
    
protected void layout(int width, int height)
{
   width = getPreferredWidth();
   height = getPreferredHeight();
   super.layout(width, height);
   super.setExtent(width, height);
}

Last edited by Hackberry : 07-16-2005 at 09:56 AM. Reason: Include sample code
Offline  
Closed Thread


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

Hand Glove Vintage Mannequin General Porcelain Sz 8 HH Trenton NJ Dec. 15, 1971
$55.0
Hand Glove Vintage Mannequin General Porcelain Sz 8 HH Trenton NJ Dec. 15, 1971 pictureAshcroft Paper Tester, Pat. Dec. 31,1912, Vintage, Antique
$39.0
Ashcroft Paper Tester, Pat. Dec. 31,1912, Vintage, Antique pictureVintage REED Mfg Co. No. 31 Swivel Bench Vise Pat. Dec 24, 1912 Wt 47 lb, 3.5"
$70.0
Vintage REED Mfg Co. No. 31 Swivel Bench Vise Pat. Dec 24, 1912  Wt 47 lb, 3.5VINTAGE DEC 5016674-01C1 CONTROLLER CARD * USED *
$92.0
VINTAGE DEC 5016674-01C1 CONTROLLER CARD * USED * pictureVintage DEC Digital VT330 / VT340 Reference Manuals (Volumes 1 and 2)
$17.5
Vintage DEC Digital VT330 / VT340 Reference Manuals (Volumes 1 and 2) picture






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