Limit number of lines in a text editor
Hello.
In my program, i'm creating a text zone and i need to limit the data users will put in this zone.
To create that, i'm using the object cl_gui_textedit. I've looked in the methods of this object but i wasn't able to find one that will limit the number of lines of the text editor.
Did i miss it ? Does anybody knows how i can for example limit the input zone to 5 lines ?
Thanks for your help.
Here's my code
IF g_editor IS INITIAL.
* Instanciation du container pour la zone de texte
CREATE OBJECT g_textedit_custom_container
EXPORTING
container_name = 'TEXTEDITOR'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
* add your handling
ENDIF.
* Création de la zone d'édition du texte
CREATE OBJECT g_editor
EXPORTING
parent = g_textedit_custom_container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = 68
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
ENDIF.
I just notice there is a method SET_HEIGHT but this one is implemented in CL_GUI_CONTROL.
I tried this :
CALL METHOD g_editor->set_height
EXPORTING height = w_height.
But in fact, i never enter the method.
Do i have to create a CL_GUI_CONTROL object ? If yes, how do i link it to the CL_GUI_TEXTEDIT.
Sorry if some questions mays seem obvious. It's my first object abap program.
Similar Messages
-
How to find number of lines in the text content?
Hello All,
I have a multi line text item. I want to know the number of lines in a text item? How can I do that?
Note that every lines end with the shift+enter.
Example,
This is a
sample.
After line This is a there is (Shift + Enter).
Thanks for any help.Whenever the user inputs Shift-Enter, Photoshop inserts an [EOT] (End Of Text) control character (\x03 or \u0003) in the string.
Also, in order to split the text according to multiple separators in only one call, it is necessary to use a regular expression instead of a string.
Try replacing:
var theArray = theText.split("\r");
with:
var theArray = theText.split(/[\u0003\r]/);
BTW, you can improve performance by explicitely requesting the textKey property of the current layer object.
Try using:
ref.putProperty( charIDToTypeID("Prpr"), stringIDToTypeID("textKey") );
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
instead of:
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
HTH... -
How can I find out the number of lines in a text file?
How can I find out the number of lines in a text file?
java.io.BufferedReader in = new java.io.BufferedReader( new java.io.FileReader( "YourFile.txt" ) );
int lineCount = 0;
while( in.readLine() != null )
lineCount ++;
System.out.println( "Line Count = " + lineCount ); -
To limit number of characters in a text field...
I did a little research. My goal is to limit the number of characters in the textfield by 50.
If the results of my research are correct, I have to create a JFormattedTextField, then use a MaskFormatter with a mask of 50 asteriks. Is that correct? Any other suggestions?
Thanks in advance.I've got a problem using a JFormattedTextField.
Each time the the text field gains focus, the caret does no move to the end of the text. It appears at the start of it. plus, any text i typed will overwrite the character already typed in, as if you've pressed the INSERT button during typing in a text editor.
What caused that and how do I resolve it?
Thanks a lot for the help ;) -
I know how to limit the number of characters that a user can
input, but is there a way to limit the number of lines that a user
can input into a textbox.Firstly thanks kglad and KnowMind for your responses.
Why I wanted this. I have a textfield that a user fills in.
This text is then displayed in another textfield that can't be
scrolled at a later point. Therefore I need to limit the number of
lines that they use when filling in the first textfield so that it
will be fully displayed in the later textfield.
knowmind, your code works, but doesn't do what I wanted. as
it increases the size of the textfield being filled out, rather
than limitting it.
kglad (as usual) you have done what I wanted, however if a
user tries to edit his work, eg, goes back to the top line and
clicks enter any line that goes over the height is lost and can't
be retrieved, which would be annoying. Therefore instead I am going
to use the following code:
commentTxt.maxChars=420;
remForcedLines = commentTxt.text.split("\r").join(" ");
It simply removes any forced lines that are in textfield 1.
Therefore as long as maxChars is under the maxchars in textfield 2,
it will display fully. Obviously this wouldn't be particularly
practicle for large textfields but as you can see it is only 420
chars long.
So thanks to both of you for your help. J. -
Hi,
I am facing the problem that when I read the content of the
texteditor, store it in a javascript variable, and then write it
again into the editor area, all line breaks (not html line breaks,
just the line breaks for the code structure) are gone.
For Example if the content of the Editor is the following:
Test line 1
Test line 5
If I know call my function the value of the texteditor will
be somethign like: "Test line1 Test line 5"
I tried finding the linebreaks and replacing them (either \n,
\r or \n\r) but had no success in doing that.
My code of the function:
var theDom=dw.getDocumentDOM();
var temp = theDom.documentElement.outerHTML;
theDom.documentElement.outerHTML="";
theDom.documentElement.outerHTML=temp;
So I assume Javascript and dw are using different formats,
but I cant find much information about whats being used.
Any help appreicated!
Best,
DavidHi Brent,
Use CHR(10) in text editor for a new line. for example( 'SAP' & CHR(10) & 'Visual' & CHR(10) & 'Composer') will display like,
SAP
Visual
Composer
Hope it helps....
Regards
Basheer -
Counting number of lines in a text/csv file using xquery/xslt.
Hi,
I have a CSV file, I need to count the total number of lines in that file. This I have to use in OSB. My requirement is I have to count total no of lines in the $body file (CSV/flat file) and subtract header and footer lines from it.
EX:
header,1, @total_no_of_detal@
detail,1
detail,2
detail,3
detail,n
footer, 1
If suppose i have 10 detail lines, and I am getting body of the file as shown above,
then in the final file, I have to change the body of the file as:
header,1, *10*
detail,1
detail,2
detail,3
detail,n
footer, 1
Please advice how to do this in OSB.
Edited by: user12679330 on Aug 2, 2011 2:34 AMI would suggest you to use MFL to convert the file into XML when you read it and then you can count the detail elements within the XML and update the values in Header element before writing the file again in flat file format again using MFL.
You can read the documentation of Format Builder utility which is used to define MFL here:
http://download.oracle.com/docs/cd/E21764_01/doc.1111/e15866/part_fb.htm
Alternatively, another approach is the read the whole flat file as a text string and then doing needed manipulations to get what you need. If you want to do it like this then you will need to consider following things:
1. Is the file in DOS format or Unix format? (To know the End of line character in use)
2. Does the file contain an end of line at the end of file? (whether there is an end of line char at the end of data of footer record)
Once you know above, you can try an xquery like following:
let $intermediateXML :=
<Root>
for $a in (tokenize($in, 'EOL'))
return
if (string-length($a) > 0)
then
<record>{$a}</record>
else ()
</Root>
let $count := count($intermediateXML/record)
let $outXML :=
<OutRoot>
for $i in 1 to $count
return
if (data($i) = 1)
then
<Record>{concat($out, $intermediateXML/record[$i]/text(), ',Count=',($count)-2)}</Record>
else
<Record>{concat($out, $intermediateXML/record[$i]/text())}</Record>
</OutRoot>
return op:concatenate($outXML/Record/text(), 'EOL')In Above XQuery, replace EOL with the end of line character which for unix wound be "
 ;" (remove quotes and space between the A and ; ) and for DOS would be "
 ;
 ;" (remove quotes and space between the A and ; and D ; ) -
Limit number of characters in a text cell
Hi Numbers Community,
Is there a way to put a cap on the number of characters that can be written into a cell with Data Format set as Text?
Thanks for your help!There doesn't seem to be a way to keep you from going over a limit on the number of characters in a cell but you can use Conditional Highlighting to alert you when you do go over the limit. This, for example, sets the background color of cell B9 to red if there are more than four characters in cell A9:
The formula in B9: =LEN(A9)
SG -
Saving the text in text editor changes text line format
In my program I have an output witha text editor box where
we type in text and save , and if we want to print it it prints it out
on a smartform. When I type in a text on the text editor box for example :
"This will include a policy and best practice for
what files can be stored on the server and where
they should reside. The policy will include
required ownership of each folder and required
authorizations for access to folders. Also
included in the policy will be a section describing
best practices on the file and folder naming
conventions. Anew file struicture of the drive that
better aligns with the business. An drive with only
four folders at the root level also will be de"
After I type in this text in teh text editor and try saving it
, it save sthe text but shows up with lots of gaps like below.
"This will include a policy and best practice for
what files can be stored on the server and
where
they should reside. The policy will include
required ownership of each folder and
required
authorizations for access to folders. Also
included in the policy will be a section
describing
best practices on the file and folder naming
conventions. Anew file struicture of the drive
that
better aligns with the business. An drive with
only
four folders at the root level also will be de"
I am not preety sure why on saving teh typed text it chnages to this format.
I would like to have my program save it as is typed. Is this possible to do so
and how?
Thanks.Hi Aarav,
Check the internal table used to store the text is having line length 100. Change that to 200 or more . You can see the difference . If still the problem persists, enter each line in the text editor and conclude each line with a carriage return( ENTER )
key press.
Hope this will help you.
Regards,
Smart Varghese -
Incress the lines in long text
hi experts,
can we incesss the the number of lines in long text,right now i am able to enter only 5 line i want to make it 10......the t-code is a customized one.Hi
There is no limit as such for entering long text lines.
In the Text editor you can enter any number of lines.
we have to fetch it using READ_TEXT fun module and to display in the report/script.
Reward points if useful
Regards
Anji -
Maximum number of lines textfield
Hi everybody !
I need to set a maximum number of lines on a text field that should be expandable up to that line number and not beyond.
Who do I know how to do?You can control the number of chars in the field, you can limit the field to the visible area but you cannot dictate a number of lines that the field can be. The closest thing you can get is to make the field the max number fo lines and then use "limit to visible area" so that people cannot add more text.
Paul -
How to get the number of lines of a file?
Folks:
Is there a way to get the number of lines of a text file? I don't know if there is an existing method to do that.
Thanks a lot.HI
I found some solution
other than increment loop and all
here is the code it might helpful to u
//returns the number of lines in a file
//author : Ravindra S
//Symphony software Hyderabad
try
RandomAccessFile randFile = new RandomAccessFile(csvFile,"r");
long lastRec=randFile.length();
randFile.close();
FileReader fileRead = new FileReader(csvFile);
LineNumberReader lineRead = new LineNumberReader(fileRead);
lineRead.skip(lastRec);
countRec=lineRead.getLineNumber()-1;
fileRead.close();
lineRead.close();
catch(IOException e) -
Is there a method that returns the number of lines in a text file? I'm trying to make an array of arrays, with each inner array holding 4 strings from 4 consecutive lines from a file, and the outer array holding every one of those arrays that are possible in the file. I can't anticipate the amount of 4-line blocks im going to have tho, so i need something that returns the number of lines available and divides that by four. I'll then populate the outer array by looping that many times. If any of that made sense...
Is there a method that returns the number of lines in
a text file? I'm trying to make an array of arrays,
with each inner array holding 4 strings from 4
consecutive lines from a file, and the outer array
holding every one of those arrays that are possible
in the file. I can't anticipate the amount of 4-line
blocks im going to have tho, so i need something that
returns the number of lines available and divides
that by four. I'll then populate the outer array by
looping that many times. If any of that made sense...You would do better to use java.util.List implementations such as ArrayList and LinkedList then you don't need to know the number of lines. -
Counting lines in a text/csv file.
Can you advice me, how I can get the total number of lines in a text/csv file please using java code.
I will get the text/csv file content in a string variable not as a file.
EX: string var = "123\n234\n123\n3456\nsdfsd\n" here \n is in the new line.
for this I have to get the total lines as 5.
Please advice.
Thanks.Kayaman wrote:
user12679330 wrote:
Oh ok.. ignore the last one, Any idea on this please.Count the newline characters like morgarl told you. You're being very difficult to help for such a simple problem.Thats because nobody has posted the code yet dude ;)
I'm pretty sure that once the OP finally takes the hint and writes the two lines of code needed to solve this question, he'll come up with something that sometimes gives the correct answer and other times gives a count that is one-off. -
My requirement is to show a text editor on the screen.allow the user to type in it. (Example he type n lines). Store the content in D/B table. Next time i display the screen, all n lines should be displayed.Now if he enters m lines in addition to n lines ... then i should display n+m lines in the text editor.
How can i do that.Hi Karthik,
Go through program <b>RSDEMO_DRAG_DROP_EDIT_TREE</b>.
Reward if this helps,
Satish
Maybe you are looking for
-
I have problem when I want to redirect a page, inputparam2test.jsp back to the perious page, inputparam1test.jsp. Everything works until I add a "if" statement in the inputparam1test.jsp. The error is "Error 50
-
Data Services 12.2.2.0 cannot open connection to the repository NEW Install
I can connect to the repository DB using Toad and SQL Management Studio, but I cannot connect with DS. I've tried 12.2.0.0 and most recently 12.2.2.0 - nothing is working, any helpful advice is appreciated. DS SERVER SAP BusinessObjects Data Services
-
Function to get the availability of a material by Valuation area
Hi, I need a Function ABAP to get the availability of a material by Valuation area, the bapi BAPI_MATERIAL_AVAILABILITY shows no the availability of a material by Valuation area
-
Where are my playlists in itunes 11
where are my playlists in itunes 11 ?
-
anybody have a suggestion? I need to find out what my key code is to connect another pc to my airport, I am running snow leopard. I need the hexidecimal code, 12 characters. How can I find it?