LoginLogin

note editor

Root / Programming Questions / [.]

A2D_appsCreated:
How do I make a note editor for smilebasic. I'm a noob. It's going in basic os 1.4

INKEY$() and file functions are going to be your best friends. Luckily, since SmileBASIC has file functions, it is fairly easy to load and save. Then you have to have a main loop getting the INKEY$() and using it to see if it needs to enter a character, delete the previous character (if INKEY$()==CHR$(8)), or enter a new line (IF INKEY$==CHR$(13)). Then, you need to use MID$ to decide what to display on the screen. Hopefully this helps, even if you only get a little bit of it, it's not my style of teaching to tell someone exactly how to do something.

Um yea can you just type the actual code here pls? I'm confused lol

I'm not even sure what you mean by note editor. Do you mean a program where you can create and save short notes, like Notepad, or do you mean a program for editing musical notes in an MML string/file? Either way, this is a pretty tall order, a big question that might be broader than one forum thread. Sort of like asking how to build a house. You need to know what materials to buy, and have a permit to build residential on the land, and how to construct the framework, and lay drywall and insulation, and run electricity...

Just a simple txt editor. Edit it in app. Surly not that big

You can help yourself by giving at least as much attention and thought to your questions, as you expect from the answers. It'll cut back on the amount of exchanges needed in understanding what you want. Asking for people to give you code examples is fine, but it might be premature at this point, as it's unclear what you need Creating a text editor isn't as simple as it sounds. Try thinking about the core features your editor will need and how a user will interact. Will it automatically word wrap? Are you planning on being able to use a search function? Text highlighting? Copy and Paste? Syntax highlighting? Do you want to save txt files and be able to load them too? Are you going to use keyboard input like the SB editor (you'll have to roll your own)? There's plenty of questions that come up once you start brainstorming what you want from your application. The more details, the better, and honestly, if people see that you are excited or at least invested in the problem you are trying to solve and have given it some thought, they'll be happy to help you.

As glennxserge said, you need to think on the feature that you want in your text editor. Anyway, I made a text editor using gputchar in my MML Editor. This are the features that it have. -Text wrapping. -Copy paste(It also have cut function but I haven't added a button for that). -Text scrolling -Highlight cursor position. -Save/Load.(This is actually outside of the scope of my text editor code). -It use SB key input I have the same editor(or widget) in a UI library that I've been making to behave like android views. I can upload the uncompiled code of my library if you want but it doesn't have much commentaries.

Well I wasn't looking for all that. You load a txt file, you delete/add to it. Save it. Its edited. Example: editing a high score on a game. Or taking notes for later. Nothing too complicated

None of that is too complex for what you should imagine you're getting into when you make a text editor. You can remove maybe 1 or 2 things, like say you want to get rid of copy/paste and text scrolling (though you really shouldn't remove text scrolling). You could, but the general idea is still the same.

It sounds like you want the absolute bare minimum for a text editor, which would essentially be a string editor, just displaying a string and allowing users to add or erase from the end of it. The absolute bare minimum, if you just want note-taking with a string, would be this: - load the note string, if there is an existing one - label to return here - clear the screen - print the string to the screen - loop on INKEY$ until it's not just "" (which means the user isn't pressing any button on the keyboard) - when the user presses a button, check it to see if it's valid text input like a letter, number, punctuation etc. - if so, string = string + new character, and go back to the starting label - if the button they pushed is backspace, erase a character from the end of the string and go back to the starting label - if they pushed certain things like escape, save the string and exit this part of the program Of course, this doesn't allow someone to move a cursor backwards through the text and insert characters anywhere, and you won't be able to fully read strings that end up longer than can fit on the screen, and no features at all...but this is bare bones note-taking.

Ughhhh nevermind

How do I delete this thread

You can't. Someone else might find some helpful information in it.

How do I make a note editor for smilebasic. I'm a noob. It's going in basic os 1.4
Um yea can you just type the actual code here pls? I'm confused lol
Just a simple txt editor. Edit it in app. Surly not that big
I figured out the typing part about a month ago. (Only it types with the graphics screen!) But I did not make the saving part yet/Don't know how to.
ACLS:X=0:Y=0
@LOOP
 KEY$=INKEY$()
 IF KEY$!="" THEN
  IF LASTKEY$==KEY$ THEN
   WAITTM=2
   ELSE
   WAITTM=0
  ENDIF
  GPUTCHR X,Y,KEY$,1,1,#WHITE
  INC X,8
  IF X==50*8 THEN INC Y,8:X=0
  'WIP, Does not work: IF Y==29*8 THEN
  'WIP, Does not work:  GCOPY 0,0,399,239,0,Y-8,TRUE
  'WIP, Does not work: ENDIF
  LASTKEY$=KEY$
  WAIT WAITTM
 ENDIF
GOTO @LOOP
'WAITTM Puts the speed of typing in sync with the keyboard sounds.

How do I make a note editor for smilebasic. I'm a noob. It's going in basic os 1.4
Um yea can you just type the actual code here pls? I'm confused lol
Just a simple txt editor. Edit it in app. Surly not that big
I figured out the typing part about a month ago. (Only it types with the graphics screen!) But I did not make the saving part yet/Don't know how to.
ACLS:X=0:Y=0
@LOOP
 KEY$=INKEY$()
 IF KEY$!="" THEN
  IF LASTKEY$==KEY$ THEN
   WAITTM=2
   ELSE
   WAITTM=0
  ENDIF
  GPUTCHR X,Y,KEY$,1,1,#WHITE
  INC X,8
  IF X==50*8 THEN INC Y,8:X=0
  'WIP, Does not work: IF Y==29*8 THEN
  'WIP, Does not work:  GCOPY 0,0,399,239,0,Y-8,TRUE
  'WIP, Does not work: ENDIF
  LASTKEY$=KEY$
  WAIT WAITTM
 ENDIF
GOTO @LOOP
'WAITTM Puts the speed of typing in sync with the keyboard sounds.
heres a type and save. build on this pls
linput"note here>",s$
save"txt:example",s$
well... i think :)

heres a type and save. build on this pls
linput"note here>",s$
save"txt:example",s$
well... i think :)
Yeah I wasn't going to do that because this was just a test note thing for an os I'm making (100% in the GRP pages!) and if I were to press enter to make a new line, I might have to use some character like a ` or something so when the program reads the ` then it makes a new line. And guess what? You just helped me get an idea of how to do it! >:D By using a for loop and looking for ` or another character (I forgot the command I'm not on my DS rn) it can make a new line! Oh, and it can be window compatible! Thanks for reminding me of TXTs. The way to separate TXTs into different strings/lines that I just described is similar to how people did stuff like that in PTC.

yea im not going to use this thread anymore