Creating an application information/help screen on Blackberry -


I am trying to create a screen about help / application for my application, but I have found that, okay My code is useless (I know it can use a little refactoring, but when working with a new framework then I get the code working first, then go back immediately and work to get a refactor.) < / P>

First of all, what I do "does not feel" correctly in doing so, I think it is not certain about filling a bunch of text fields in the layout - is there a better way to do this? Though Why?

Second, the VFM is taking the bulk of the screen up and pressing the button below my '' What I'm trying to do is show the title and the 'Close' button, but only scroll to VFM Please.

How can I solve these problems? Public category helpskin popupscreen {public helpScreen () (Super (new vertical field manager), field. Focusable) is expanded; / * Close button build / field change listener Listener = New Field Change Listener () {Public Zero Field changed (field field, int context) {ok ();}}; buttonfield b = new buttonfield ("close", field. FIELD_HCENTER); b.setChangeListener (listener) A text box containing help; / * MAP / VerticalFieldManager vfm = New Vertical Field Manager (VERTICAL_SCROLL); TextFieldF; Vfm.add (f = New TextField (FIELD_LEFT | READONLY); F.setText ("My application does stuff. This part tells what this is Vfm.add (f = new textfield (FIELD_LEFT | READONLY); Vfm.add (f = new textfield (FIELD_LEFT | READONLY); f.setText ("command:"); Vfm.add ( F = new textfield (FIELD_LEFT | READONLY); F.setText ("N - new widget"); Vfm.add (f = new textfield (FIELD_LEFT | READONLY); F.setText ("R - Rename widget" ); Vfm.add (f = new textfield (FIELD_LEFT | READONLY); F.setText ("D - Duplicate Widget"); Vfm.add (f = new textfield (FIELD_LEFT | READONLY); F.setText ("C - Clear Widget"); Vfm.add (f = new textfield (FIELD_LEFT | READONLY); F.setText ("Shift-Delete - Delete Widgets"); / * Create a screen * / add (new label field ("About widget widgets", field. FIELD_HCENTER)); Add (New Separator Field); Adding (VFM); (B) add; } Public Zero is OK () {UiApplication.getUiApplication (). Popscreen (this); For the code 'not feeling right' - it seems to function properly, but a bit of rearrangement can make it a bit clearer - it may be possible to create a method and populate the text field

  private textField createTextField (string content) {textField textfield = new textField (}  

Then the creator gets that part:.

 < Code> VerticalFieldManager VFM = new VerticalFieldManager (VERTICAL_SCROLL); vfm.add (createTextField ("My application makes stuff is this part"); vfm.add (createTextField (" Vfm.add (createTextField ("R - Rename widget")); vfm.add (createTextField (' ; - vfm.add (createTextField ("Shift-Delete - Delete Widget"));  

> You solve the layout problem using custom field manager - is not really difficult, you just have to sub-class manager and implement the celebration. Define a 'top', 'bottom', and 'middle' field, and the layout accordingly (some code readers have been left as an exercise, but basically you specify it when adding fields to the manager One should be able to down and down as one. The logic below will ensure that the lower area always remains at the bottom bottom, and the top 2 fields do not press it from the bottom:

  Protector Zero sublayout (integer width, integer height) {// top retrieve, middle and bottom areas int heightRemaining = height; layoutChild (TOPFIELD, width, heightRemaining); setPositionChild (TOPFIELD, 0, 0); heightRemaining - = topField.getHeight ); LayoutChild (bottomField, width, heightRemaining); setPositionChild (bottomField, 0, height - bottomField.getHeight ()); heightRemaining - = bottomField.getHeight (); layoutChild (Middlefield, width, heightRemaining); setPositionChild (Middlefield, 0, TopField.getHeight ());}  

Again, just one framework - no error checking or anything on there Then set your representative as this new manager, set the middle field to your vertical field manager (you may want a nominated setter), in the field below your button field (again, named recipient).


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -