Post by Larry on May 24, 2020 11:33:21 GMT -5
Have 12 graphics boxes that are written to with text. Below is the full source code for the program in progress. When I click my PgDn button, or my PgUp button, it clears the text from the graphicboxes, and when it gets back to the routine where it re-writes some text back into the graphicboxes, it doesn't put any text back in. You would think if it does something once, and you go back to the same code that worked the first time, it would work every time after that. If anyone can run this code and see what the problem is I'd greatly appreciate it.
'Form created with the help of Freeform 3 v07-15-08
'Generated on May 23, 2020 at 12:20:05
nomainwin
dim note$(100000,3)
top=1
x=0
open "f:\colored notepad\notes.lcn" for input as #load
while eof(#load)=0
x=x+1
line input #load,a$
if left$(a$,6)="title=" then note$(x,1)=mid$(a$,7,len(a$)-6)
line input #load,a$
if left$(a$,5)="note=" then note$(x,2)=mid$(a$,6,len(a$)-5)
line input #load,note$(x,3)
wend
close #load
notes=x
[setup.main.Window]
'-----Begin code for #main
WindowWidth = 590
WindowHeight = 585
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
'-----Begin GUI objects code
statictext #main.st13,"Title:",5,5,75,35
textbox #main.tb1,85,5,455,35
texteditor #main.ted1,5,40,455,515
graphicbox #main.gb1, 40, 40, 470, 40
graphicbox #main.gb2, 40, 80, 470, 40
graphicbox #main.gb3, 40, 120, 470, 40
graphicbox #main.gb4 40, 160, 470, 40
graphicbox #main.gb5, 40, 200, 470, 40
graphicbox #main.gb6, 40, 240, 470, 40
graphicbox #main.gb7, 40, 280, 470, 40
graphicbox #main.gb8, 40, 320, 470, 40
graphicbox #main.gb9, 40, 360, 470, 40
graphicbox #main.gb10, 40, 400, 470, 40
graphicbox #main.gb11, 40, 440, 470, 40
graphicbox #main.gb12, 40, 480, 470, 40
graphicbox #main.gb13, 5, 40, 40, 40
graphicbox #main.gb14, 5, 80, 40, 40
graphicbox #main.gb15, 5, 120, 40, 40
graphicbox #main.gb16 5, 160, 40, 40
graphicbox #main.gb17, 5, 200, 40, 40
graphicbox #main.gb18, 5, 240, 40, 40
graphicbox #main.gb19, 5, 280, 40, 40
graphicbox #main.gb20, 5, 320, 40, 40
graphicbox #main.gb21, 5, 360, 40, 40
graphicbox #main.gb22, 5, 400, 40, 40
graphicbox #main.gb23, 5, 440, 40, 40
graphicbox #main.gb24, 5, 480, 40, 40
button #main.b3,"PgUp",[b3], UL, 510, 40, 65, 40
button #main.b5,"PgDn",[b5], UL, 510, 90, 65, 40
button #main.b6,"Save",[b6], UL, 480, 60, 65, 35
statictext #main.st1,"Sorting Options:",5,5,160,35
button #main.b8,"A-Z",[b8],UL,170,5,65,25
button #main.b9,"Color",[b9],UL,235,5,65,25
'-----End GUI objects code
open "Liberty Notepad" for window as #main
print #main.st13,"!hide"
print #main.tb1,"!hide"
print #main.ted1,"!hide"
print #main.b6,"!hide"
print #main.gb1, "down; fill white; flush"
print #main.gb2, "down; fill white; flush"
print #main.gb3, "down; fill white; flush"
print #main.gb4, "down; fill white; flush"
print #main.gb5, "down; fill white; flush"
print #main.gb6, "down; fill white; flush"
print #main.gb7, "down; fill white; flush"
print #main.gb8, "down; fill white; flush"
print #main.gb9, "down; fill white; flush"
print #main.gb10, "down; fill white; flush"
print #main.gb11, "down; fill white; flush"
print #main.gb12, "down; fill white; flush"
print #main.gb1, "font garamond 20"
print #main.gb2, "font garamond 20"
print #main.gb3, "font garamond 20"
print #main.gb4, "font garamond 20"
print #main.gb5, "font garamond 20"
print #main.gb6, "font garamond 20"
print #main.gb7, "font garamond 20"
print #main.gb8, "font garamond 20"
print #main.gb9, "font garamond 20"
print #main.gb10, "font garamond 20"
print #main.gb11, "font garamond 20"
print #main.gb12, "font garamond 20"
print #main, "font garamond 18"
print #main, "trapclose [quit.main]"
[show_titles]
' Here we show the titles of the notes to the long graphicboxes and color in the smaller boxes
if note$(top,3)<>"" then print #main.gb13, "down;":#main.gb13,"fill "+note$(top,3):#main.gb13,"flush"
if note$(top+1,3)<>"" then print #main.gb14, "down;":#main.gb14,"fill "+note$(top+1,3):#main.gb14,"flush"
if note$(top+2,3)<>"" then print #main.gb15, "down;":#main.gb15,"fill "+note$(top+2,3):#main.gb15,"flush"
if note$(top+3,3)<>"" then print #main.gb16, "down;":#main.gb16,"fill "+note$(top+3,3):#main.gb16,"flush"
if note$(top+4,3)<>"" then print #main.gb17, "down;":#main.gb17,"fill "+note$(top+4,3):#main.gb17,"flush"
if note$(top+5,3)<>"" then print #main.gb18, "down;":#main.gb18,"fill "+note$(top+5,3):#main.gb18,"flush"
if note$(top+6,3)<>"" then print #main.gb19, "down;":#main.gb19,"fill "+note$(top+6,3):#main.gb19,"flush"
if note$(top+7,3)<>"" then print #main.gb20, "down;":#main.gb20,"fill "+note$(top+7,3):#main.gb20,"flush"
if note$(top+8,3)<>"" then print #main.gb21, "down;":#main.gb21,"fill "+note$(top+8,3):#main.gb21,"flush"
if note$(top+9,3)<>"" then print #main.gb22, "down;":#main.gb22,"fill "+note$(top+9,3):#main.gb22,"flush"
if note$(top+10,3)<>"" then print #main.gb23, "down;":#main.gb23,"fill "+note$(top+10,3):#main.gb23,"flush"
if note$(top+11,3)<>"" then print #main.gb24, "down;":#main.gb24,"fill "+note$(top+11,3):#main.gb24,,"flush"
#main.gb1,"place 0 0; color black;\\"+note$(top,1)
#main.gb2,"place 0 0; color black;\\"+note$(top+1,1)
#main.gb3,"place 0 0; color black;\\"+note$(top+2,1)
#main.gb4,"place 0 0; color black;\\"+note$(top+3,1)
#main.gb5,"place 0 0; color black;\\"+note$(top+4,1)
#main.gb6,"place 0 0; color black;\\"+note$(top+5,1)
#main.gb7,"place 0 0; color black;\\"+note$(top+6,1)
#main.gb8,"place 0 0; color black;\\"+note$(top+7,1)
#main.gb9,"place 0 0; color black;\\"+note$(top+8,1)
#main.gb10,"place 0 0; color black;\\"+note$(top+10,1)
#main.gb11,"place 0 0; color black;\\"+note$(top+11,1)
#main.gb12,"place 0 0; color black;\\"+note$(top+12,1)
' Here we setup our mouse clicks for selecting a note to edit.
#main.gb1,"when leftButtonDown [note1]"
#main.gb2,"when leftButtonDown [note2]"
#main.gb3,"when leftButtonDown [note3]"
#main.gb4,"when leftButtonDown [note4]"
#main.gb5,"when leftButtonDown [note5]"
#main.gb6,"when leftButtonDown [note6]"
#main.gb7,"when leftButtonDown [note7]"
#main.gb8,"when leftButtonDown [note8]"
#main.gb9,"when leftButtonDown [note9]"
#main.gb10,"when leftButtonDown [note10]"
#main.gb11,"when leftButtonDown [note11]"
#main.gb12,"when leftButtonDown [note12]"
#main.gb1,"when rightButtonDown [d1]"
#main.gb2,"when rightButtonDown [d2]"
#main.gb3,"when rightButtonDown [d3]"
#main.gb4,"when rightButtonDown [d4]"
#main.gb5,"when rightButtonDown [d5]"
#main.gb6,"when rightButtonDown [d6]"
#main.gb7,"when rightButtonDown [d7]"
#main.gb8,"when rightButtonDown [d8]"
#main.gb9,"when rightButtonDown [d9]"
#main.gb10,"when rightButtonDown [d10]"
#main.gb11,"when rightButtonDown [d11]"
#main.gb12,"when rightButtonDown [d12]"
' Here we setup our mouse clicks for selecting or changing a color.
'The colors are for those who like to categorize their notes.
#main.gb13,"when leftButtonDown [c1]"
#main.gb14,"when leftButtonDown [c2]"
#main.gb15,"when leftButtonDown [c3]"
#main.gb16,"when leftButtonDown [c4]"
#main.gb17,"when leftButtonDown [c5]"
#main.gb18,"when leftButtonDown [c6]"
#main.gb19,"when leftButtonDown [c7]"
#main.gb20,"when leftButtonDown [c8]"
#main.gb21,"when leftButtonDown [c9]"
#main.gb22,"when leftButtonDown [c10]"
#main.gb23,"when leftButtonDown [c11]"
#main.gb24,"when leftButtonDown [c12]"
wait
[main.inputLoop] 'wait here for input event
wait
[b3]
' Page up through the notes list
if top=1 then wait
top=top-12
#main.gb1,"cls"
#main.gb2,"cls"
#main.gb3,"cls"
#main.gb4,"cls"
#main.gb5,"cls"
#main.gb6,"cls"
#main.gb7,"cls"
#main.gb8,"cls"
#main.gb9,"cls"
#main.gb10,"cls"
#main.gb11,"cls"
#main.gb12,"cls"
#main.gb13,"cls"
#main.gb14,"cls"
#main.gb15,"cls"
#main.gb16,"cls"
#main.gb17,"cls"
#main.gb18,"cls"
#main.gb19,"cls"
#main.gb20,"cls"
#main.gb21,"cls"
#main.gb22,"cls"
#main.gb23,"cls"
#main.gb24,"cls"
goto [show_titles]
wait
[b5]
' Page down through the notes list
if top+11=100000 then wait
top=top+12
#main.gb1,"cls"
#main.gb2,"cls"
#main.gb3,"cls"
#main.gb4,"cls"
#main.gb5,"cls"
#main.gb6,"cls"
#main.gb7,"cls"
#main.gb8,"cls"
#main.gb9,"cls"
#main.gb10,"cls"
#main.gb11,"cls"
#main.gb12,"cls"
#main.gb13,"cls"
#main.gb14,"cls"
#main.gb15,"cls"
#main.gb16,"cls"
#main.gb17,"cls"
#main.gb18,"cls"
#main.gb19,"cls"
#main.gb20,"cls"
#main.gb21,"cls"
#main.gb22,"cls"
#main.gb23,"cls"
#main.gb24,"cls"
goto [show_titles]
wait
' Decide which note to edit based on which graphicbox was clicked.
[note1]
gb=1
goto [shownote]
wait
[note2]
gb=2
goto [shownote]
wait
[note3]
gb=3
goto [shownote]
wait
[note4]
gb=4
goto [shownote]
wait
[note5]
gb=5
goto [shownote]
wait
[note6]
gb=6
goto [shownote]
wait
[note7]
gb=7
goto [shownote]
wait
[note8]
gb=8
goto [shownote]
wait
[note9]
gb=9
goto [shownote]
wait
[note10]
gb=10
goto [shownote]
wait
[note11]
gb=11
goto [shownote]
wait
[note12]
gb=12
goto [shownote]
wait
' Decide which note to add a color for, or change the current color based on which graphicbox was clicked.
[c1]
gb=13
goto [b7]
wait
[c2]
gb=14
goto [b7]
wait
[c3]
gb=15
goto [b7]
wait
[c4]
gb=16
goto [b7]
wait
[c5]
gb=17
goto [b7]
wait
[c6]
gb=18
goto [b7]
wait
[c7]
gb=19
goto [b7]
wait
[c8]
gb=20
goto [b7]
wait
[c9]
gb=21
goto [b7]
wait
[c10]
gb=22
goto [b7]
wait
[c11]
gb=23
goto [b7]
wait
[c12]
gb=24
goto [b7]
wait
' Hide all of the controls not needed now and show the controls that are.
' This is where we create or edit our note.
[shownote]
#main.b1,"!hide"
#main.b2,"!hide"
#main.b3,"!hide"
#main.b4,"!hide"
#main.b5,"!hide"
#main.gb1,"hide"
#main.gb2,"hide"
#main.gb3,"hide"
#main.gb5,"hide"
#main.gb6,"hide"
#main.gb7,"hide"
#main.gb8,"hide"
#main.gb9,"hide"
#main.gb10,"hide"
#main.gb11,"hide"
#main.gb12,"hide"
#main.st13,"!show"
#main.ted1,"!show"
#main.b6,"!show"
#main.tb1,"!show"
#main.b8,"!hide"
#main.b9,"!hide"
#main.st1,"!hide"
#main.st2,"!hide"
#main.st3,"!hide"
#main.gb13,"hide"
#main.gb14,"hide"
#main.gb15,"hide"
#main.gb16,"hide"
#main.gb17,"hide"
#main.gb18,"hide"
#main.gb19,"hide"
#main.gb20,"hide"
#main.gb21,"hide"
#main.gb22,"hide"
#main.gb23,"hide"
#main.gb24,"hide"
if gb=1 and note$(top,1)="" then notes=notes+1
if gb=2 and note$(top+1,1)="" then notes=notes+1
if gb=3 and note$(top+2,1)="" then notes=notes+1
if gb=4 and note$(top+3,1)="" then notes=notes+1
if gb=5 and note$(top+4,1)="" then notes=notes+1
if gb=6 and note$(top+5,1)="" then notes=notes+1
if gb=7 and note$(top+6,1)="" then notes=notes+1
if gb=8 and note$(top+7,1)="" then notes=notes+1
if gb=9 and note$(top+8,1)="" then notes=notes+1
if gb=10 and note$(top+9,1)="" then notes=notes+1
if gb=11 and note$(top+10,1)="" then notes=notes+1
if gb=12 and note$(top+11,1)="" then notes=notes+1
' determine which note is to be edited based on which graphicbox ws clicked
if gb=1 then #main.tb1,note$(top,1):#main.ted1,note$(top,2)
if gb=2 then #main.tb1,note$(top+1,1):#main.ted1,note$(top+1,2)
if gb=3 then #main.tb1,note$(top+2,1):#main.ted1,note$(top+2,2)
if gb=4 then #main.tb1,note$(top+3,1):#main.ted1,note$(top+3,2)
if gb=5 then #main.tb1,note$(top+4,1):#main.ted1,note$(top+4,2)
if gb=6 then #main.tb1,note$(top+5,1):#main.ted1,note$(top+5,2)
if gb=7 then #main.tb1,note$(top+6,1):#main.ted1,note$(top+6,2)
if gb=8 then #main.tb1,note$(top+7,1):#main.ted1,note$(top+7,2)
if gb=9 then #main.tb1,note$(top+8,1):#main.ted1,note$(top+8,2)
if gb=10 then #main.tb1,note$(top+9,1):#main.ted1,note$(top+9,2)
if gb=11 then #main.tb1,note$(top+10,1):#main.ted1,note$(top+10,2)
if gb=12 then #main.tb1,note$(top+11,1):#main.ted1,note$(top+11,2)
#main.tb1,"!setfocus"
wait
[b6]
' save the note
#main.tb1,"!contents? title$"
#main.ted1,"!contents? n$"
if gb=1 then note$(top,1)=title$:note$(top,2)=n$
if gb=2 then note$(top+1,1)=title$:note$(top+1,2)=n$
if gb=3 then note$(top+2,1)=title$:note$(top+2,2)=n$
if gb=4 then note$(top+3,1)=title$:note$(top+3,2)=n$
if gb=5 then note$(top+4,1)=title$:note$(top+4,2)=n$
if gb=6 then note$(top+5,1)=title$:note$(top+5,2)=n$
if gb=7 then note$(top+6,1)=title$:note$(top+6,2)=n$
if gb=8 then note$(top+7,1)=title$:note$(top+7,2)=n$
if gb=9 then note$(top+8,1)=title$:note$(top+8,2)=n$
if gb=10 then note$(top+9,1)=title$:note$(top+9,2)=n$
if gb=11 then note$(top+10,1)=title$:note$(top+10,2)=n$
if gb=12 then note$(top+11,1)=title$:note$(top+11,2)=n$
open "f:\colored notepad\notes.lcn" for output as #save
for i=1 to notes
print #save,"title="+note$(i,1)
print #save,"note-"+note$(i,2)
print #save,note$(i,3)
next i
close #save
x=0
open "f:\colored notepad\notes.lcn" for input as #load
while eof(#load)=0
x=x+1
line input #load,a$
if left$(a$,6)="title=" then note$(x,1)=mid$(a$,7,len(a$)-6)
line input #load,a$
if left$(a$,5)="note=" then note$(x,2)=mid$(a$,6,len(a$)-5)
wend
close #load
notes=x
#main.b1,"!show"
#main.b2,"!show"
#main.b3,"!show"
#main.b4,"!show"
#main.b5,"!show"
#main.gb1,"show"
#main.gb2,"show"
#main.gb3,"show"
#main.gb5,"show"
#main.gb6,"show"
#main.gb7,"show"
#main.gb8,"show"
#main.gb9,"show"
#main.gb10,"show"
#main.gb11,"show"
#main.gb12,"show"
#main.st13,"!hide"
#main.ted1,"!cls"
#main.ted1,"!hide"
#main.b6,"!hide"
#main.tb1,""
#main.tb1,"!hide"
#main.gb13,"show"
#main.gb14,"show"
#main.gb15,"show"
#main.gb16,"show"
#main.gb17,"show"
#main.gb18,"show"
#main.gb19,"show"
#main.gb20,"show"
#main.gb21,"show"
#main.gb22,"show"
#main.gb23,"show"
#main.gb24,"show"
wait
[b7]
' pick a color for the note
colordialog color$, chosen$
if gb=13 then note$(top,3)=chosen$
if gb=14 then note$(top+2,3)=chosen$
if gb=15 then note$(top+3,3)=chosen$
if gb=16 then note$(top+4,3)=chosen$
if gb=17 then note$(top+5,3)=chosen$
if gb=18 then note$(top+6,3)=chosen$
if gb=19 then note$(top+7,3)=chosen$
if gb=20 then note$(top+8,3)=chosen$
if gb=21 then note$(top+9,3)=chosen$
if gb=22 then note$(top+10,3)=chosen$
if gb=23 then note$(top+11,3)=chosen$
if gb=24 then note$(top+12,3)=chosen$
goto [b6]
wait
[b8]
' sort the notes by name
sort note$(),1,notes,1
wait
[b9]
' sort the notes by color
sort note$(),1,notes,3
wait
[d1]
confirm "Are you sure you want to DELETE this note?"; answer$
if answer$ = "no" then wait
note$(top,1)="":note$(top,2)="":note$(top,3)=""
goto [b10]
[d2]
confirm "Are you sure you want to DELETE this note?"; answer$
if answer$ = "no" then wait
note$(top+1,1)="":note$(top+1,2)="":note$(top+1,3)=""
goto [b10]
[d3]
confirm "Are you sure you want to DELETE this note?"; answer$
if answer$ = "no" then wait
note$(top+2,1)="":note$(top+2,2)="":note$(top+2,3)=""
goto [b10]
[d4]
confirm "Are you sure you want to DELETE this note?"; answer$
if answer$ = "no" then wait
note$(top+3,1)="":note$(top+3,2)="":note$(top+3,3)=""
goto [b10]
[d5]
confirm "Are you sure you want to DELETE this note?"; answer$
if answer$ = "no" then wait
note$(top+4,1)="":note$(top+4,2)="":note$(top+4,3)=""
goto [b10]
[d6]
confirm "Are you sure you want to DELETE this note?"; answer$
if answer$ = "no" then wait
note$(top+5,1)="":note$(top+5,2)="":note$(top+5,3)=""
goto [b10]
[d7]
confirm "Are you sure you want to DELETE this note?"; answer$
if answer$ = "no" then wait
note$(top+6,1)="":note$(top+6,2)="":note$(top+6,3)=""
goto [b10]
[d8]
confirm "Are you sure you want to DELETE this note?"; answer$
if answer$ = "no" then wait
note$(top+7,1)="":note$(top+7,2)="":note$(top+7,3)=""
goto [b10]
[d9]
confirm "Are you sure you want to DELETE this note?"; answer$
if answer$ = "no" then wait
note$(top+8,1)="":note$(top+8,2)="":note$(top+8,3)=""
goto [b10]
[d10]
confirm "Are you sure you want to DELETE this note?"; answer$
if answer$ = "no" then wait
note$(top+9,1)="":note$(top+9,2)="":note$(top+9,3)=""
goto [b10]
[d11]
confirm "Are you sure you want to DELETE this note?"; answer$
if answer$ = "no" then wait
note$(top+10,1)="":note$(top+10,2)="":note$(top+10,3)=""
goto [b10]
[d12]
confirm "Are you sure you want to DELETE this note?"; answer$
if answer$ = "no" then wait
note$(top+11,1)="":note$(top+11,2)="":note$(top+11,3)=""
goto [b10]
[b10]
open "f:\colored notepad\notes.lcn" for output as #save
for i=1 to notes
if note$(i,1)<>"" and note$(i,2)<>"" and note$(i,3)<>"" then print #save,"title="+note$(i,1):print #save,"note-"+note$(i,2):print #save,note$(i,3)
next i
close #save
x=0
open "f:\colored notepad\notes.lcn" for input as #load
while eof(#load)=0
x=x+1
line input #load,a$
if left$(a$,6)="title=" then note$(x,1)=mid$(a$,7,len(a$)-6)
line input #load,a$
if left$(a$,5)="note=" then note$(x,2)=mid$(a$,6,len(a$)-5)
wend
close #load
notes=x
wait
[quit.main] 'End the program
close #main
end