Will you be allowing lowercase typing, or just keeping it in uppercase?
Haobo wrote:
Will you be allowing lowercase typing, or just keeping it in uppercase?

Lowercase and Uppercase. I already put lowercase on my calculator, and it wasn't hard to do. You just need to run a hex code, then you're done. I'll probably include the program with the hex code in it just for those who don't have lowercase enabled yet. However, since the text you are inputting will be taken from a "vocab" string, you may not even have to run the hex code, since the lowercase will be included in the vocab. Not sure, though.
I wanted to see what I could do with DoorsCSE8 and the Hybrid libraries attached. I opted to stick with the homescreen for simplicity's sake as well as time. This could be prettier with xLib. This uses the variables A, K ,θ, Str9, and Str0. I assume the same could be done with DoorsCS7.



Here is the code.


Code:
"rowSwap(NOTESVAR→Str0
det(8
If Str9="..P:NT:FN":det(4
1→θ
Lbl AA
Menu("    NOTES    ","VIEW/EDIT",A,"DELETE ALL",B,"HELP",C,"QUIT",D
Lbl A
ClrHome
"rowSwap(NOTESVAR→Str0
Repeat K=45
  Output(1,1,"NOTES PROGRAM
  For(A,1,9
    A:det(0
    If 23<length(Str9:sub(Str9,1,23)+"…"→Str9
    If Str9="..NULLSTR":Then
      " →Str9
      A:det(2
    End
    Output(1+A,2,":
    Output(1+A,3,Str9
  End
  Output(1+θ,1,"►
  Repeat max(K={105,21,45
    Repeat Ans:getKey→K:End
    Output(1+θ,1,"
    θ-(Ans=25 and θ>1)+(Ans=34 and θ<9)→θ
    Output(1+θ,1,"►
  End
  If K=105 or K=21:Then
    ClrHome
    Output(1,1,"NOTE
    Output(1,6,θ
    Output(1,8,"| 2ND-EDIT
    det(0
    Output(2,1,Str9
    Repeat max(Ans={21,45,105:getKey→K:End
    If K=21:Then
      Input "NEW NOTE:",Str9
      θ:det(1
    End
End
Goto AA

Lbl B
"rowSwap(NOTESVAR→Str0
Disp "DELETING ALL NOTES
det(6
Goto D
Lbl C
ClrHome
Output(2,1,"PRESS 2ND OR ENTER TO SELECT NOTE
Output(4,1,"PRESS 2ND WHILE VIEWING NOTE TO EDIT
Output(6,1,"PRESS ENTER OR CLEAR WHILE VIEWING NOTE TO EXIT
Pause
Goto AA
Lbl D
Electro: That looks pretty amazing. Some day I may start learning about libraries and DCS and stuff, but for now I'm going to keep my program in basic. Nice job though.

Btw, I finished my title loading code. All the sub() and inString() stuff may be a bit confusing at a glance, but it works. It just sorts out the notes and markers, only leaving the titles left to display.

Code:

:1->B
:For(A,1,6
:If |LTIBN(A
:Then
:Text(8A+4,37,sub(Str1,inString(Str1,"x̄T",B)+2,inString(Str1,"x̄N",B)-(2+inString(Str1,"x̄T",B
:2+inString(Str1,"x̄E",B)->B
:End:End

If you can't tell, "x̄" isn't actually the letter x. "x̄" is the x-bar (the x with the line over it) in the statistics variables. x̄T represents title, x̄N represents note, and x̄E represents end of note. they are not actually displayed on the screen, they are just used as delimiters.

Anyways, for example, if you do the following code, then "HELLO" will be displayed as the first note title, and "YO DAWG" will be displayed as the second note title. You can repeat this code structure for however long you want (as long as you have RAM left).

Code:

"x̄THELLOx̄NNOTENOTENOTEx̄Ex̄TYO DAWGx̄NYO DAWG THIS IS A NOTEx̄E"->Str1

Of course, in the real program, it will automatically insert the markers, and it will only ask you for the fillers (the titles and the notes). You wouldn't have to input it like this. When entering editing mode, recalling a note will have a similar code to the one above.

Also, the current code doesn't limit title size, however in the real program you won't be able to enter a title that long (probably, not sure).
----------------------------------------------------------------
Haobo wrote:
There would be a way to group the strings together, but there wouldn't be a way to archive them individually.

Technically, I could archive them individually by storing the substring of the main string into a different string, and archiving that, but because that uses up another string and because I am limited to only 10 strings, I will only make it possible to archive/unarchive all strings. Also, because you can't find what is inside a string when it is archived, I will make it so that it stores a value of 2 in the entire list when you archive all, and then on the menu it will display something like "*ARCHIVED*". If the note your cursor is on is archived when you press enter, it will simply do nothing(because that note has a value of 2 in the list).

DELETING individual notes will be probably be possible, however. To do this, what I am thinking of doing is combining the substring of all the notes before the note you want to delete with the substring of all the notes after the note you want to delete, and storing that in the main string. That way, the note you want to delete is simply eliminated.

Please let me know what you think of this Smile

Also, I've gotten a lot of progress done on the main program, so I might post an update on it after I get a bit more progress done. I've just started programming the text inputting/editing.

EDIT: For the clipboard(for copying/pasting), I'm thinking about using another string to keep it simple, but I was also thinking that it might just be possible to add it to the beginning of the main string(**clipboard**+Str1->Str1) which I'll probably do. nevermind Razz Btw, I am intending for it to be possible to copy part of a note to a different note.
What you could try to do is in the beginning of your program, have the string be unarchived, copy the storing string, let's say its str0, store that to str1 or something, do whatever you want to str1, and when you exit the program, or choose when to save it, unarchive str0 again and copy back str1 to str0. This way, the strings, as long as no one deletes it, will always stay archived, but still easily accessible.
or something like this is more understandable:

Code:
UnArchive Str0
Str0->Str1
Archive Str0
...code here...
UnArchive Str0
Str1->Str0
Archive Str0
Could you use Ans for copy/paste? You wouldn't have to delete any variables
haobo: i kind of see what you mean, but not quite. what would be the point of doing that? also, i've been thinking, and i've decided to not include manual archiving/unarchiving (from within the program). instead, i'm going to just have it so the program unarchives your notes when you use the program, and then it re-archives them after you're done.

unicorn: nah, that might be a bit too risky, especially because I was also thinking that it would be cool to be able to copy something from one note and paste it to a different note. thanks for the suggestion though.
Well, it's also kind of like the manual archiving and unarchive, just safer but less efficient in speed. Mostly though, I use it for Axe programs, because it's simpler, but the same idea can be applied to Basic.
By getting a copy of the string, you modify the changed string so that if they exit the program and then clear the RAM, the string would still be saved. Or if it crashes.
Really, not many uses in Basic, but for Axe, which crashes with even a tiny error, you don't want to lose your data if it does happen. I mean, it could be useful, it's practically the same as just unarchiving once at the start, archiving at the end, but instead unarchiving, archiving, unarchiving, and archiving to keep changes consistent. This would be a little safer for the program but slower at the save points.
But still, shouldn't be needed because basic doesn't delete the RAM if it crashes.
New Update!!
I've gotten a lot of stuff done, so here's a gif of the current program:

As you can see, the program stops after you input a title, but that's just because I haven't programmed note editing yet. Also, you can currently only do 6 notes, but that's because I haven't made it possible to scroll through all of your notes yet. There is also a space between the line and the note title, and that's because that space will later be filled with a scrollbar (or something of the like).

Removed:
-archiving from within the program (i will make it so that the list and the string automatically get unarchived/archived)

Still not added:
-Note editing
-Deleting individual notes
-scrolling through all of your notes (you can only do 6 notes as of right now)
----------------------------------------------------------
If anyone can optimize the current code, please do. I know that the title input is a little bit slow, so if anyone wants to optimize that code specifically then please do. The code is kind of a bit spaghetti, not because there are labels and gotos, but because there are so many loops (and thus, so many ends). Indents for clarity.

Code:

CoordOff:GridOff:AxesOff
0->Xmin:1->DeltaX
0->Ymin:1->DeltaY
SetUpEditor TIBN
If not(dim(|LTIBN:Then
 " ->Str9
 6->dim(|LTIBN
End
UnArchive Str9
Repeat Z!=33
 DelVar ZClrDraw
 Horizontal 52
 Horizontal 51
 Text(~1,1,1,"BasicNote
 StorePic 1
 Text(~1,1,32,"Note
 RecallPic 1
 For(A,3,50,8
  Horizontal A
 End
 DelVar Pic1Line(35,4,35,50
 Line(94,4,94,50
 Line(0,4,0,50
 Text(12,2,"NEW NOTE
 Text(20,2,"DEL ALL
 1->B
 For(A,1,dim(|LTIBN))
  If |LTIBN(A:Then
   Text(8A+4,41,sub(Str9,inString(Str9,"[xhat]T",B)+3,inString(Str9,"[xhat]N",B)-(3+inString(Str9,"[xhat]T",B
   2+inString(Str9,"[xhat]E",B)->B
  End
 End
 12->A:31->B
 Repeat K=45 or Z=33 or (B=87 and |LTIBN(A/4-F)) or (A=12 and B=31
  Repeat sum(K=45,105
   getKey->K
   Text(A,B,"+
   If K:Then
    Text(A,B,"   
    A+8(K=34)(A<20)(B=31)-8(K=25)(A>12)+8(K=34)(B=87)(A<52)-(A-20)(K=24)(A>12->A
    B+56(K=26)(B=31)-56(K=24)(B=87->B
   End
   round(A/7.5,0->F
   Text(A,B,"+
  End
  If K=105:Then
   StorePic 1
   If B=31 or (B=87 and |LTIBN(A/4-F:Then
    For(I,12,58,8
     Text(~1,I,0,"               
    End
    If B=31:Then
     If A=12:Then
      1->E
      If 1<dim(|LTIBN:Then
       For(I,1,dim(|LTIBN
        If |LTIBN(I
        2+inString(Str9,"[xhat]T",E->E
        If not(|LTIBN(I
        dim(|LTIBN->I
       End
      End
      Str9+"[xhat]T ->Str9
      Text(12,1,"Title:[
      Text(12,66,"]
      Repeat K=105 and 1<length(sub(Str9,2+inString(Str9,"[xhat]T",E),length(Str9)-(1+inString(Str9,"[xhat]T",E
       Repeat (K>40 and K<105 and K!=44 and K!=45 and K!=95) or K=105 or K=23
        getKey->K
       End
       If K=23:Then
        If "[xhat]T"!=sub(Str9,length(Str9)-2,2
        sub(Str9,1,length(Str9)-1->Str9
        If "[xhat]T"=sub(Str9,length(Str9)-2,2
        sub(Str9,1,length(Str9)-1)+" ->Str9
        Text(12,21,sub(Str9,2+inString(Str9,"[xhat]T",E),length(Str9)-(1+inString(Str9,"[xhat]T",E)))+"   
       End
       If K!=23:Then
        K-20-5int(.1K
        If 0<Ans and Ans<35 and 12>length(sub(Str9,2+inString(Str9,"[xhat]T",E),length(Str9)-(1+inString(Str9,"[xhat]T",E
        Str9+sub("ABC  DEFGHIJKLMNOPQRSTUVWXYZtheta   :?",Ans,1->Str9
       End
       Text(12,21,sub(Str9,2+inString(Str9,"[xhat]T",E),length(Str9)-(1+inString(Str9,"[xhat]T",E
      End
      Str9+"[xhat]N[xhat]E->Str9
      For(I,1,dim(|LTIBN))
       If not(|LTIBN(I:Then
        1->|LTIBN(I
        dim(|LTIBN->I
       End
      End
     End
     If A=20:Then
      Text(~1,13,1,"DEL ALL NOTES?
      Text(~1,23,13,"CANCEL
      Text(~1,33,13,"DELETE
      23->Z
      Repeat K=105
       getKey->K
       Text(~1,Z,1,">
       If K:Then
        Text(~1,Z,1,"
        Z+10(K=34)(Z=23)-10(K=25)(Z=33->Z
       End
      End
      If Z=33:Then
       " ->Str9
       Fill(0,|LTIBN
       Text(~1,43,1,"DELETED
       rand(35
      End
      If Z=23:Then
       ClrDraw
       RecallPic 1
      End
     End
    End
    DelVar K
    If B=87:Then
     1->D
     If A!=12:Then
      For(E,1,(A/4-F)-1)
       If |LTIBN(E
       2+inString(Str9,"[xhat]E",D->D
      End
     End
     Text(12,1,sub(Str9,inString(Str9,"[xhat]T",D)+2,inString(Str9,"[xhat]N",D)-(2+inString(Str9,"[xhat]T",D
    End
   End
  End
 End
End
If K!=45:Pause
DelVar Pic1ClrDraw
ClrHome

Note, I am kind of using source coder notation here, so [xhat] on a calculator would look like the x with a line over it (x-bar), in the stat vars.

EDIT: For those wanting a direct link to the current program, you can find it here.

Also, some known bugs:
-if |LTIBN exists but str9 doesn't exist, it results in ERR:UNDEFINED
-if |LTIBN doesn't exist but str9 exists and is archived, it results in ERR:ARCHIVED
if anyone has something to add to this list, tell me Smile

If anyone has some ways to make this faster/more efficient (other than not using pure BASIC), please post about it Wink Also feel free to tell me if you have any suggestions
this post took a while to make :/
This really looks like a great program! I wish you were on the CSE so I could use it too! Smile
poke

If anyone can optimize at least some of this code, it would be greatly appreciated. I'm not asking anyone to optimize everything, but if you feel there are certain spots that can be optimized for memory and/or speed, then please do Smile
I suggested on SAX that the getKeys should be in tight loops.

For example, this code

Code:
Repeat K=105
  getKey→K
  Text(⁻1,Z,1,">
  If K:Then
    Text(⁻1,Z,1,"
    Z+10(K=34)(Z=23)-10(K=25)(Z=33→Z
  End
End

can be

Code:
Repeat K=105
  Text(⁻1,Z,1,">
  Repeat Ans={25,34,105
    getKey→K
  End 
  Z+10((Ans=34)(Z=23)-(Ans=25)(Z=33→Z
  Text(⁻1,Z,1,"
End

The same can be done for the main title selection code.

Check to see if some of your algebra can be simplified.

Code:
For(E,1,(A/4-F)-1)

can be

Code:
For(E,1,A/4-F-1


Try to use the Ans token whenver possible:

Code:
Repeat (K>40 and K<105 and K!=44 and K!=45 and K!=95) or K=105 or K=23
getKey->K
End

can be

Code:
Repeat Ans>40 and Ans<105 and Ans!=44 and Ans!=45 and Ans!=95 or Ans=105 or Ans=23
getKey->K
End


You can omit the parentheses of For() loops if they have an If:Then:End statement within them. You want to avoid the omission of the ending parentheses if you only have an If statement.

DWMelon wrote:
This really looks like a great program! I wish you were on the CSE so I could use it too! Smile

This can definitely be done. Only the graphics need to be changed to fit the TI-84+CSE graphscreen. Check out this topic on how to create cross-compatible programs. In addition, both this and this are cross-compatible programs you can look at by yours truly.
Thanks electro!

Btw, does anyone have any suggestions on how to fix the current bugs that I mentioned in the new update post?
I'm happy this is pure basic, so that if TI decides not to release the signing key for the 2048 bit (gosh!) encryption for the TI-84+ CE, it can still be usable. Smile
xXEllesarXx, this program is only for the monochrome calculators (83+ 84+) so it will not be able to run on the color calculators.
Any chance it will be recreated for the CSE/CE?
solarsoftware wrote:
Any chance it will be recreated for the CSE/CE?

If I win a CE then probably. Or someone else could make it for the color calculators, after I finish it. It's really not that hard to port monochrome projects to the color calcs.

EDIT: just a note, I am trying to use some of the code from this page. Of course, I am modifying it a bit. I am going to be including functions such as copy, paste, and possibly cut, backspace, flashing cursor, and of course some of the obvious functions like typing and text-wrapping (if you have any suggestions on text-wrapping, please tell me). I may also add backspacing entire words at once, which if I can get some of the other things down then that shouldn't be too hard. Also, for backspacing, if there is text in front of your cursor, then the entire thing would need to be moved (possibly), but that would (probably) take longer than a second. If you were backspacing on one line and the next line had a word, then what would probably be easiest to do is not have the word on the next line move back to the previous line until there is enough space for it. Of course, this all requires some sort of text-wrapper. Currently, the title input is not graphical detection, but instead it is just a character limit. So if I were to put in a bunch of colons for ex., I would only be able to reach half of the space between the open bracket and the closing bracket, as the limit is 11 characters. If you have suggestions to improve this for the note editing, please do.

Any and all suggestions are greatly appreciated.
Nice work thus far Michael! Smile I have a couple of suggestions; take them with a grain of salt though because they kind of mess up some things... Razz

So one thing that I might recommend is to avoid the use of a list in this case to store the locations of each note, but that's just me. In addition, it might also be easier to use a single character delimiter, as it makes searching and replacing a tad easier. For instance, say you have a string like this:


Code:
"xNOTE1xTEXT1xNOTE2xTEXT2x->Str1


To print the note data in note N, you can do:

Code:
2->N:1
For(X,2,2N
inString(Str1,"x",Ans+1
End:Ans+1
Disp sub(Str1,Ans,inString(Str1,"x",Ans)-Ans

To print the note title of note N, you can just change the 1 to a 0:

Code:
2->N:0
For(X,2,2N
inString(Str1,"x",Ans+1
End:Ans+1
Disp sub(Str1,Ans,inString(Str1,"x",Ans)-Ans

To display the titles of all the notes, you can simply do this:

Code:
1
While Ans!=length(Str1
Ans+1
Disp sub(Str1,Ans,inString(Str1,"x",Ans)-Ans
inString(Str1,"x",1+inString(Str1,"x",Ans
End


As for deletion of notes, one interesting way to think about it is to not leave the string as-is, but rather to add padding on the start and end of the string while deleting an element. This is to prevent having to deal with the three different cases of having the note be at the start, body, or end. This way it can be done relatively easily:
(Sorry, my 1-line solution actually needed to do some bounds checking. Razz)

Code:
"x"+Str1+"x"->Str1
1:For(X,2,2N
inString(Str1,"x",Ans+1
End:Ans->D
inString(Str1,"x",1+inString(Str1,"x",Ans+1
sub(Str1,1,D)+sub(Str1,Ans+1,length(Str1)-Ans
sub(Ans,2,length(Ans)-2->Str1
Disp Str1


In addition, this means that if you have one note and you use this to delete it, "x" will then be stored in Str1. This is very useful, because now you can check to see if you have an empty list, plus it will still work when displaying the titles. Everything sorta takes care of itself. Razz

As for the issue of backspacing, one way that I went about it is to delete the character, but not redraw everything afterwords, until a button was pressed by the user. It didn't really look too funny, or you could always just do it by redrawing everything after, which isn't too slow really.

OOOAs for text wrapping and character spacing, it might be easier to just let all characters be 5 (or 4?) pixels in width, that way no crazy time-consuming calculations have to take place. Just an idea. Otherwise you may be able to have a list of certain character widths, of pxl-Test(), but that would cause a lot of overhead.

Great work so far on this, and hope this helps a little! Smile

EDIT: Oh yeah, and I was supposed to suggest how to speed up the input loop... Oh well, I'll write that in a bit. Razz
Thanks Mateo, I will probably try to implement some of your ideas if I can Smile

Btw, what would you guys suggest for text highlighting? I mean, obviously you would have 2 For() loops with a pxl-change, but what would you do for the varying text widths?

--What I was thinking is that maybe the pxl-Test() values for each of the pixels in a column could be stored in a list, and if they were all 0 (if they were all changed to the ON-state afterwards) then the for loop would stop.
--Another of my ideas was to have the width of all the characters stored somewhere somehow. Probably, only the characters that are not 3 pixels wide like most of the characters would be stored somewhere to tell the calculator to do a different width other than 3.
I'm definitely not the best CSE Ti-Basic programmer here, but if no one else volunteers to port this to the CSE, I could do that. Of course, I would port it when it's finished.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
» View previous topic :: View next topic  
Page 2 of 9
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement