SB Notes V1.1

Post Reply
User avatar
rbytes
Posts: 1552
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 6
iPad 4
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

SB Notes V1.1

Post by rbytes » Sun Apr 15, 2018 1:24 am

This update adds a lot of features. You can create notes and emails using rich text (bold, italics, underline, colored text, a variety of font faces, and much more).

I started out creating a notepad. I wanted to be able to print my notes using ePrint. I discovered that by using mailto: in an SB browser window, I could send my notes to the iOS Mail app and all the rich text features would display! That was a surprise, and a huge bonus! The first screen shot below shows the Mail editing window after I sent my note to it from SB Notes using a mailto: tag.

I added a steampunk image as a background. The image "steam.JPG" is attached. Box changed the extender to uppercase! It should be renamed "steam.jpg" (all lowercase) and located in a folder named SB Notes at the same location as the program. (The program should NOT go inside the folder!)

For now I am just posting the necessary files, but I will eventually share several dozen tutorial examples I have made, showing each HTML effect separately.

The ePrint address is not mine - I created a fake one using random characters so my printer doesn't receive unsolicited jobs! :lol:

THE EXAMPLE FILE: should be named 'example.sn' and saved in the folder named SB Notes. (along with the background image)

Code: Select all

"ekvo21alxr817@hpeprint.com"
"Note Example"
"<marquee behavior='scroll' direction='left'>✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨</marquee> <font size=+1>This is a sample note edited in SB Notes. It can be saved, loaded, modified and emailed to a person or an ePrint printer.</font><marquee behavior='scroll' direction='right'> ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨ </marquee>You can surround items with a marquee to draw attention to them. Any character or emoji may be used in the marquee.<br><br>You can use html tags such as <b>bold</b>, <i>italics</i> or <u>underline</u>. How about <big>Big Text </big>or <small>Small text?</small> <font color=red>Colored text </font><font color=chartreuse> is nice. </font> <font color=lightseagreen>How </font><font color=orange>many </font><font color=blue>colors </font> <font color=gold>are </font> <font color=cyan>available? </font><font color=magenta> Hundreds, </font><font color=purple>actually.</font><br>You can make <font size=+1>words </font><font size=+2>larger </font><font size=+3>and </font><font size=+4>larger</font>, or <font size=-1>smaller </font><font size=-2>and </font><font size=-3>smaller</font>. HTML will ignore line feeds, so use the <Ьr> tag instead.<br><font face='Chalkduster, Arial, Helvetica, sans-serif'><br>You can use a font face of your choice.</FONT><br>⌛ Emoji are allowed, and you can show them in various sizes! <FONT SIZE=+4>⌛</FONT><br><br>Horizontal rules (lines) can be inserted.<hr><br>Text can be <mark>marked (highlighted)</mark>.<br><br>You can create unordered lists (with a choice of 4 bullet styles) <ul style='list-style-type:square'><li>dogs</li><li>cats</li><li>hamsters</li></ul>or ordered lists (with 5 different looks)<ol type='I'><li>cheese</li><li>ham</li><li>bread</li></ol>You can create a progress meter such as Witticism Loading.. <meter MIN='0' max='100' value='50'>50%</meter><br><br>A quotation can be used:<br><q>I have a dream.</q><br> <br>You can designate a special format for computer code. It look like this: <br><br><samp>OPTION SPRITE POS NORMAL<br>GET SCREEN SIZE sw,sh</samp><p>You can create a table to display information:<br><br><table border='1'><caption>A Simple Table</caption><tr><td>Left cell</td><td>Middle cell</td><td>Right cell</td></tr><td>Left cell</td><td>Middle cell</td><td>Right cell</td></tr></table></p> You can offer a 'Click for more information' feature:<details><summary>Click to open</summary><p><hr>If your mail reader supports the details tag, you should now see this more detailed text.<hr></p></details><br>You can give your reader a challenge to read backward text:<br><bdo dir='rtl'>Note that there is no autocorrect function when editing in Smart Basic.</bdo><br><br>Just be sure to give the translation:<br>Note that there is no autocorrect function when editing in Smart Basic.
<br><br>
However once the message is exported into Mail, spelling mistakes will be highlighted WITH a dotted red underline. IF you click ON them, you will be offered one OR sometimes several choices of correctly-spelled words."

THE PROGRAM: should be located with, but not in, the folder!

Code: Select all

/*
SB Notes V1.1
by rbytes, April 2018

V1.1
- SB Notes turned out to be a great email editor. Email is based on HTML, so by using tags, you can create all sorts of effects - lists, colored text, text size changes, even tables. But tags can not be used directly in the iOS Mail editor. They can be used in SB Notes, and the entire note can be sent to Mail with a mailto:[address] link.

- I added two lists. The one on the left gives a selection of email addresses.
The one on the right allows insertion of a wide assortment of html tags.

- Implemented file loading and saving, and created some tutorials.

- Added html view as well as edit view.

V1.0
I decided to make myself a notepad program. My HP OfficeJet Pro 8610 printer
has a feature I really appreciate. I can send an email to a HP eprint
address which then forwards just the body text to my printer, not the sender, date, subject, etc.
*/

lin$="%0A"    ' This is a line feed in html

'detect device
IF LOWSTR$(DEVICE_TYPE$())="ipad" THEN
  dev=1
ELSE
  dev=0
END IF

OPTION SCREENLOCK OFF
SET TOOLBAR OFF
OPTION BASE 1
SET ORIENTATION LANDSCAPE
SET BUTTONS CUSTOM
SET LISTS FONT NAME "Arial"
laun$=LAUNCHER$ ()
path$="SB Notes/"
GET SCREEN SIZE sw,sh
/* for iPhone testing
sw=568
sh=320*/
rw=sw/1024!rh=sh/768
SET LISTS FONT SIZE 18*rw
PAGE "main" FRAME 0,0,sw,sh
PAGE "main" SET
PAGE "main" SHOW

'init screen
GRAPHICS
GRAPHICS CLEAR .7,.7,.7
DRAW COLOR 0,0,0
DRAW ALPHA .3
DRAW IMAGE "SB Notes/steam.jpg" AT 0,0 SCALE .6
DRAW ALPHA 1
SPRITE "appname" BEGIN 200*rw,50*rh
GRAPHICS CLEAR
DRAW FONT NAME "Chalkduster"
DRAW FONT SIZE 36*rw
DRAW TEXT "S" AT 0,0
DRAW TEXT "B NOTES" AT 22*rw,0
SPRITE "appname" END
SPRITE "appname" AT 410*rw,30*rh
SPRITE "appname" SHOW
DRAW FONT SIZE 20*rw
DRAW FONT NAME "Arial"
fldn$="title"
fldn2$="body"
fldn3$="email"

' create lists
'r'
' addr (address) list content
' put your email addresses in this list, separated by commas
list1$="ekvo21alxr817@hpeprint.com|name1@hotmail.com|name2@hotmail.com"
SPLIT list1$ TO lm$,N WITH "|"
txt3$=lm$(1)
''
'c'
' tags list content
list2$="<a href='http://www.apple.com'>,</a>,<b>,</b>,<bdo dir='rtl'>,</bdo>,<big>,</big>,<br>,<caption>,</caption>,<center>,</center>,<details>,</details>,&ensp;,&emsp;,<font color=',red'>,orange'>,gold'>,green'>,cyan'>,blue'>,magenta'>,<font size=',12'>,16'>,20'>,<font face=',arial'>,chalkduster'>,courier'>,</font>,<H1>,</H1>,<H2>,</H2>,<H3>,</H3>,<H4>,</H4>,<H5>,</H5>,<H6>,</H6>,<hr>,<i>,</i>,<mark>,</mark>,<marquee>,</marquee>,<meter min='0' max='100' value='50'>,</meter>,&nbsp;,<ol>,type=',1',A',a',I',i',</ol>,<li>,</li>,<p>,</p>,<pre>,</pre>,<q>,</q>,<s>,</s>,<small>,</small>,<table border='1'>,</table>,<td>,</td>,<tr>,</tr>,<textarea color:'red'>,</textarea>,<u>,</u>,<ul>,style='list-style-type:,disc',circle',square',none',</ul>,"
SPLIT list2$ TO lm2$,N WITH ","
''
LIST "addr" TEXT lm$ AT 20*rw,190*rh SIZE 180*rw,450*rh
LIST "tags" TEXT lm2$ AT 820*rw,190*rh SIZE 180*rw,450*rh

' create black frames around the lists
IF rw<1 THEN mg=1 ELSE mg=0
SPRITE "rect" BEGIN 185*rw,456*rh
GRAPHICS CLEAR
DRAW SIZE 2
DRAW RECT 1,1 TO 184*rw,454*rh
SPRITE "rect" END
SPRITE "rect" AT 18*rw-mg,188*rh-mg
SPRITE "rect" SHOW
SPRITE "rect" COPY "rect2"
SPRITE "rect2" AT 818*rw-mg,188*rh-mg
SPRITE "rect2" SHOW

GOSUB labels

' create the fields
makefld(fldn3$,"",210*rw,100*rh,320*rw,40*rh,1,20*rw,0,0,0,1,1,.8,1,0,0)  ' email
makefld(fldn$,"",540*rw,100*rh,270*rw,40*rh,1,20*rw,0,0,0,1,.9,1,1,0,0)    ' title
makefld(fldn2$,"",210*rw,186*rh,600*rw,450*rh,1,20*rw,0,0,0,.9,1,1,1,0,1) ' body

FILL COLOR .9,.9,.9

GOSUB makebuttons
GOSUB definestrings

'preload startup file
ret$=path$&"example.sn"
FILE ret$ RESET
FILE ret$ INPUT alb$
FIELD "emaila" TEXT alb$
FILE ret$ INPUT txt$
FIELD "titlea" TEXT txt$
FILE ret$ INPUT txt2$
FIELD "bodya" TEXT txt2$
BROWSER "preview" AT 210*rw,186*rh SIZE 600*rw,450*rh
GOTO setview

'main loop...
DO
  IF bp("quit") THEN 
    IF laun$="desktop" THEN
      IF FILE_EXISTS("/launch") THEN
        RUN "/-Launch.sb"
      ELSE
        EXIT
      ENDIF
    ENDIF
    END
  ENDIF
  
  IF bp("load") THEN
    PAGE "main" HIDE
    PAGE "" SET
    ret$ = file_select$(360*rw,40*rh,310*rw,260*rh,1,path$)
    IF ret$<>"" THEN
      FILE ret$ RESET
      FILE ret$ INPUT alb$
      FIELD "emaila" TEXT alb$
      FILE ret$ INPUT txt$
      FIELD "titlea" TEXT txt$
      FILE ret$ INPUT txt2$
      FIELD "bodya" TEXT txt2$
      prev$=FIELD_TEXT$("bodya")
      BROWSER "preview" TEXT prev$
    ENDIF
    DRAW ALPHA .3
    DRAW IMAGE "SB Notes/steam.jpg" AT 0,0 SCALE .6
    DRAW ALPHA 1
    GOSUB labels
    PAGE "main" SET
    PAGE "main" SHOW
  ENDIF
  
  /* You use the encoding character %0A to get a new line. For a paragraph break, put two in a row: %0A%0A.

If spaces between words are not shown properly in your browser, you can force this to happen by using  %20 for each space.*/

'shift the screen smoothly up and down (up so keyboard doesn't cover text).
  IF bp("shift") THEN
  bn
  sf=1-sf
  IF sf THEN
    FOR t=1 TO 300*rh
      PAGE "main" AT 0,-t
      PAUSE .001
    NEXT t
  ELSE
    FOR t=1 TO 300*rh
      PAGE "main" AT 0,-300+t
      PAUSE .001
    NEXT t
  ENDIF
  ENDIF

  IF bp("mail") THEN
  ' assemble a$ from the component strings
  email$=FIELD_TEXT$("emaila")
  title$=FIELD_TEXT$("titlea")
  body$=FIELD_TEXT$("bodya")
  GOSUB definestrings
  a$=a1$&a1a$&a1b$&a1c$&a2$&a3$&a4$&a5$
  BROWSER "n" AT 600*rw,660*rh SIZE 80*rw,30*rh
  BROWSER "n" TEXT a$
  BROWSER "n" SHOW
  ENDIF
  
  IF bp("save") THEN
    bn
    PAGE "main" HIDE
    PAGE "" SET
    ret$ = file_select$(360*rw,40*rh,310*rw,260*rh,2,path$)
    IF ret$<>"" THEN
      FILE ret$ DELETE
      temp$= CHR$(34)&FIELD_TEXT$("emaila")&CHR$(34)
      FILE ret$ PRINT temp$
      temp$=CHR$(34)&FIELD_TEXT$("titlea")&CHR$(34)
      FILE ret$ PRINT temp$
      temp$=CHR$(34)&FIELD_TEXT$("bodya")&CHR$(34)
      FILE ret$ PRINT temp$
    ENDIF
    DRAW ALPHA .3
    DRAW IMAGE "SB Notes/steam.jpg" AT 0,0 SCALE .6
    DRAW ALPHA 1
    GOSUB labels
    PAGE "main" SET
    PAGE "main" SHOW
  ENDIF
  
  IF bp("clear") THEN
    bn
    title$=""
    body$=""
    FIELD "titlea" TEXT title$
    FIELD "bodya" TEXT body$
    prev$=FIELD_TEXT$("bodya")
    BROWSER "preview" TEXT prev$
  ENDIF
  
  IF bp("view") THEN
    bn
    setview:
    FILL ALPHA 0
    viewer=1-viewer
    IF viewer THEN
      FIELD "body" HIDE
      FIELD "bodya" HIDE
      prev$=FIELD_TEXT$("bodya")
      BROWSER "preview" TEXT prev$
      BROWSER "preview" SHOW
      BUTTON "view" TEXT "EDIT" AT 470*rw,690*rh SIZE 100*rw,40*rh
    ELSE
      FIELD "body" SHOW
      FIELD "bodya" SHOW
      BROWSER "preview" HIDE
      BUTTON "view" TEXT "VIEW" AT 470*rw,690*rh SIZE 100*rw,40*rh
    ENDIF
    FILL ALPHA 1
  ENDIF
  
  temp=LIST_SELECTED("addr")
  IF temp <>-1 THEN
    bn
    LIST "addr" SELECT -1
    FIELD "emaila" TEXT lm$(temp)
  ENDIF
  
  temp=LIST_SELECTED("tags")
  IF temp<>-1 THEN
    bn
    body$=FIELD_TEXT$("bodya")
    loc=FIELD_CURSOR_POS ("bodya")
    temp$=LEFT$(body$,loc)
    temp2$=RIGHT$(body$,LEN(body$)-loc)
    body$=temp$&lm2$(temp)&temp2$
    LIST "tags" SELECT -1
    FIELD "bodya" TEXT body$
    FIELD "bodya" SELECT loc+LEN(lm2$(temp)),0
  ENDIF
UNTIL 0

END

DEF bn()
  BROWSER "n" HIDE
END DEF
'==========================================
'.  G O S U B S
'==========================================


'----------
makebuttons:
'----------

FILL ALPHA 0
SET BUTTONS FONT SIZE 20*rw
BUTTON "clear" TEXT "CLEAR" AT 110*rw,690*rh SIZE 100*rw,40*rh
BUTTON "load" TEXT "LOAD" AT 230*rw,690*rh SIZE 100*rw,40*rh
BUTTON "shift" TEXT "SHIFT" AT 345*rw,690*rh SIZE 100*rw,40*rh
BUTTON "view" TEXT "EDIT" AT 470*rw,690*rh SIZE 100*rw,40*rh
BUTTON "mail" TEXT "MAIL" AT 590*rw,690*rh SIZE 100*rw,40*rh
BUTTON "save" TEXT "SAVE" AT 710*rw,690*rh SIZE 100*rw,40*rh
BUTTON "quit" TEXT "QUIT" AT 830*rw,690*rh SIZE 100*rw,40*rh

FILL ALPHA 1
RETURN


'----------
definestrings:
'----------

a1$="<html><head><title>PRINT NOTE</title></head><body><a href="
a1a$=CHR$(34)&"mailto:"
a1b$=email$
a1c$="?subject="
a2$=title$&lin$&lin$   ' title field
a3$="&body="
a4$=body$              ' body field
a5$=CHR$(34)&">Confirm</a></body></html>"
RETURN


'----------
labels:
'----------

DRAW TEXT "ADDR" AT 80*rw,150*rh
DRAW TEXT "NOTE" AT 460*rw,150*rh
DRAW TEXT "TAGS" AT 880*rw,150*rh
DRAW TEXT "TO" AT 170*rw,110*rh
DRAW TEXT "SUBJECT" AT 820*rw,110*rh
RETURN
/*
Flex field function
by rbytes, January 2017
By using two fields as
one, you can independently
set rounded or square corners,
no matter what parameters
(RO, ML or none) you choose.
Yes, it seems like you need lots
of variables, but actually there are
no more than if you defined each
field with separate command lines.

Variables:
fldn$ - the name of the bottom field. The top field is named fldn$&"a"
txt$ - the text to be displayed in the top field
fx, fy - coordinates of the top left corner of both fields
fw, fh - width and height of both fields
fa - alpha setting for bottom field, sets its transparency
fs - font size, applied to the top field only
fr, fg, fb - red, green and blue values for text, applied to top field only
br, bg, bb - red, green and blue values for background, applied to bottom field
shw - 0 to hide fields, 1 to show fields
par - settings for bottom field. 0 sets rounded corners, 1 sets square corners
par2 - parameters for top field. 0 sets no parameters, 1 sets ML, 2 sets RO and 3 sets ML and RO
*/

DEF makefld(fldn$,txt$,fx,fy,fw,fh,fa,fs,fr,fg,fb,br,bg,bb,shw,par,par2)
  fldna$=fldn$&"a"!fa2=0
  IF par=0 THEN FIELD fldn$ TEXT "" AT fx,fy SIZE fw,fh
  IF par=1 THEN FIELD fldn$ TEXT "" AT fx,fy SIZE fw,fh ML
  IF par2=0 THEN FIELD fldna$ TEXT txt$ AT fx,fy SIZE fw,fh
  IF par2=1 THEN FIELD fldna$ TEXT txt$ AT fx,fy SIZE fw,fh ML
  IF par2=2 THEN FIELD fldna$ TEXT " "&txt$ AT fx,fy SIZE fw,fh RO
  IF par2=3 THEN FIELD fldna$ TEXT txt$ AT fx,fy SIZE fw,fh ML RO
  FIELD fldn$ BACK ALPHA fa!FIELD fldn$ BACK COLOR br,bg,bb
  FIELD fldna$ BACK ALPHA fa2!FIELD fldna$ FONT SIZE fs
  FIELD fldna$ FONT COLOR fr,fg,fb
  IF shw THEN!FIELD fldn$ SHOW!FIELD fldna$ SHOW!ELSE!FIELD fldn$ HIDE!FIELD fldna$ HIDE!ENDIF
ENDDEF

DEF bp(a$) = BUTTON_PRESSED(a$)

'b'
' file browser/selector            Thanks to Henko for this code
' returns selected file with path

DEF file_select$(xtop,ytop,wid,hgt,type,path$)
GRAPHICS CLEAR .7,.7,.7
'type = 1 for load, 2 for save
maxdim=500 ! SET LISTS CUSTOM
trans=0
DIM directs$(maxdim),FILES$(maxdim), combi$(2*maxdim)
FILL COLOR 1,1,1 ! DRAW COLOR 0,0,0
sw=.sw ! sh=.sh
IF type=1 THEN
  fb$="Select file"&CHR$(10)&CHR$(10)&"Click OK to load it"&CHR$(10)&CHR$(10)&"Or RENAME or DELETE it"&CHR$(10)&CHR$(10)&"Click CANCEL to escape"
ELSE
  fb$="Select or name file"&CHR$(10)&CHR$(10)&"Click OK to save it"&CHR$(10)&CHR$(10)&"Or RENAME or DELETE it"&CHR$(10)&CHR$(10)&"Click CANCEL to escape"
ENDIF
IF xtop+wid>sw-10 THEN xtop=sw-wid-10 ! xbot=xtop+wid
IF ytop+hgt>sh-10 THEN ytop=sh-hgt-10 ! ybot=ytop+hgt*1.6
SPRITE "fbrow" SCAN xtop-2,ytop-2,wid+4,hgt+4
DRAW SIZE 3 !FILL RECT xtop,ytop TO xbot,ybot*.8
DRAW RECT xtop,ytop TO xbot,ybot*.8
DRAW LINE xtop,ytop*6 TO xbot,ytop*6
DRAW FONT SIZE 22*.rw
DRAW COLOR 0,0,0
DRAW TEXT title$ AT sw*.18,ytop+sh*.116
DRAW TEXT title2$ AT sw*.18,ytop+sh*.166
DRAW TEXT title3$ AT sw*.18,ytop+sh*.216
FIELD "namer" TEXT "" AT xtop+wid*.05,ytop+hgt*1 SIZE wid*.87,hgt*.18
FIELD "namer" FONT SIZE 20*.rw
FIELD "namer" FONT NAME "Arial-BoldMT"
IF fil$="" THEN fil$=.backfil$
FIELD "namer" TEXT fil$
procnam$=fil$
FIELD "feedback" TEXT fb$ AT xtop*.4,ytop*1.6 SIZE sw*.16+2,sh*.396 RO ML
DRAW RECT xtop*.4-2,ytop*1.6-2 TO xtop*.4+sw*.16+3,ytop+hgt*.35+sh*.31
FIELD "feedback" FONT SIZE 20*.rw
FIELD "filter" TEXT "filter" AT xtop*2.005,ytop+hgt*.08 SIZE sw*.216,sh*.05
FIELD "filter" FONT SIZE 20*.rw
BUTTON "cancel" title "CANCEL" AT xtop*2,ytop+hgt*.8 SIZE sw*.1,sh*.07
BUTTON "ok" title "OK" AT xtop*2,ytop+hgt*1.05 SIZE sw*.1,sh*.07
BUTTON "back" title "BACK" AT xtop*2,ytop+hgt*.55 SIZE sw*.1,sh*.07
BUTTON "root" title "ROOT" AT xtop*2,ytop+hgt*.3 SIZE sw*.1,sh*.07
BUTTON "+dir" title "+ DIR" AT xtop*2.34,ytop+hgt*1.05 SIZE sw*.1,sh*.07
BUTTON "-dir" title "- DIR" AT xtop*2.34,ytop+hgt*.8 SIZE sw*.1,sh*.07
BUTTON "rename" title "RENAME" AT xtop*2.34,ytop+hgt*.3 SIZE sw*.1,sh*.07
BUTTON "del" title "DELETE" AT xtop*2.34,ytop+hgt*.55 SIZE sw*.1,sh*.07
BUTTON "import" TEXT "IMPORT" AT xtop*.06,ytop+hgt*.4 SIZE sw*.1,sh*.07
BUTTON "export" TEXT "EXPORT" AT xtop*.06,ytop+hgt*.65 SIZE sw*.1,sh*.07
DRAW ALPHA 1
FILL ALPHA 0
BUTTON "clrfld" TEXT CHR$(8855) AT xtop*1.77,ytop+hgt*1.02
DRAW ALPHA 1
FILL ALPHA 1
IF type=2 THEN
  filter$=""
ELSE
  filter$=""
ENDIF
filter2$=""
fil$=""
fil_lab1: DIR$=""
fil_lab2: 
IF DIR$>"" THEN path$=path$ & DIR$ & "/"
fil_lab21:
DIR path$ LIST DIRS directs$,n1
DIR path$ LIST FILES FILES$,n2
fil_lab3:
IF n1 THEN
  FOR i=1 TO n1 ! combi$(i)="DIR: " & directs$(i) ! NEXT i
  END IF
fil_lab4:
ntot=n1
IF n2 THEN
  FOR i=1 TO n2
    IF filter$="" OR filter$="filter" OR INSTR(FILES$(i),filter$)>=0 OR (type=1 AND INSTR(FILES$(i),filter2$)>=0) THEN
      ntot+=1 ! combi$(ntot)=FILES$(i)
      END IF
    NEXT i
  END IF
IF ntot=0 THEN ! ntot=1 ! combi$(1)="" ! END IF
DIM temp$(ntot)
FOR i=1 TO ntot ! temp$(i)=combi$(i) ! NEXT i
LIST "fsel" TEXT temp$ AT xtop+2,sh*.07 SIZE xbot-xtop-3,hgt*.9
DRAW SIZE 3 ! DRAW LINE xtop,ytop+hgt*.95 TO xbot,ytop+hgt*.95
.path$=path$ ! .fil$=fil$

fil_lab5:
IF BUTTON_PRESSED("-dir") THEN
  dirop=1
  fb$="Select directory"&CHR$(10)&CHR$(10)&"Click OK to delete it"&CHR$(10)&CHR$(10)&"Click CANCEL to escape"
  FIELD "feedback" TEXT fb$
ENDIF
IF BUTTON_PRESSED("+dir") THEN
  dirop=2
  fb$="Enter name of new directory"&CHR$(10)&CHR$(10)&"Click OK to create it"&CHR$(10)&CHR$(10)&"Click CANCEL to escape"
  FIELD "feedback" TEXT fb$
ENDIF
IF BUTTON_PRESSED("cancel") THEN
  ret$="" ! GOTO fil_lab6
END IF
IF BUTTON_PRESSED("clrfld") THEN FIELD "namer" TEXT ""
IF BUTTON_PRESSED("del") THEN
  'if file not yet selected, ask user to select one.
  checksel=LIST_SELECTED("fsel")
  IF checksel=-1 THEN
    fb$="You must first select a file to delete."
    GOTO skipremove
  ENDIF
fil$=temp$(checksel)
fb$="Are you sure you wish to delete the file """&fil$&""" ? If yes, press OK. If no, press Cancel. A deleted file cannot be recovered!"
deleter=1
skipremove:
FIELD "feedback" TEXT fb$
BEEP
BEEP
ENDIF

IF BUTTON_PRESSED("rename") THEN
'if not yet selected, ask user to select a file.
  checksel=LIST_SELECTED("fsel")
  IF checksel=-1 THEN
    fb$="You must first select a file to rename."
    GOTO skiprename
  ENDIF
fil$=temp$(checksel)
fb$="Are you sure you wish to rename the file """&fil$&""" ? If yes, enter the new name and press OK. If no, press Cancel."
FIELD "feedback" TEXT fb$
renamer=1
skiprename:
FIELD "feedback" TEXT fb$
BEEP
ENDIF
IF BUTTON_PRESSED("import") THEN
  fb$="The import feature is not yet implemented."
  FIELD "feedback" TEXT fb$
  /*impo=1!GOTO fil_lab6*/
ENDIF
IF BUTTON_PRESSED("export") THEN
  fb$="The export feature is not yet implemented."
  FIELD "feedback" TEXT fb$
  /*'if not yet selected, ask user to select a file.
  checksel=LIST_SELECTED("fsel")
  IF checksel=-1 THEN
    ret$=path$&procnam$
  ELSE
    ret$=path$ & fil$
  ENDIF
  expo=1!GOTO fil_lab6*/
ENDIF
IF BUTTON_PRESSED("ok") THEN
  IF FIELD_TEXT$("namer")<>"" THEN fil$=FIELD_TEXT$("namer")
  IF dirop=2 AND fil$<>"" THEN
    DIR path$&fil$ CREATE
    FIELD "namer" TEXT ""
    dirop=0
    GOTO fil_lab21
  ENDIF
  IF dirop=1 AND fil$<>"" THEN
    DIR path$&fil$ DELETE
    FIELD "namer" TEXT ""
    dirop=0
    GOTO fil_lab21
  ENDIF
  IF deleter THEN
    FILE path$&fil$ DELETE
    deleter=0
    ret$=""
    GOTO fil_lab21
  ENDIF
  IF renamer THEN
    FILE path$&combi$(sel) RENAME path$&fil$
    renamer=0
    ret$=""
    GOTO fil_lab21
  ENDIF
  IF fil$>"" THEN
    IF path$ > "" THEN
     ret$=path$ & fil$
    ELSE
     ret$ = fil$
    END IF
    GOTO fil_lab6
  END IF
END IF

IF filter$<>filterhold$ THEN
'IF FIELD_CHANGED("filter") THEN
  filter$=FIELD_TEXT$("filter")
  'filterhold$=FIELD_TEXT$ ("filter")
  GOTO fil_lab4
END IF
  filterhold$=FIELD_TEXT$ ("filter")
IF FIELD_CHANGED("namer") THEN
  fil$=FIELD_TEXT$("namer")
  LIST "fsel" SELECT -1
  GOTO fil_lab4
ENDIF
IF BUTTON_PRESSED("back") THEN 
  IF path$<>"Listful/" THEN
    IF RIGHT$(path$,1)="/" THEN path$=LEFT$(path$,LEN(path$)-1)
    FOR k=LEN(path$) TO 1 STEP -1
      IF MID$(path$,k,1)="/" THEN BREAK
      NEXT k
    IF k THEN ! path$=LEFT$(path$,k) ! GOTO fil_lab21 ! END IF
  ENDIF
END IF
IF BUTTON_PRESSED("root") THEN
  path$="/" ! DIR$=""
  GOTO fil_lab21
END IF
IF BUTTON_PRESSED("quit") THEN
  IF .laun$="desktop" THEN EXIT
  IF .laun$="basic" THEN END
ENDIF
IF BUTTON_PRESSED("debug") THEN DEBUG PAUSE
sel=LIST_SELECTED("fsel")
IF sel>0 THEN
  IF sel>n1 THEN
     IF NOT trans THEN FIELD "namer" TEXT combi$(sel)
     trans=1
     IF FIELD_CHANGED ("namer") THEN trans=0
     IF sel<>tempsel THEN trans=0
     IF FIELD_TEXT$("namer")="" THEN
        fil$=combi$(sel)
     ELSE
        'FIELD "namer" TEXT combi$(sel)
        fil$=FIELD_TEXT$("namer")
     ENDIF
     tempsel=sel
    GOTO fil_lab5
    ELSE
    IF dirop<>1 THEN
      DIR$=directs$(sel) ! GOTO fil_lab2
    ELSE
      FIELD "namer" TEXT MID$(combi$(sel),6,45)
    ENDIF
    END IF
  END IF
GOTO fil_lab5

fil_lab6:
BUTTON "cancel" DELETE ! BUTTON "ok" DELETE ! BUTTON "clrfld" DELETE
BUTTON "rename" DELETE ! BUTTON "del" DELETE ! BUTTON "root" DELETE
BUTTON "back" DELETE ! BUTTON "+dir" DELETE ! BUTTON "-dir" DELETE
BUTTON "import" DELETE ! BUTTON "export" DELETE
FIELD "namer" DELETE ! LIST "fsel" DELETE
FIELD "filter" DELETE 
SPRITE "fbrow" AT xtop-2,ytop-2 ! SPRITE "fbrow" STAMP
SPRITE "fbrow" DELETE ! FIELD "feedback" DELETE
DRAW SIZE 1
IF impo THEN RETURN rets
IF expo THEN RETURN ret$
GRAPHICS CLEAR .7, .7, .7
.path$=path$
RETURN ret$
END DEF
Attachments
6D63001D-7A36-4C96-A8FA-ED971B808856.png
6D63001D-7A36-4C96-A8FA-ED971B808856.png (324.71 KiB) Viewed 78 times
steam.JPG
steam.JPG (923.72 KiB) Viewed 92 times
C1244432-88AA-4E62-85F8-EE0DA7DA9E82.png
C1244432-88AA-4E62-85F8-EE0DA7DA9E82.png (1.85 MiB) Viewed 94 times
9D2B6B69-2544-43AB-9300-64D135E79D97.png
9D2B6B69-2544-43AB-9300-64D135E79D97.png (1.8 MiB) Viewed 94 times
Last edited by rbytes on Sun Apr 15, 2018 4:45 am, edited 8 times in total.
####### Living the colorful life #######

User avatar
Dav
Posts: 289
Joined: Tue Dec 30, 2014 5:12 pm
My devices: iPad Mini, iPod Touch.
Location: North Carolina, USA
Contact:

Re: SB Notes V1.1

Post by Dav » Sun Apr 15, 2018 2:30 am

wow! That's great, rbytes! I can't download the images files right now, the seem not be loading in my neck of the woods. I will keep trying to grab them tho. The app looks great, and the code is first class quality as usual.

It's very interesting about mail to: perhaps could be a real option for getting files out of the smart basic app?

- Dav

User avatar
rbytes
Posts: 1552
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 6
iPad 4
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: SB Notes V1.1

Post by rbytes » Sun Apr 15, 2018 4:23 am

Which images files are causing problems? It should be possible to just long press and Save Image to your Camera Roll.

Dutchman posted the D&D browser last year. One of the applications he included in the package could download images from the Forum.

Interesting thought about exporting files. I guess we'd have to see if we can create attachments with HTML (or JavaScript?)
And would Mail accept them from a mailto:? Worth a shot..
####### Living the colorful life #######

User avatar
GeorgeMcGinn
Posts: 348
Joined: Sat Sep 10, 2016 6:37 am
My devices: IPad Pro
IMac
Location: Venice, FL
Flag: United States of America
Contact:

Re: SB Notes V1.1

Post by GeorgeMcGinn » Wed Apr 18, 2018 4:05 am

I like it, but it has the same issue that the new SB IDE I am developing has - you need an external keyboard or it does not scroll.

User avatar
rbytes
Posts: 1552
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 6
iPad 4
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: SB Notes V1.1

Post by rbytes » Wed Apr 18, 2018 4:32 am

I'm not sure what you mean. The text will scroll. However, there will always be an area behind the keyboard that is hard to reach, and sometimes you can not scroll it into view. That's what the Shift button is for. It moves the page up half the screen height. Anything you could not edit before is now editable. Cutting and pasting are still a bit awkward, but I have created all of my messages using only the on-screen keyboard.
####### Living the colorful life #######

Post Reply