You Are Here:

Community: Developer Discussion Boards

#1 Old Unhappy How to "jump" an item in a Form - 2005-06-09, 17:15

Join Date: May 2005
Posts: 9
aurelm
Offline
Registered User
Hi

I have a stupid problem in a Form. I had put in 4 Items and I want to separate the four first items and the fifth with a white line, just for the look.
I tried to put all sort of Items with just a " " but it doesn't work, and I don't know the command to jump a line.
Someone can help me?

Thank you
Reply With Quote

#2 Old 2005-06-10, 04:29

Join Date: Mar 2005
Posts: 249
lmtang
Offline
Regular Contributor
use "\n"

[edit]
or multiple of "\n"s for multiple lines
[/edit]

or use Item.setLayout(...) with constants Item.LAYOUT_NEWLINE_BEFORE and Item.LAYOUT_NEWLINE_AFTER

Cheers.
Reply With Quote

#3 Old 2005-06-10, 09:19

Join Date: May 2005
Posts: 9
aurelm
Offline
Registered User
I tried to use \n but it doesn't work and it says me "illegal character : \92, ")" expected". Do you know what that means?
And I can't use item.setLayout(...) because I am using the MIDP 1.0 , it reduces the number of solutions. Do you have another idea?

Thank you
Reply With Quote

#4 Old 2005-06-10, 09:30

Join Date: Mar 2005
Posts: 249
lmtang
Offline
Regular Contributor
well, i doubt that's cause you're using "\n".
Is this what you added:

form.append ("\n");

92 is the ascii for "\" ... which is definitely not an illegal char.

imho, possible you just forgot to close a parentheses somewhere.

What is the line of code that is throwing you that error?
Reply With Quote

#5 Old 2005-06-10, 10:07

Join Date: May 2005
Posts: 9
aurelm
Offline
Registered User
I have understood why there was a message error, I believed that \n was considered as a String and I added form.append(\n);
So I added form.append("\n);
there is no problem of compilation but it happends nothing on the screen, there is no "white line" between my two items. It's like form.append("\n") is ignored.
Do you know why?

Thank you
Reply With Quote

#6 Old 2005-06-10, 10:20

Join Date: Mar 2005
Posts: 249
lmtang
Offline
Regular Contributor
That is odd.. It should work. Always worked for me.

Care to show me that particular code excerpt?
Reply With Quote

#7 Old 2005-06-10, 10:31

Join Date: May 2005
Posts: 9
aurelm
Offline
Registered User
Here a excerpt of the method :

if (form == null){
form= new Form("Filter choice");
form.addCommand(CMD_BACK);
form.addCommand(CMD_OK);
StringItem item1 = new StringItem("Contains",null);
TextField item2 = new TextField(" In To : ","",30, TextField.EMAILADDR);
TextField item3 = new TextField(" In From : ","",30, TextField.EMAILADDR);
TextField item4 = new TextField(" In Subject : ","",30, TextField.ANY);
StringItem item5 = new StringItem("Doesn't contain",null);
TextField item6 = new TextField(" In To : ","",30, TextField.EMAILADDR);
TextField item7 = new TextField(" In From : ","",30, TextField.EMAILADDR);
TextField item8 = new TextField(" In Subject : ","",30, TextField.ANY);
form.append(item1);
form.append(item2);
form.append(item3);
form.append(item4);
form.append("\n");
form.append(item5);
form.append(item6);
form.append(item7);
form.append(item8);
form.setCommandListener(this);
}
display.setCurrent(form);
return form;

And on the screen form.append("\n") is ignored.

Thank you
Reply With Quote

#8 Old 2005-06-10, 11:12

Join Date: Mar 2005
Posts: 249
lmtang
Offline
Regular Contributor
When you say "white line", what do you mean by that?

The "\n" will only make sure that item5 appears on the next line and not next to item4, but it unfortunately does not increase the vertical space between the items.

If you are looking to increase the space between item4 and item5, then you will have to use some sort of image spacer and append that to your form, or in your case, since item5 is a string item, this should work:

Code:
 StringItem item5 = new StringItem("\nDoesn't contain",null);
Hope this helps.
Reply With Quote

#9 Old 2005-06-10, 11:30

Join Date: May 2005
Posts: 9
aurelm
Offline
Registered User
By "White line" I mean vertical space between the items.
I tried StringItem item5 = new StringItem("\nDoesn't contain",null); and it works, there is a vertical space between item4 and item5

Thank you very much for the solution and to spend time to help me
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia