| Reply | « Previous Thread | Next Thread » |
|
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 |
|
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. |
|
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 |
|
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? |
|
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 |
|
That is odd.. It should work. Always worked for me.
Care to show me that particular code excerpt? |
|
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 |
|
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);
|
|
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 | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|