Multi-Line Custom Text Input

We're glad you came by, but you might find what you're looking for elsewhere.

TI-Basic Developer is not the site it once was. While its information on commands and other calculator features remains almost second-to-none, its forum, archives, and even hosting service, Wikidot, have been decaying for years. The calculator community would love to see what you're working on, or help you in your next coding adventure, but TI-Basic Developer is no longer the place to do it.

Instead, you should head over to Cemetech (primarily American) or TI-Planet (primarily international). Both are active, well-established forums with their own archives, chatrooms, reference material, and abundant coding tools and resources. We'll see you there, we hope.

Forum » Programming & Design / TI-83/84/+/SE Programming » Multi-Line Custom Text Input
Started by: EnerLorde EnerLorde
Date: 22 Mar 2024 17:36
Number of posts: 2
rss icon RSS: New posts
Summary:
How would one go about modifying the code below to make it do multiple lines of text.
Multi-Line Custom Text Input
EnerLorde EnerLorde 22 Mar 2024 17:36

How would one go about modifying the code below to make it do multiple lines of text?

" →Str1 
:Repeat K=105
:Repeat Ans>40 and Ans<94 or Ans=105
:getKey→K
:End
:Ans-20-5int(.1Ans
:If 25>length(Str1) and 0<Ans and Ans<29
:Then
:Str1+sub("ABC DEFGHIJKLMNOPQRSTUVWXYZ",Ans,1→Str1
:Text(10,1,Str1
:End
:If K=23 and 1<length(Str1 
:Then
:sub(Str1,1,length(Str1)-1→Str1
:Text(10,1,Str1," 
:End
:End
:If 1<length(Str1
:sub(Str1,2,length(Str1)-1→Str1
by EnerLorde EnerLorde , 22 Mar 2024 17:36
Re: Multi-Line Custom Text Input
naga_serpentis naga_serpentis 04 Apr 2024 07:24

You could do multiple lines of text, however it is more difficult without libraries. You could attempt with Celtic III (for monochrome) or Celtic II CSE (for CSE calculators) and Celtic CE (for CE calculators) , by creating a program for you to edit the text in and shift lines based off of where the cursor is. For example, you could create a program with empty lines of code, start the cursor on line one.

Assuming you have Celtic installed…

(Note, I am using the home screen for simplicity)

For(I,4,5
det(0,I,"A
End
1→L:1→P:"→Str1 //Don't do a space, just keep the string null. Initialize L (lines of the program) and P (line Y position)
Repeat K=22 //Change the exit key from ENTER to MODE, Loop 1
det(5,"A",P //Read line P from program A
If Ans=".NULLINE" or Ans=".NULLSTR //If the line is null, instead of displaying the error display a space instead
" //One Space
Output(P,1,Ans
Repeat max(K={22,105,25,34,45,23 //Loop 2
" 
If length(Str1:Str1
Output(P,1,Ans
Output(P,1+length(Str1),"| //The cursor along with a space after it
Repeat Ans //Loop 3
getKey→K
End //End of Loop 3
If Ans>40 and Ans<94 and 16>length(Str1):Then //16 if you're on monochrome, 26 if you're on color
sub("ABC DEFGHIJKLMNOPQRSTUVWXYZ",Ans-20-5int(.1Ans),1
If length(Str1
Str1+Ans→Str1
If not(length(Str1
Ans→Str1
End
End //End of Loop 2
If K=23 and 1<length(Str1 //Delete character for the string 
Then
If 1=length(Str1
"→Str1
If 1<length(Str1
sub(Str1,1,length(Str1)-1→Str1 //No need to add a space for the text because the space after the cursor takes care of that
End
If K=45:Then //Clear the string
"→Str1
For(J,1,16
Output(P,J," //One space
End
End
If K=105:Then //Create a new line below the current line, not 100% sure if this is valid
det(6,"A",det(17,"3F"),P //Write the new line character at P so it makes a new line below
End
If max(K={25,34:Then
If length(Str1
det(8,"A",Str1,P
" //One space
If length(Str1
Str1+" //One space after
Output(P,1,Ans
max(1,min(L,P+(K=34)-(K=25→P
End
End //End of Loop 1

After the program ends, everything you edited is stored into Program A. It might not be perfect because I coded this from memory. This program is assuming you're using a monochrome calculator with Celtic III, but if you're using a color calculator with Celtic II CSE or Celtic CE then let me know so I can revise it.

However this program is a multi-line editing routine, however it is a simple program and only handles 8 lines of text. Anything more it will throw an error. Hopefully this is something you're looking for!
This program isn't really simple, but it gets the job done. You could do this without libraries but it would be much more complex and harder to understand.


Naga-Userbar.png

by naga_serpentis naga_serpentis , 04 Apr 2024 07:24
/forum/t-16755651/multi-line-custom-text-input#post-
Click here to edit contents of this page.
Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.
Append content without editing the whole page source.
Check out how this page has evolved in the past.
If you want to discuss contents of this page - this is the easiest way to do it.
View and manage file attachments for this page.
A few useful tools to manage this Site.
Change the name (also URL address, possibly the category) of the page.
View wiki source for this page without editing.
View/set parent page (used for creating breadcrumbs and structured layout).
Notify administrators if there is objectionable content in this page.
Something does not work as expected? Find out what you can do.
General Wikidot.com documentation and help section.
Wikidot.com Terms of Service - what you can, what you should not etc.
Wikidot.com Privacy Policy.

AltStyle によって変換されたページ (->オリジナル) /