|
Replies:
9
-
Last Post:
Nov 5, 2008 9:29 PM
by: Shai Almog
|
|
|
|
|
|
|
|
A suggestion about TextArea
Posted:
Jul 23, 2008 2:56 AM
in response to: darolla
|
|
|
Hi LWUIT team,
Say I have a long message to be displayed using TextArea. I need to figure out how many rows I need before a proper TextArea is constructed. But I have noticed the TextArea itself actually knows how to display a long message. I mean it knows where to start a new line and how to handle “\n� etc. So it could go a bit further to figure out the rows needed all by itself.
I was wondering if you could add/modify TextArea constructor (s) so that we do not need to supply “rows� value. Make sense?
Many thanks,
Qunhuan
|
|
|
|
|
|
|
|
RE: A suggestion about TextArea
Posted:
Jul 23, 2008 3:03 AM
in response to: Qunhuan Mei
|
|
|
Hi again,
Just noticed that when rows given is more than 1, the TextArea knows to use exact rows needed (e.g. for a long message, the actual rows needed is used instead of given). Maybe simply the doc need to be changed to show this capability.
-----Original Message----- From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com] Sent: 23 July 2008 10:56 To: users@lwuit.dev.java.net Subject: A suggestion about TextArea
Hi LWUIT team,
Say I have a long message to be displayed using TextArea. I need to figure out how many rows I need before a proper TextArea is constructed. But I have noticed the TextArea itself actually knows how to display a long message. I mean it knows where to start a new line and how to handle “\n� etc. So it could go a bit further to figure out the rows needed all by itself.
I was wondering if you could add/modify TextArea constructor (s) so that we do not need to supply “rows� value. Make sense?
Many thanks,
Qunhuan
|
|
|
|
|
|
|
|
RE: A suggestion about TextArea
Posted:
Jul 28, 2008 2:46 AM
in response to: Qunhuan Mei
|
|
|
Hi LWUIT team,
In case this issue has not been handled, here is some more input:
Seems to me design wise, the functionality is there for dealing with displaying unknown size of text message. But implementation may need some refinement.
For displaying unknown length of text, I am not sure whether I need 1 row or more. So when I initialise the TextArea, I will not supply any row number. But I know the message may be long, so I would use setGrowByContext(true).
Currently both TextArea() // without specifying row number and TextArea(1, constraint) // specifying only one row
will only have one row, although setGrowByContext(true) is called.
Only when 2 row is specified will cause the textArea to grow by context, without even call setGrowByContext(true).
Here, if the message is short, still 2 rows will be used and have an unwanted empty row on the screen.
Seems to me the TextArea in this aspect does need some refinement.
Thank you,
Qunhuan
-----Original Message----- From: Qunhuan Mei Sent: 23 July 2008 11:03 To: users@lwuit.dev.java.net Subject: RE: A suggestion about TextArea
Hi again,
Just noticed that when rows given is more than 1, the TextArea knows to use exact rows needed (e.g. for a long message, the actual rows needed is used instead of given). Maybe simply the doc need to be changed to show this capability.
-----Original Message----- From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com] Sent: 23 July 2008 10:56 To: users@lwuit.dev.java.net Subject: A suggestion about TextArea
Hi LWUIT team,
Say I have a long message to be displayed using TextArea. I need to figure out how many rows I need before a proper TextArea is constructed. But I have noticed the TextArea itself actually knows how to display a long message. I mean it knows where to start a new line and how to handle “\n� etc. So it could go a bit further to figure out the rows needed all by itself.
I was wondering if you could add/modify TextArea constructor (s) so that we do not need to supply “rows� value. Make sense?
Many thanks,
Qunhuan
|
|
|
|
|
|
|
|
Re: A suggestion about TextArea
Posted:
Jul 28, 2008 4:21 AM
in response to: Qunhuan Mei
|
|
|
Hi, TextArea with 1 row used as a special case for TextField(before we implemented TextField), so this should be rethink.
Thanks, Chen
Qunhuan Mei wrote: > Hi LWUIT team, > > In case this issue has not been handled, here is some more input: > > Seems to me design wise, the functionality is there for dealing with displaying unknown size of text message. But implementation may need some refinement. > > For displaying unknown length of text, I am not sure whether I need 1 row or more. So when I initialise the TextArea, I will not supply any row number. But I know the message may be long, so I would use setGrowByContext(true). > > Currently both > TextArea() // without specifying row number > and TextArea(1, constraint) // specifying only one row > > will only have one row, although setGrowByContext(true) is called. > > Only when 2 row is specified will cause the textArea to grow by context, without even call setGrowByContext(true). > > Here, if the message is short, still 2 rows will be used and have an unwanted empty row on the screen. > > Seems to me the TextArea in this aspect does need some refinement. > > Thank you, > > Qunhuan > > > > > -----Original Message----- > From: Qunhuan Mei > Sent: 23 July 2008 11:03 > To: users@lwuit.dev.java.net > Subject: RE: A suggestion about TextArea > > Hi again, > > Just noticed that when rows given is more than 1, the TextArea knows to use exact rows needed (e.g. for a long message, the actual rows needed is used instead of given). Maybe simply the doc need to be changed to show this capability. > > > -----Original Message----- > From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com] > Sent: 23 July 2008 10:56 > To: users@lwuit.dev.java.net > Subject: A suggestion about TextArea > > Hi LWUIT team, > > Say I have a long message to be displayed using TextArea. I need to figure out how many rows I need before a proper TextArea is constructed. But I have noticed the TextArea itself actually knows how to display a long message. I mean it knows where to start a new line and how to handle “\n� etc. So it could go a bit further to figure out the rows needed all by itself. > > I was wondering if you could add/modify TextArea constructor (s) so that we do not need to supply “rows� value. Make sense? > > Many thanks, > > Qunhuan >
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net For additional commands, e-mail: users-help@lwuit.dev.java.net
|
|
|
|
|
|
|
|
Re: A suggestion about TextArea
Posted:
Oct 9, 2008 6:24 AM
in response to: Qunhuan Mei
|
|
|
Hi Qunhuan, perhaps you can do the next:
You can retrieve the width (and height) from a canvas and you can retrieve the font used by default with Font.getDefaultFont() (you have to use Font object from LWUIT). Then from Font you can know how is the width of some character (for example O with is the most wide) using the static method Font.charWidth('O'); with this data you can create a Util class to return the rows for a specific text. Something like that:
public int getRowsToTextArea(String txt){ int letras = txt.length(); Controller.logger("cantidad de letras del texto: "+letras); //int altura = Font.getDefaultFont().getHeight(); int anchomax = Font.getDefaultFont().charWidth('O'); Controller.logger("ancho de la letra O: "+anchomax); Controller.logger("ancho de la pantalla: "+w); Controller.logger("alto de la pantalla: "+h); int cantMaxLetrasPorRenglon = w/anchomax; int filas = letras/cantMaxLetrasPorRenglon; if(filas == 0){filas=1;} return filas; }
I hope this can be useful for you. Regards
Mario La Menza
|
|
|
|
|
|
|
|
RE: A suggestion about TextArea
Posted:
Oct 9, 2008 6:58 AM
in response to: mariolamenza_lm2a
|
|
|
Hello Mario La Menza,
Just realised your email is actually addressed to me (nowadays I receive so many emails from users@lwuit..., while a good sign LWUIT is getting more and more popular, I no longer check all of them carefully now). Thank you very much for your idea!
Actually the company I work for has just passed the full feasibility test for LWUIT based apps and we have started full speed development work.
This TextArea suggestion was made during my early days of reviewing LWUIT. I have since moved to other areas of work and am very tided up.
If next I am going to look into the issue again, your suggestion will certainly be a very good starting point!
Have a nice day,
Qunhuan
-----Original Message----- From: lwuit-users@mobileandembedded.org [mailto:lwuit-users@mobileandembedded.org] Sent: 09 October 2008 14:25 To: users@lwuit.dev.java.net Subject: Re: A suggestion about TextArea
Hi Qunhuan, perhaps you can do the next:
You can retrieve the width (and height) from a canvas and you can retrieve the font used by default with Font.getDefaultFont() (you have to use Font object from LWUIT). Then from Font you can know how is the width of some character (for example O with is the most wide) using the static method Font.charWidth('O'); with this data you can create a Util class to return the rows for a specific text. Something like that:
public int getRowsToTextArea(String txt){
int letras = txt.length(); Controller.logger("cantidad de letras del texto: "+letras); //int altura = Font.getDefaultFont().getHeight(); int anchomax = Font.getDefaultFont().charWidth('O'); Controller.logger("ancho de la letra O: "+anchomax);
Controller.logger("ancho de la pantalla: "+w);
Controller.logger("alto de la pantalla: "+h);
int cantMaxLetrasPorRenglon = w/anchomax; int filas = letras/cantMaxLetrasPorRenglon; if(filas == 0){filas=1;} return filas; }
I hope this can be useful for you. Regards
Mario La Menza [Message sent by forum member 'mariolamenza_lm2a' (mariolamenza_lm2a)]
http://forums.java.net/jive/thread.jspa?messageID=304287
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net For additional commands, e-mail: users-help@lwuit.dev.java.net
|
|
|
|
|
|
|
|
|
|
Re: Downloading "Extension library for LWUIT" ?
Posted:
Nov 4, 2008 1:48 PM
in response to: darolla
|
|
|
Hi,
I also want to know where download the LWUIT-ext ....
Marlon
|
|
|
|
|
|
|
|
Re: Downloading "Extension library for LWUIT" ?
Posted:
Nov 5, 2008 9:29 PM
in response to: marlon_luz
|
|
|
|
|
Hi, please refer this to the ext list. The projects are separate. No release is currently available.
> Hi, > > I also want to know where download the LWUIT-ext .... > > Marlon > [Message sent by forum member 'marlon_luz' (marlon_luz)] > > http://forums.java.net/jive/thread.jspa?messageID=314911 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net > For additional commands, e-mail: users-help@lwuit.dev.java.net >
Shai Almog http://lwuit.blogspot.com/
[att1.html]
|
|
|
|
|