Ascii browser

Post Reply
Henko
Posts: 814
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Ascii browser

Post by Henko »

Remake of Dav's ascii browser. IPad only. Shows only interesting blocks. Functionally same as Dav's.
IMG_1546.PNG
IMG_1546.PNG (904.42 KiB) Viewed 2410 times

Code: Select all

' ascii browser
' remake of Dav's ascii browser
' plus  : only showing interesting blocks
' minus : iPad version only (Dav's : also iPhone)
' 
n=10
dim from(n+1),unto(n+1)
for i=0 to n ! read from(i),unto(i) ! next i
data 32,191, 8986,9210, 9728,10175, 11013,11093
data 57345,57434, 57601,57690, 57857,57939, 58113,58189
data 58369,58444, 58625,58678, 63493,63568
set buttons font size 50
for i=0 to 9 ! for j=0 to 9
  button i&j text "" at 35+70*j,60+70*i size 60,60
  next j ! next i
set buttons font size 70
button "back" text "◀️" at 280,820 size 80,80
button "forw" text "▶️" at 400,820 size 80,80
set buttons font size 160
button "large" text "" at 45,770 size 180,180
field "nums" text "" at 230,10 size 400,30 RO
field "nums" font size 30
field "valu" text "" at 520,840 size 400,30 RO
field "valu" font size 30
button "large" hide ! field "valu" hide

ind=0 ! b=from(0)
do 
ee=b+99 ! e=min(ee,unto(ind))
field "nums" text "from "&b&" unto "&e
for i=0 to 9 ! for j=0 to 9 ! k=b+10*i+j
  if k<=e then ! button i&j text chr$(k)! button i&j show
    else ! button i&j hide
    end if
  next j ! next i
done=0
do slowdown
  if bp("forw") then
    done=1
    button "large" hide ! field "valu" hide
    if e<unto(ind) then ! b=e+1 
      else ! if ind<n then ! ind+=1 ! b=from(ind) ! end if
      end if
    end if
  if bp("back") then
    done=1
    button "large" hide ! field "valu" hide
    if b>from(ind) then
      b=max(b-100,from(ind)) ! continue
      end if
    if ind=0 then continue
    ind-=1 ! b=max(from(ind),unto(ind)-99)
    end if
  for i=0 to 9 ! for j=0 to 9
    if bp(i&j) then
      done=1 ! k=b+10*i+j
      button "large" text chr$(k) ! button "large" show
      field "valu" text "value = "& k ! field "valu" show
      clipboard clear ! clipboard write "chr$("&k&")"
      end if
    next j ! next i
  until done
until forever
end

def bp(a$) = button_pressed(a$)

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

Re: Ascii browser

Post by rbytes »

Some cool icons that I have never seen before. I will use this when coding my next program.

Thanks, Henk.
The only thing that gets me down is gravity...

Henko
Posts: 814
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Ascii browser

Post by Henko »

Touching an icon places a chr$() on the clipboard.

Henko
Posts: 814
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Ascii browser

Post by Henko »

And a version for the iPhone (5s).
369D5265-FEDE-46D9-9A91-5EEE3CC470C0.png
369D5265-FEDE-46D9-9A91-5EEE3CC470C0.png (565.83 KiB) Viewed 2394 times

Code: Select all

set toolbar off
n=10
dim from(n+1),unto(n+1)
for i=0 to n ! read from(i),unto(i) ! next i
data 32,191, 8986,9210, 9728,10175, 11013,11093
data 57345,57434, 57601,57690, 57857,57939, 58113,58189
data 58369,58444, 58625,58678, 63493,63568
set buttons font size 33
for i=0 to 10 ! for j=0 to 7
  button i&j text "" at 8+38*j,40+38*i size 33,33
  next j ! next i
set buttons font size 40
button "back" text "◀️" at 112,465 size 40,40
button "forw" text "▶️" at 168,465 size 40,40
set buttons font size 24
button "stop" text "Quit" at 112,525 size 96,30
set buttons font size 90
button "large" text "" at 8,465 size 90,90
field "nums" text "from 23000 to 40000" at 60,7 size 250,30 RO
field "nums" font size 20
field "valu" text "" at 225,480 size 90,60 RO ML
field "valu" font size 20
button "large" hide ! field "valu" hide

ind=0 ! b=from(0)
do 
ee=b+87 ! e=min(ee,unto(ind))
field "nums" text "from "&b&" unto "&e
for i=0 to 10 ! for j=0 to 7 ! k=b+8*i+j
  if k<=e then ! button i&j text chr$(k)! button i&j show
    else ! button i&j hide
    end if
  next j ! next i
done=0
do slowdown
  if bp("stop") then stop
  if bp("forw") then
    done=1
    button "large" hide ! field "valu" hide
    if e<unto(ind) then ! b=e+1 
      else ! if ind<n then ! ind+=1 ! b=from(ind) ! end if
      end if
    end if
  if bp("back") then
    done=1
    button "large" hide ! field "valu" hide
    if b>from(ind) then
      b=max(b-88,from(ind)) ! continue
      end if
    if ind=0 then continue
    ind-=1 ! b=max(from(ind),unto(ind)-87)
    end if
  for i=0 to 10 ! for j=0 to 7
    if bp(i&j) then
      done=1 ! k=b+8*i+j
      button "large" text chr$(k) ! button "large" show
      field "valu" text "value = "& k ! field "valu" show
      clipboard clear ! clipboard write "chr$("&k&")"
      end if
    next j ! next i
  until done
until forever
end

def bp(a$) = button_pressed(a$)

Post Reply