initiaql check-in, moved repository -- no-longer a fork of
haikuarchives/yab
60
yab-IDE/Programs/Examples/3D-Curve.yab
Executable file
@@ -0,0 +1,60 @@
|
||||
doc Draw some nice 3D curves
|
||||
doc Original by Martin Lehmann for QBasic
|
||||
doc
|
||||
doc change the function func for different curves
|
||||
doc try smaller values of i for a lower resolution
|
||||
doc try z = 1 for less dots
|
||||
doc
|
||||
doc Note: this demo shows one thing: yab is slow :)
|
||||
doc The cleanup of the drawing takes alot of time too,
|
||||
doc you can simply break the program if you don't want to wait
|
||||
doc
|
||||
|
||||
window open 100,100 to 739,579, "Win", "3D Curve"
|
||||
|
||||
bitmap 640,480, "DoubleBuffer"
|
||||
canvas 0,0 to 639,479, "MyCanvas", "Win"
|
||||
|
||||
i = 128 // resolution
|
||||
z = 0.5 // dot frequency
|
||||
xk = 40
|
||||
yk = 30
|
||||
|
||||
draw set "highcolor", 0,0,0, "DoubleBuffer"
|
||||
draw rect 0,0 to 639,479, "DoubleBuffer"
|
||||
draw bitmap 0,0, "DoubleBuffer", "copy", "MyCanvas"
|
||||
|
||||
for t = -144 to 144 step(288/i)
|
||||
if(t=0) t=0.1
|
||||
r = int(0.5 + sqrt(20736 - t^2))
|
||||
for j = -r to r step z
|
||||
p = func(sqrt(j^2 + t^2) * 0.0327) * 20
|
||||
x = int(1.7 * (j + (t/2.25) + 160)) + xk
|
||||
y = int(1.8 * (199 - (p - t/2.25 + 90))) + yk
|
||||
draw set "highcolor", 255-r,j+r,255-p, "DoubleBuffer"
|
||||
draw line x,y to x,y, "DoubleBuffer"
|
||||
draw set "highcolor", 0,0,0, "DoubleBuffer"
|
||||
draw line x,y+1 to x,480, "DoubleBuffer"
|
||||
next j
|
||||
draw bitmap 0,0, "DoubleBuffer", "copy", "MyCanvas"
|
||||
next t
|
||||
|
||||
while(not instr(message$, "Quit"))
|
||||
wend
|
||||
|
||||
window close "Win"
|
||||
|
||||
// Choose one of the functions below, comment out all others
|
||||
sub func(n)
|
||||
return cos(n) + cos(2*n) +cos(5*n)
|
||||
// return -abs(1/n)
|
||||
// return -abs(1/(n + j))
|
||||
// return sin(n) + sin(2*n) +sin(5*n)
|
||||
// return cos(sin(n))
|
||||
// return cos(2*n) + cos((n+j)/16)
|
||||
// return sqrt(abs(0.5*(16 - n^2))) + 1/(n*4)
|
||||
// return cos(4*n) + 20/(n^2 + 3)
|
||||
// return cos(1/n) + cos(2/n) + cos(5/n) - 3
|
||||
// return cos(sin(j/n))
|
||||
// return 1/sqrt(n) - 3
|
||||
end sub
|
||||
201
yab-IDE/Programs/Examples/AllInOne.yab
Executable file
@@ -0,0 +1,201 @@
|
||||
// This example demonstrates all widgets
|
||||
|
||||
// open the window
|
||||
window open 100,100 to 640,500, "Win", "yab Demo"
|
||||
window set "Win", "Flags", "Not-Resizable, Not-Zoomable"
|
||||
|
||||
// set the title
|
||||
view 10,10 to 530,50, "Title", "Win"
|
||||
draw set "bgcolor", 50,50,200, "Title"
|
||||
draw set "lowcolor", 50,50,200, "Title"
|
||||
draw set "highcolor", 255,255,255, "Title"
|
||||
if(peek$("os") = "Haiku") then
|
||||
draw set "DejaVu Sans,Condensed Bold,32", "Title"
|
||||
else
|
||||
draw set "Zurich,Bold,32", "Title"
|
||||
endif
|
||||
draw text 10,32, "yab Widgets and Views", "Title"
|
||||
|
||||
// make the tabview
|
||||
tabview 10,60 to 530,390, "Box", "top", "Win"
|
||||
tabview add "Box", "Widgets"
|
||||
tabview add "Box", "Views and More"
|
||||
|
||||
// button
|
||||
button 10,10 to 100,30, "Button", "Button", "Box1"
|
||||
tooltip "Button", "BUTTON"
|
||||
|
||||
// button image
|
||||
button image 10,40, "ButtonImage", "img/button_pressed.png", "img/button_norm.png", "", "Box1"
|
||||
tooltip "ButtonImage", "BUTTON IMAGE"
|
||||
|
||||
// checkbox
|
||||
checkbox 10,70, "Check", "Checkbox", true, "Box1"
|
||||
tooltip "Check", "CHECKBOX"
|
||||
|
||||
// checkbox image
|
||||
checkbox image 10,92, "CheckImage", "img/checkbutton_enabledOn.png", "img/checkbutton_enabledOff.png", "", "", true, "Box1"
|
||||
tooltip "CheckImage", "CHECKBOX IMAGE"
|
||||
|
||||
// radiobutton
|
||||
radiobutton 10,130, "Radio1", "1. Radiobutton", true, "Box1"
|
||||
tooltip "Radio1", "RADIOBUTTON"
|
||||
radiobutton 10,150, "Radio2", "2. Radiobutton", false, "Box1"
|
||||
tooltip "Radio2", "RADIOBUTTON"
|
||||
|
||||
// dropbox
|
||||
dropbox 10,175 to 120,195, "Drop", "Dropbox", "Box1"
|
||||
dropbox add "Drop", "Foo"
|
||||
dropbox add "Drop", "Bar"
|
||||
tooltip "Drop", "DROPBOX"
|
||||
|
||||
// listbox
|
||||
listbox 10,210 to 100,290, "List", 1, "Box1"
|
||||
listbox add "List", "Foo"
|
||||
listbox add "List", "Bar"
|
||||
tooltip "List", "LISTBOX"
|
||||
|
||||
// columnbox
|
||||
columnbox 130,10 to 270,150, "Column", 1, "", "Box1"
|
||||
columnbox column "Column", " ", 1, 30,30,30, "align-center"
|
||||
columnbox column "Column", "Column", 2, 90,90,90, "align-center"
|
||||
columnbox add "Column", 1,1, 20, "__Icon__=img/yab.png"
|
||||
columnbox add "Column", 2,1, 20, "Foo"
|
||||
columnbox add "Column", 2,2, 20, "Bar"
|
||||
tooltip "Column", "COLUMNBOX"
|
||||
|
||||
// treebox
|
||||
treebox 130,160 to 270,290, "Tree", 1, "Box1"
|
||||
treebox add "Tree", "Root"
|
||||
treebox add "Tree", "Root", "Foo", true
|
||||
treebox add "Tree", "Root", "Bar", true
|
||||
tooltip "Tree", "TREEBOX"
|
||||
|
||||
// text
|
||||
text 300,10, "Text", "Text (cannot be flushed)", "Box1"
|
||||
tooltip "Text", "TEXT"
|
||||
|
||||
// texturl
|
||||
texturl 300,30, "TextURL", "Team MAUI", "http://www.team-maui.de", "Box1"
|
||||
tooltip "TextURL", "TEXTURL"
|
||||
|
||||
// textcontrol
|
||||
textcontrol 300,50 to 500,70, "TextCtrl", "TextControl", "", "Box1"
|
||||
tooltip "TextCtrl", "TEXTCONTROL"
|
||||
|
||||
// spincontrol
|
||||
spincontrol 300,80, "Spin", "Spincontrol", 0,100,1, "Box1"
|
||||
tooltip "Spin", "SPINCONTROL"
|
||||
|
||||
// calendar
|
||||
calendar 300,120, "Cal", "DDMMYYYY.", "01.01.1970", "Box1"
|
||||
tooltip "Cal", "CALENDAR"
|
||||
|
||||
// textedit
|
||||
textedit 300,150 to 500,215, "TextEd", 3, "Box1"
|
||||
textedit add "TextEd", "Simply edit your text..."
|
||||
tooltip "TextEd", "TEXTEDIT"
|
||||
|
||||
// slider
|
||||
slider 300,225 to 500,245, "Slider", "Slider", 1, 23, "Box1"
|
||||
tooltip "Slider", "SLIDER"
|
||||
|
||||
// statusbar
|
||||
statusbar 300,265 to 500,290, "Status", "Start", "Finish", "Box1"
|
||||
statusbar set "Status", "Start", "Finish", 66
|
||||
tooltip "Status", "STATUSBAR"
|
||||
|
||||
// view
|
||||
view 10,10 to 100,100, "View", "Box2"
|
||||
draw set "bgcolor", "jan-favorite-color", "View"
|
||||
draw text 20,35, "Plain View", "View"
|
||||
tooltip "View", "VIEW"
|
||||
|
||||
// canvas
|
||||
canvas 10,110 to 100,195, "Canvas", "Box2"
|
||||
draw text 20,35, "Canvas", "Canvas"
|
||||
tooltip "Canvas", "CANVAS"
|
||||
|
||||
// boxview
|
||||
boxview 10,205 to 100,290, "Boxview", "Boxview", 2, "Box2"
|
||||
tooltip "Boxview", "BOXVIEW"
|
||||
|
||||
// tabview
|
||||
tabview 120,10 to 260,100, "Tab", "top", "Box2"
|
||||
tabview add "Tab", "First"
|
||||
tabview add "Tab", "Second"
|
||||
tooltip "Tab", "TABVIEW"
|
||||
|
||||
// splitview
|
||||
splitview 120,110 to 260,195, "Split", true, false, "Box2"
|
||||
draw set "bgcolor", "Panel-Background-Color, Darken-1-Tint", "Split1"
|
||||
draw set "bgcolor", "Panel-Background-Color, Lighten-1-Tint", "Split2"
|
||||
tooltip "Split", "SPLITVIEW"
|
||||
|
||||
// colorcontrol
|
||||
colorcontrol 120,203, "Color", "Box2"
|
||||
tooltip "Color", "COLORCONTROL"
|
||||
|
||||
// popupmenu (only button, code in messageloop)
|
||||
button 120,270 to 245,290, "Popup", "Popupmenu", "Box2"
|
||||
tooltip "Popup", "POPUPMENU"
|
||||
|
||||
// filepanel (only button, code in messageloop)
|
||||
button 255,270 to 350,290, "File", "Filepanel", "Box2"
|
||||
tooltip "File", "FILEPANEL"
|
||||
|
||||
// menu
|
||||
view 280,10 to 500,100, "Menu", "Box2"
|
||||
menu "Menu", "Foo", "", "Menu"
|
||||
menu "Menu", "--", "", "Menu"
|
||||
menu "Menu", "Bar", "", "Menu"
|
||||
draw set "bgcolor", "Panel-Background-Color, Darken-1-Tint", "Menu"
|
||||
draw text 20,35, "View with menu", "Menu"
|
||||
tooltip "Menu", "MENU"
|
||||
|
||||
// scrollbar
|
||||
view 280,110 to 500-peek("scrollbarwidth"),195-peek("scrollbarwidth"), "ScrollView", "Box2"
|
||||
scrollbar "Scroll", 3, "ScrollView"
|
||||
scrollbar set "Scroll", "horizontal-range", 0,100
|
||||
scrollbar set "Scroll", "vertical-range", 0,50
|
||||
if(peek$("os") = "Haiku") then
|
||||
draw set "DejaVu Sans,Condensed Bold,32", "ScrollView"
|
||||
else
|
||||
draw set "Zurich,Bold,32", "ScrollView"
|
||||
endif
|
||||
draw text 130,90, "Foobar", "ScrollView"
|
||||
tooltip "Scroll", "SCROLLBAR"
|
||||
|
||||
// stackview
|
||||
stackview 420,205 to 500,260, "StackView", 2, "Box2"
|
||||
button 360,270 to 425,290, "Stack1", "Stack1", "Box2"
|
||||
button 435,270 to 500,290, "Stack2", "Stack2", "Box2"
|
||||
draw set "bgcolor", 200,200,255, "StackView1"
|
||||
draw text 10,20, "First view", "StackView1"
|
||||
draw set "bgcolor", 200,255,255, "StackView2"
|
||||
draw text 10,20, "Second view", "StackView2"
|
||||
tooltip "StackView", "STACKVIEW"
|
||||
|
||||
// messageloop
|
||||
while(not quitting)
|
||||
msg$ = message$
|
||||
if(instr(msg$, "Popup")) then
|
||||
// popupmenu
|
||||
select$ = popupmenu 120,270, "Foo|--|Bar", "Box2"
|
||||
elsif(instr(msg$, "File")) then
|
||||
// filepanel
|
||||
select$ = filepanel "Load-File", "Example Filepanel", "/boot/home"
|
||||
elsif(instr(msg$, "Stack1")) then
|
||||
// set stackview
|
||||
stackview set "StackView", 1
|
||||
elsif(instr(msg$, "Stack2")) then
|
||||
// set stackview
|
||||
stackview set "StackView", 2
|
||||
elsif(instr(msg$, "Quit")) then
|
||||
// exit
|
||||
quitting = true
|
||||
endif
|
||||
wend
|
||||
|
||||
window close "Win"
|
||||
|
||||
64
yab-IDE/Programs/Examples/BoxWorld.yab
Executable file
@@ -0,0 +1,64 @@
|
||||
#!yab
|
||||
|
||||
window open 100,100 to 380,410,"MainView","BoxWorld.yab"
|
||||
|
||||
window set "MainView", "flags", "not-zoomable, not-h-resizable, not-v-resizable"
|
||||
|
||||
layout "none", "MainView"
|
||||
|
||||
view 0,0 to 110,30, "CheckboxView","MainView"
|
||||
checkbox 10,10, "checkbox1", "Please select", 0, "CheckboxView"
|
||||
|
||||
view 0,31 to 110,120, "RadioView1","MainView"
|
||||
radiobutton 10,10, "Radio11", "Radio 11", 0, "RadioView1"
|
||||
radiobutton 10,30, "Radio12", "Radio 12", 0, "RadioView1"
|
||||
radiobutton 10,50, "Radio13", "Radio 13", 1, "RadioView1"
|
||||
|
||||
view 0,130 to 110,190,"RadioView2","MainView"
|
||||
radiobutton 10,10, "Radio21", "Radio 21", 1, "RadioView2"
|
||||
radiobutton 10,30, "Radio22", "Radio 22", 0, "RadioView2"
|
||||
|
||||
view 0,195 to 110,280,"RadioView3","MainView"
|
||||
radiobutton 10,5, "Radio31", "Radio 31", 0, "RadioView3"
|
||||
radiobutton 10,25, "Radio32", "Radio 32", 0, "RadioView3"
|
||||
radiobutton 10,45, "Radio33", "Radio 33", 1, "RadioView3"
|
||||
radiobutton 10,65, "Radio34", "Radio 34", 0, "RadioView3"
|
||||
|
||||
view 0, 285 to 280, 310, "CommandView","MainView"
|
||||
|
||||
layout "leftright", "MainView"
|
||||
|
||||
listbox 120,10 to 255,110, "List1", 1, "MainView"
|
||||
|
||||
layout "standard", "MainView"
|
||||
|
||||
listbox 120,120 to 255,230, "List2", 3, "MainView"
|
||||
|
||||
listbox add "List1","Hello"
|
||||
listbox add "List1","World"
|
||||
|
||||
for i=1 to 20
|
||||
listbox add "List2","Number "+str$(i)
|
||||
next i
|
||||
|
||||
dropbox 120,250 to 265,270, "drop1", "MyDrop:", "MainView"
|
||||
dropbox add "drop1", "Hello World"
|
||||
dropbox add "drop1", "Foo Bar"
|
||||
dropbox add "drop1", "--"
|
||||
dropbox add "drop1", "Acme Ltd"
|
||||
dropbox add "drop1", "Bobejaan"
|
||||
|
||||
alert "BoxWorld shows how to use Radiobuttons, Checkboxes, Listboxes and Dropboxes.","Ok","idea"
|
||||
|
||||
inloop = true
|
||||
while(inloop)
|
||||
a$ = message$
|
||||
if(a$<>"") then
|
||||
print a$
|
||||
draw flush "CommandView"
|
||||
draw text 5,15, left$(a$,len(a$)-1), "CommandView"
|
||||
endif
|
||||
if(instr(a$,"_QuitRequested|")) inloop = false
|
||||
wend
|
||||
|
||||
window close "MainView"
|
||||
64
yab-IDE/Programs/Examples/ButtonWorld.yab
Executable file
@@ -0,0 +1,64 @@
|
||||
#!yab
|
||||
|
||||
window open 400,400 to 550,500, "MainView1", "ButtonWorld1"
|
||||
window open 600,400 to 750,500, "MainView2", "ButtonWorld2"
|
||||
|
||||
mainview1 = true
|
||||
|
||||
layout "left, right", "MainView1"
|
||||
button 30,10 to 120,30, "EmptyAlert_", "Empty Alert", "MainView1"
|
||||
layout "bottom, right", "MainView1"
|
||||
button 30,40 to 120,60, "InfoAlert_", "Info Alert", "MainView1"
|
||||
button 30,70 to 120,90, "IdeaAlert_", "Idea Alert", "MainView1"
|
||||
|
||||
button 30,10 to 120,30, "WarningAlert_", "Warning Alert", "MainView2"
|
||||
button 30,40 to 120,60, "StopAlert_", "Stop Alert", "MainView2"
|
||||
button 30,70 to 120,90, "Quit_", "Quit", "MainView2"
|
||||
|
||||
alert "ButtonWorld demonstrates how Buttons and Alerts can be used easily!", "Ok", "idea"
|
||||
|
||||
inloop = true
|
||||
while(inloop)
|
||||
msg$ = message$
|
||||
switch msg$
|
||||
case "EmptyAlert_|":
|
||||
alert "This is an empty alert!", "Dooh", "none"
|
||||
break
|
||||
|
||||
case "InfoAlert_|"
|
||||
alert "This is an info alert!", "Dooh", "info"
|
||||
break
|
||||
|
||||
case "IdeaAlert_|"
|
||||
alert "This is an idea alert!", "Dooh", "idea"
|
||||
break
|
||||
|
||||
case "WarningAlert_|"
|
||||
alert "This is a warning alert!", "Dooh", "warning"
|
||||
break
|
||||
|
||||
case "StopAlert_|"
|
||||
alert "This is a stop alert!", "Dooh", "stop"
|
||||
break
|
||||
|
||||
case "Quit_|"
|
||||
inloop = false
|
||||
if (mainview1) window close "MainView1"
|
||||
window close "MainView2"
|
||||
break
|
||||
|
||||
case "MainView1:_QuitRequested|"
|
||||
window close "MainView1"
|
||||
mainview1 = false
|
||||
break
|
||||
|
||||
case "MainView2:_QuitRequested|"
|
||||
window close "MainView2"
|
||||
break
|
||||
|
||||
end switch
|
||||
|
||||
if(window count<1) inloop = false
|
||||
|
||||
wend
|
||||
|
||||
202
yab-IDE/Programs/Examples/Calc.yab
Executable file
@@ -0,0 +1,202 @@
|
||||
#!yab
|
||||
sleep .01
|
||||
This_dir$ = getdir$("Calc.yab")
|
||||
|
||||
//localize
|
||||
window open 100,50 to 320,320, "Calc", "CalcView"
|
||||
|
||||
|
||||
draw set "bgcolor", 100, 150, 220, "Calc"
|
||||
draw set "lowcolor", 100, 190, 100, "Calc"
|
||||
draw set "highcolor", 255, 255, 255, "Calc"
|
||||
window set "Calc", "minimumto", 220, 260
|
||||
window set "Calc", "maximumto", 220, 260
|
||||
|
||||
layout "all", "Calc"
|
||||
|
||||
menu "File", "Reset", "R", "Calc"
|
||||
menu "File", "--", "", "Calc"
|
||||
menu "File", "Quit", "Q", "Calc"
|
||||
menu "Help", "Help...", "H", "Calc"
|
||||
menu "Help", "--", "", "Calc"
|
||||
menu "Help", "About...", "", "Calc"
|
||||
|
||||
button 20,70 to 55,105,"b7", "7", "Calc"
|
||||
button 65,70 to 100,105,"b8", "8", "Calc"
|
||||
button 110,70 to 145,105,"b9", "9", "Calc"
|
||||
button 155,70 to 190,105,"b/", "/", "Calc"
|
||||
button 20,115 to 55,150,"b4", "4", "Calc"
|
||||
button 65,115 to 100,150,"b5", "5", "Calc"
|
||||
button 110,115 to 145,150,"b6", "6", "Calc"
|
||||
button 155,115 to 190,150,"b*", "*", "Calc"
|
||||
button 20,160 to 55,195,"b1", "1", "Calc"
|
||||
button 65,160 to 100,195,"b2", "2", "Calc"
|
||||
button 110,160 to 145,195,"b3", "3", "Calc"
|
||||
button 155,160 to 190,195,"b-", "-", "Calc"
|
||||
button 20,205 to 55,240,"b0", "0", "Calc"
|
||||
button 65,205 to 100,240,"b.", ".", "Calc"
|
||||
button 110,205 to 145,240,"bC", "C", "Calc"
|
||||
button 155,205 to 190,240,"b+/=", "+=", "Calc"
|
||||
|
||||
draw text 20,50,"0","Calc"
|
||||
|
||||
display$ = "0"
|
||||
result = 0
|
||||
type$ = "+"
|
||||
|
||||
dim msgbuffer$(1)
|
||||
inloop = true
|
||||
while(inloop)
|
||||
msgnumber = split(message$, msgbuffer$(), "|")
|
||||
for i=0 to msgnumber
|
||||
switch msgbuffer$(i)
|
||||
case "b."
|
||||
case "b0"
|
||||
case "b1"
|
||||
case "b2"
|
||||
case "b3"
|
||||
case "b4"
|
||||
case "b5"
|
||||
case "b6"
|
||||
case "b7"
|
||||
case "b8"
|
||||
case "b9"
|
||||
if(len(display$)<10) display$ = display$ + right$(msgbuffer$(i),1)
|
||||
while(left$(display$,1)="0")
|
||||
display$ = right$(display$,len(display$)-1)
|
||||
wend
|
||||
if(display$="") display$="0"
|
||||
draw rect 20,30 to 170,60, "Calc"
|
||||
draw flush "Calc"
|
||||
draw text 20,50, display$,"Calc"
|
||||
break
|
||||
case "b-"
|
||||
result = calculate(result, type$, val(display$))
|
||||
type$ = "-"
|
||||
draw rect 20,30 to 170,60, "Calc"
|
||||
draw flush "Calc"
|
||||
draw text 20,50, str$(result),"Calc"
|
||||
display$="0"
|
||||
break
|
||||
case "b+/="
|
||||
result = calculate(result, type$, val(display$))
|
||||
type$ = "+"
|
||||
draw rect 20,30 to 170,60, "Calc"
|
||||
draw flush "Calc"
|
||||
draw text 20,50, str$(result),"Calc"
|
||||
display$="0"
|
||||
break
|
||||
case "b*"
|
||||
result = calculate(result, type$, val(display$))
|
||||
type$ = "*"
|
||||
draw rect 20,30 to 170,60, "Calc"
|
||||
draw flush "Calc"
|
||||
draw text 20,50, str$(result),"Calc"
|
||||
display$="0"
|
||||
break
|
||||
case "b/"
|
||||
result = calculate(result, type$, val(display$))
|
||||
type$ = "/"
|
||||
draw rect 20,30 to 170,60, "Calc"
|
||||
draw flush "Calc"
|
||||
draw text 20,50, str$(result),"Calc"
|
||||
display$="0"
|
||||
break
|
||||
case "bC"
|
||||
case "Calc:File:Reset"
|
||||
result=0
|
||||
draw rect 20,30 to 170,60, "Calc"
|
||||
draw flush "Calc"
|
||||
draw text 20,50, str$(result),"Calc"
|
||||
display$="0"
|
||||
type$ = "+"
|
||||
break
|
||||
case "Calc:File:Quit"
|
||||
case "Calc:_QuitRequested"
|
||||
window close "Calc"
|
||||
break
|
||||
case "Calc:Help:Help..."
|
||||
alert "Calc demonstrates how to program\n a calculator in yab.\n\n", "Ok", "info"
|
||||
break
|
||||
case "Calc:Help:About..."
|
||||
window open 250,100 to 570,291, "About", "About"
|
||||
window set "About", "look", "bordered"
|
||||
window set "About", "feel", "modal-app"
|
||||
draw set "BGColor", 255,255,255, "About"
|
||||
window set "About", "minimumto", 320, 191
|
||||
window set "About", "maximumto", 320, 191
|
||||
|
||||
err = draw image 0,0, This_dir$+"img/image.png", "About"
|
||||
if(err>0) then
|
||||
alert "Error loading image.png!"+str$(err), "Close", "warning"
|
||||
window close "About"
|
||||
else
|
||||
button 20,163 to 300,183,"b", "Close", "About"
|
||||
endif
|
||||
|
||||
break
|
||||
case translate$("b")
|
||||
case translate$("About:_QuitRequested")
|
||||
window close "About"
|
||||
break
|
||||
default
|
||||
break
|
||||
end switch
|
||||
next i
|
||||
|
||||
if(window count = 0) inloop = false
|
||||
sleep 0.1
|
||||
wend
|
||||
|
||||
sub calculate(a,type$,b)
|
||||
ret = 0
|
||||
switch(type$)
|
||||
case "+"
|
||||
ret = a + b
|
||||
break
|
||||
case "-"
|
||||
ret = a - b
|
||||
break
|
||||
case "*"
|
||||
ret = a * b
|
||||
break
|
||||
case "/"
|
||||
ret = a / b
|
||||
break
|
||||
end switch
|
||||
return ret
|
||||
end sub
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
sub getdir$( programname$)
|
||||
// find out in which directory we are in
|
||||
////////////////////////////////////////////////////////////////
|
||||
local path$
|
||||
local catch
|
||||
catch=0
|
||||
if (!peek("isbound")) then
|
||||
path$=system$("ps")
|
||||
x=instr(path$,"/"+programname$)
|
||||
path$=left$(path$,x)
|
||||
for x=len(path$)-1 to 1 step -1
|
||||
if (instr(path$," ",x) and catch=0) catch=x+1
|
||||
next
|
||||
path$=right$(path$,len(path$)-catch)
|
||||
path$=trim$(path$)
|
||||
if path$="/" then
|
||||
path$ = trim$(system$("pwd"))+"/"
|
||||
else
|
||||
path$="/"+path$
|
||||
endif
|
||||
|
||||
else
|
||||
path$=trim$(peek$("directory") )
|
||||
path$=path$+"/"
|
||||
|
||||
end if
|
||||
|
||||
return path$
|
||||
end sub
|
||||
|
||||
|
||||
|
||||
43
yab-IDE/Programs/Examples/Checkbox.yab
Executable file
@@ -0,0 +1,43 @@
|
||||
#!yab
|
||||
|
||||
dim Part$(1)
|
||||
window open 100, 100, 240, 300, "A", "Checkboxes"
|
||||
window set "A", "flags", "not-h-resizable, not-v-resizable, not-zoomable"
|
||||
|
||||
// create the checkboxes
|
||||
// with layout for left top
|
||||
layout "left, top", "A"
|
||||
for NP = 1 to 5
|
||||
Y = Y+25
|
||||
checkbox 10, Y, "CheckMe:"+str$(NP), "OFF", 0, "A"
|
||||
next NP
|
||||
|
||||
button 10, 170 to 130, 190, "Button_", "Check them", "A"
|
||||
|
||||
while (not instr(msg$, "Quit"))
|
||||
msg$ = message$
|
||||
if (split(msg$, Part$(), ":|") < 3) dim Part$(3)
|
||||
|
||||
// if one of the checkboxes was used
|
||||
if (msg$ = "CheckMe:"+Part$(2)+":"+Part$(3)+"|") then
|
||||
option set "CheckMe:"+Part$(2), "label", Part$(3)
|
||||
fi
|
||||
|
||||
// if the button was pressed
|
||||
if (msg$ = "Button_|") then
|
||||
if (check$ = "ON") then
|
||||
check$ = "OFF"
|
||||
option set "Button_", "label", "Check them"
|
||||
else
|
||||
check$ = "ON"
|
||||
option set "Button_", "label", "Uncheck them"
|
||||
fi
|
||||
for NP = 1 to 5
|
||||
checkbox set "CheckMe:"+str$(NP), (check$ = "ON")
|
||||
option set "CheckMe:"+str$(NP), "label", check$
|
||||
// sleep 0.05
|
||||
next NP
|
||||
fi
|
||||
|
||||
wend
|
||||
exit
|
||||
34
yab-IDE/Programs/Examples/Clock.yab
Executable file
@@ -0,0 +1,34 @@
|
||||
#!yab
|
||||
|
||||
window open 100,100 to 200,150, "MainView", "Clock"
|
||||
window set "MainView", "flags", "Not-Zoomable"
|
||||
window set "MainView", "minimumto", 100,50
|
||||
window set "MainView", "maximumto", 100,50
|
||||
layout "left, top, right", "MainView"
|
||||
view 0,0 to 100,50, "clockview", "MainView"
|
||||
|
||||
inloop = true
|
||||
while(inloop)
|
||||
msg$ = message$
|
||||
if(msg$<>"") print msg$
|
||||
if(instr(msg$,"_QuitRequested")) inloop = false
|
||||
if(instr(msg$,"Quit")) inloop = false
|
||||
draw_time_and_date()
|
||||
sleep 0.01
|
||||
wend
|
||||
|
||||
window close "MainView"
|
||||
exit
|
||||
|
||||
sub time_and_date()
|
||||
zeit$ = left$(time$,2) + ":" + mid$(time$,4,2) + ":" + mid$(time$,7,2)
|
||||
datum$ = mid$(date$,14,3) + ", " + mid$(date$,6,2) + "." + mid$(date$,3,2) + "." + mid$(date$,11,2)
|
||||
end sub
|
||||
|
||||
sub draw_time_and_date()
|
||||
time_and_date()
|
||||
draw flush "clockview"
|
||||
draw text 10,20, datum$ ,"clockview"
|
||||
draw text 10,35, zeit$ + " ","clockview"
|
||||
wait 0.25
|
||||
end sub
|
||||
26
yab-IDE/Programs/Examples/ColorDemo.yab
Executable file
@@ -0,0 +1,26 @@
|
||||
#!yab
|
||||
|
||||
DOCU ColorDemo, Color select and show
|
||||
DOCU by Stargater
|
||||
|
||||
window open 100,100 to 420,420, "MainView", "ColorDemo"
|
||||
window set "MainView", "flags", "not-zoomable, not-h-resizable, not-v-resizable"
|
||||
view 20,20 to 300,220, "ViewColor", "MainView"
|
||||
r = 140
|
||||
g = 140
|
||||
b = 240
|
||||
draw set "bgcolor", r,g,b, "ViewColor"
|
||||
|
||||
colorcontrol 10,240, "Colorcontrol", "MainView"
|
||||
colorcontrol set "Colorcontrol", 140,140,240
|
||||
|
||||
|
||||
while(not instr(message$,"_QuitRequested"))
|
||||
r = colorcontrol get "Colorcontrol", "red"
|
||||
g = colorcontrol get "Colorcontrol", "green"
|
||||
b = colorcontrol get "Colorcontrol", "blue"
|
||||
draw set "bgcolor", r,g,b, "ViewColor"
|
||||
wend
|
||||
|
||||
window close "MainView"
|
||||
|
||||
197
yab-IDE/Programs/Examples/DrawWorld.yab
Executable file
@@ -0,0 +1,197 @@
|
||||
#!yab
|
||||
|
||||
window open 100,100 to 700,500, "MainView", "DrawWorld"
|
||||
|
||||
// MainView
|
||||
draw set "highcolor", 0,0,0, "MainView"
|
||||
draw set "lowcolor", 235,235,235, "MainView"
|
||||
draw set "bgcolor", 235,235,235, "MainView"
|
||||
|
||||
draw set 0, "HighSolidFill"
|
||||
if(peek$("os") = "Haiku") then
|
||||
draw set "DejaVu Sans,Condensed Bold,48", "MainView"
|
||||
else
|
||||
draw set "Zurich,Bold,48", "MainView"
|
||||
endif
|
||||
draw text 175,50, "DrawWorld", "MainView"
|
||||
|
||||
button 510,370 to 590,390, "NextButton", "Next", "MainView"
|
||||
|
||||
// Our drawing pad
|
||||
view 100,60 to 500,390, "DrawView", "MainView"
|
||||
draw set "highcolor", 0,0,0, "DrawView"
|
||||
draw set "lowcolor", 255,255,255, "DrawView"
|
||||
draw set "bgcolor", 255,255,255, "DrawView"
|
||||
|
||||
// Dot and line
|
||||
draw set "Zurich,Bold,18", "DrawView"
|
||||
draw text 135,20, "Dot and Line", "DrawView"
|
||||
|
||||
xold = 40
|
||||
yold = 260
|
||||
for a=10 to 720 step 10
|
||||
x = 10+a*180/360
|
||||
y = 230+60*sin(a*pi/180)
|
||||
draw line xold,yold to x,y, "DrawView"
|
||||
xold = x + 30
|
||||
yold = y + 30
|
||||
next a
|
||||
|
||||
for a = 0 to 720 step 10
|
||||
x = 10+a*180/360
|
||||
y = 100+60*sin(a*pi/180)
|
||||
draw dot x,y, "DrawView"
|
||||
next a
|
||||
|
||||
while(not instr(msg$,"NextButton"))
|
||||
msg$ = message$
|
||||
if(instr(msg$, "Quit")) then
|
||||
window close "MainView"
|
||||
end
|
||||
endif
|
||||
sleep 0.1
|
||||
wend
|
||||
msg$ = ""
|
||||
|
||||
draw rect 0,0 to 400,330, "DrawView"
|
||||
draw flush "DrawView"
|
||||
draw set 1, "HighSolidFill"
|
||||
|
||||
// Circle and ellipse
|
||||
draw set "Zurich,Bold,18", "DrawView"
|
||||
draw text 135,20, "Circle and Ellipse", "DrawView"
|
||||
|
||||
// draw set 1, "LowSolidFill"
|
||||
draw circle 70,70, 36, "DrawView"
|
||||
draw set "highcolor", 0,0,245, "DrawView"
|
||||
draw dot 70,70, "DrawView"
|
||||
draw line 72,70 to 105,70, "DrawView"
|
||||
draw line 105,70 to 100,65, "DrawView"
|
||||
draw line 105,70 to 100,75, "DrawView"
|
||||
draw text 85,68, "r", "DrawView"
|
||||
|
||||
draw set "highcolor", 0,0,0, "DrawView"
|
||||
draw ellipse 210,70, 72, 36, "DrawView"
|
||||
draw set "highcolor", 0,0,245, "DrawView"
|
||||
draw dot 210,70, "DrawView"
|
||||
draw line 212,70 to 282,70, "DrawView"
|
||||
draw line 282,70 to 277,65, "DrawView"
|
||||
draw line 282,70 to 277,75, "DrawView"
|
||||
draw line 210,68 to 210,34, "DrawView"
|
||||
draw line 210,34 to 215,39, "DrawView"
|
||||
draw line 210,34 to 205,39, "DrawView"
|
||||
draw text 235,68, "rx", "DrawView"
|
||||
draw text 192,57, "ry", "DrawView"
|
||||
|
||||
for i = 0 to 255 step 5
|
||||
draw set "highcolor", i,0,0, "DrawView"
|
||||
draw ellipse i+90, 230, 72-i/5, 36+i/5, "DrawView"
|
||||
next i
|
||||
draw set "highcolor", 0,0,0, "DrawView"
|
||||
|
||||
|
||||
while(not instr(msg$,"NextButton"))
|
||||
msg$ = message$
|
||||
if(instr(msg$, "Quit")) then
|
||||
window close "MainView"
|
||||
end
|
||||
endif
|
||||
sleep 0.1
|
||||
wend
|
||||
msg$ = ""
|
||||
|
||||
draw rect 0,0 to 400,330, "DrawView"
|
||||
draw flush "DrawView"
|
||||
draw set "lowcolor", 255,255,255, "DrawView"
|
||||
draw set 1, "HighSolidFill"
|
||||
|
||||
// Bezier curve
|
||||
draw set "Zurich,Bold,18", "DrawView"
|
||||
draw text 135,20, "Bezier Curve", "DrawView"
|
||||
|
||||
draw set "highcolor", 50,50,250, "DrawView"
|
||||
draw circle 30,100, 3, "DrawView"
|
||||
draw circle 70,60, 3, "DrawView"
|
||||
draw circle 100,40, 3, "DrawView"
|
||||
draw circle 140,90, 3, "DrawView"
|
||||
draw line 30,100 to 70,60, "DrawView"
|
||||
draw line 70,60 to 100,40, "DrawView"
|
||||
draw line 100,40 to 140,90, "DrawView"
|
||||
draw set "highcolor", 0,0,0, "DrawView"
|
||||
draw curve 30,100, 70,60, 100,40, 140,90, "DrawView"
|
||||
|
||||
draw set "highcolor", 50,50,250, "DrawView"
|
||||
draw circle 170,100, 3, "DrawView"
|
||||
draw circle 190,40, 3, "DrawView"
|
||||
draw circle 250,40, 3, "DrawView"
|
||||
draw circle 265,90, 3, "DrawView"
|
||||
draw line 170,100 to 190,40, "DrawView"
|
||||
draw line 190,40 to 250,40, "DrawView"
|
||||
draw line 250,40 to 265,90, "DrawView"
|
||||
draw set "highcolor", 0,0,0, "DrawView"
|
||||
draw curve 170,100, 190,40, 250,40, 265,90, "DrawView"
|
||||
|
||||
draw set "highcolor", 50,50,250, "DrawView"
|
||||
draw circle 350,40, 3, "DrawView"
|
||||
draw circle 300,10, 3, "DrawView"
|
||||
draw circle 290,200, 3, "DrawView"
|
||||
draw circle 350,140, 3, "DrawView"
|
||||
draw line 350,40 to 300,10, "DrawView"
|
||||
draw line 300,10 to 290,200, "DrawView"
|
||||
draw line 290,200 to 350,140, "DrawView"
|
||||
draw set "highcolor", 0,0,0, "DrawView"
|
||||
draw set 0, "HighSolidFill"
|
||||
draw curve 350,40, 300,10, 290,200, 350,140, "DrawView"
|
||||
|
||||
draw set 1, "HighSolidFill"
|
||||
draw curve 10,300, 120,100, 170,100, 390,300, "DrawView"
|
||||
|
||||
while(not instr(msg$,"NextButton"))
|
||||
msg$ = message$
|
||||
if(instr(msg$, "Quit")) then
|
||||
window close "MainView"
|
||||
end
|
||||
endif
|
||||
sleep 0.1
|
||||
wend
|
||||
msg$ = ""
|
||||
|
||||
draw rect 0,0 to 400,330, "DrawView"
|
||||
draw flush "DrawView"
|
||||
|
||||
// Pattern
|
||||
draw set "Zurich,Bold,18", "DrawView"
|
||||
draw text 165,20, "Pattern", "DrawView"
|
||||
|
||||
draw text 47,40, "HighSolidFill", "DrawView"
|
||||
draw text 247,40, "LowSolidFill", "DrawView"
|
||||
draw text 43,190, "CheckeredFill", "DrawView"
|
||||
draw text 247,190, "Userdefined", "DrawView"
|
||||
draw set "highcolor", 50,50,250, "DrawView"
|
||||
draw set "lowcolor", 250,50,50, "DrawView"
|
||||
draw set 0, "HighSolidFill"
|
||||
draw rect 40,50 to 160,130, "DrawView"
|
||||
draw set 0, "LowSolidFill"
|
||||
draw rect 240,50 to 360,130, "DrawView"
|
||||
draw set 0, "CheckeredFill"
|
||||
draw rect 40,200 to 160,280, "DrawView"
|
||||
pattern$ = "255239171199001199171239"
|
||||
draw set 0, pattern$
|
||||
draw rect 240,200 to 360,280, "DrawView"
|
||||
draw set 0, "255255255255255255255255"
|
||||
draw rect 40,50 to 160,130, "DrawView"
|
||||
|
||||
draw set "highcolor", 0,0,0, "DrawView"
|
||||
draw set "lowcolor", 255,255,255, "DrawView"
|
||||
|
||||
while(not instr(msg$,"NextButton"))
|
||||
msg$ = message$
|
||||
if(instr(msg$, "Quit")) then
|
||||
window close "MainView"
|
||||
end
|
||||
endif
|
||||
sleep 0.1
|
||||
wend
|
||||
|
||||
window close "MainView"
|
||||
|
||||
33
yab-IDE/Programs/Examples/DropWorld.yab
Executable file
@@ -0,0 +1,33 @@
|
||||
#!yab
|
||||
|
||||
|
||||
window open 100,100 to 300,300, "WView", "DropWorld"
|
||||
|
||||
text 20,5, "Txt1", "Drop any file here:", "WView"
|
||||
view 20,20 to 180,180, "DropView", "WView"
|
||||
draw set "highcolor", 0,0,0, "DropView"
|
||||
draw set "lowcolor", 255,255,0, "DropView"
|
||||
pattern$ = "240225195135015030060120"
|
||||
draw set 0, pattern$
|
||||
draw rect 0,0 to 160,160, "DropView"
|
||||
draw set 0, "lowsolid"
|
||||
view dropzone "DropView"
|
||||
|
||||
dim msg$(1)
|
||||
inloop = true
|
||||
while(inloop)
|
||||
n = split(message$, msg$(), "|:")
|
||||
for i = 0 to n
|
||||
if(msg$(i) = "_Dropped") then
|
||||
draw rect 20,181 to 290,200, "WView"
|
||||
draw flush "WView"
|
||||
draw text 20,195, msg$(i+1), "WView"
|
||||
endif
|
||||
if(msg$(i) = "_QuitRequested") inloop = false
|
||||
next i
|
||||
|
||||
if(msg$<>"") print msg$
|
||||
sleep 0.1
|
||||
wend
|
||||
|
||||
window close "WView"
|
||||
18
yab-IDE/Programs/Examples/EvenMoreControls.yab
Executable file
@@ -0,0 +1,18 @@
|
||||
#!yab
|
||||
sleep .01
|
||||
window open 100,100 to 400, 200, "WView", "EvenMoreControls"
|
||||
layout "none", "WView"
|
||||
colorcontrol 10,10, "CC", "WView"
|
||||
colorcontrol set "CC", 213,123,43
|
||||
|
||||
textcontrol 10,70 to 150,90, "TC", "Enter Password:","","WView"
|
||||
textcontrol set "TC",1
|
||||
|
||||
inloop = true
|
||||
while(inloop)
|
||||
msg$ = message$
|
||||
if(msg$<>"") print msg$
|
||||
if(instr(msg$,"Quit")) inloop = false
|
||||
wend
|
||||
|
||||
window close "WView"
|
||||
58
yab-IDE/Programs/Examples/FakeTransparency.yab
Executable file
@@ -0,0 +1,58 @@
|
||||
#!yab
|
||||
|
||||
SCREEN_W = peek("desktopwidth")
|
||||
SCREEN_H = peek("desktopheight")
|
||||
|
||||
W = 400
|
||||
H = 200
|
||||
|
||||
X = (SCREEN_W/2) - (W/2)
|
||||
Y = (SCREEN_H/2) - (H/2)
|
||||
|
||||
THE_TEXT$ = "HELLO"
|
||||
|
||||
screenshot 0, 0 to SCREEN_W-1, SCREEN_H-1, "BMP_screen_"
|
||||
|
||||
window open -10-W, 0 to -10, H, "Main_", "PAPA"
|
||||
window set "Main_", "look", "modal"
|
||||
window set "Main_", "flags", "not-h-resizable, not-v-resizable, not-zoomable"
|
||||
|
||||
canvas 0, 0 to W, H, "CV_main_", "Main_"
|
||||
if(peek$("os") = "Haiku") then
|
||||
draw set "DejaVu Sans,Condensed Bold,122", "CV_main_"
|
||||
else
|
||||
draw set "Swis721 BT, Bold, 122", "CV_main_"
|
||||
endif
|
||||
|
||||
th = draw get "max-text-height", "CV_main_"
|
||||
tw = draw get "text-width", THE_TEXT$, "CV_main_"
|
||||
|
||||
tx = (W/2)-(tw/2)
|
||||
ty = (H/3)*2
|
||||
|
||||
draw bitmap -X, -Y, "BMP_screen_", "copy", "CV_main_"
|
||||
draw text tx, ty, THE_TEXT$, "CV_main_"
|
||||
|
||||
window set "Main_", "moveto", X, Y
|
||||
|
||||
dim m$(1)
|
||||
while (not instr(msg$, "Quit"))
|
||||
msg$ = message$
|
||||
|
||||
if (X <> window get "Main_", "position-x") then
|
||||
X = window get "Main_", "position-x"
|
||||
Moved = true
|
||||
fi
|
||||
if (Y <> window get "Main_", "position-y") then
|
||||
Y = window get "Main_", "position-y"
|
||||
Moved = true
|
||||
fi
|
||||
|
||||
if (Moved) then
|
||||
draw bitmap -X, -Y, "BMP_screen_", "copy", "CV_main_"
|
||||
draw text tx, ty, THE_TEXT$, "CV_main_"
|
||||
Moved = false
|
||||
fi
|
||||
|
||||
wend
|
||||
exit
|
||||
97
yab-IDE/Programs/Examples/Filebox.yab
Executable file
@@ -0,0 +1,97 @@
|
||||
// Filebox is a library to have an easy access to a list of files.
|
||||
// This is easier than poking around with columnboxes yourself.
|
||||
|
||||
// Open a new filebox from (x1,y1) to (x2,y2)
|
||||
// with the id ID$, the type of scrollbar ScrollbarType on View$
|
||||
export sub Filebox(x1,y1,x2,y2, ID$, ScrollbarType, View$)
|
||||
local myscrollbar
|
||||
columnbox x1,y1 to x2,y2, ID$, ScrollbarType, "resizable", View$
|
||||
columnbox column ID$, " ", 1, 20, 20, 20, "align-center"
|
||||
if(scrollbarType=1 or scrollbarType=3) myscrollbar = peek("scrollbarwidth")
|
||||
columnbox column ID$, "Name", 2, 1000, 21, x2-x1-24-myscrollbar, "align-left"
|
||||
columnbox color ID$, "Selection-Active", 220,220,250
|
||||
columnbox color ID$, "Row-Divider", 255,255,255
|
||||
return
|
||||
end sub
|
||||
|
||||
// Easy interface to a Filebox, simply name a directory
|
||||
export sub FileboxDirectorySimple(ID$, dir$)
|
||||
FileboxDirectory(ID$,dir$,false)
|
||||
return
|
||||
end sub
|
||||
|
||||
// return the name of the row position
|
||||
export sub FileboxName$(ID$, position)
|
||||
return columnbox get$ ID$, 2, position
|
||||
end sub
|
||||
|
||||
// return true, if the row position is a directory
|
||||
export sub FileboxIsDirectory(ID$, position)
|
||||
local t$
|
||||
t$ = columnbox get$ ID$, 1, position
|
||||
if(t$ = "__Mime__=application/x-vnd.Be-directory") return true
|
||||
return false
|
||||
end sub
|
||||
|
||||
// Give a directory and the following options:
|
||||
// showDot: set this to true to show hidden (dot) files
|
||||
export sub FileboxDirectory(ID$, dir$, showDot)
|
||||
local t$
|
||||
local i
|
||||
local n
|
||||
local arraysizeDir
|
||||
local arraysizeFiles
|
||||
|
||||
dim directories$(1)
|
||||
dim files$(1)
|
||||
|
||||
arraysizeDir = 0
|
||||
arraysizeFiles = 0
|
||||
|
||||
columnbox clear ID$
|
||||
if(showDot) then
|
||||
t$ = system$("ls --format=single-column --color=none -a "+dir$+" |sort -f")
|
||||
else
|
||||
t$ = system$("ls --format=single-column --color=none "+dir$+" |sort -f")
|
||||
endif
|
||||
|
||||
dim splitdir$(1)
|
||||
|
||||
n = split(t$, splitdir$(), "\n")
|
||||
for i=1 to n-1
|
||||
if(system("test -d \""+ dir$+splitdir$(i)+"\"") = 0) then
|
||||
// comment the if clause out if you want to have the direcotries "." and ".." listed
|
||||
if(splitdir$(i)<>"." and splitdir$(i)<>"..") then
|
||||
arraysizeDir = arraysizeDir + 1
|
||||
dim directories$(arraysizeDir)
|
||||
directories$(arraysizeDir-1) = splitdir$(i)
|
||||
endif
|
||||
// handle files
|
||||
else
|
||||
arraysizeFiles = arraysizeFiles + 1
|
||||
dim files$(arraysizeFiles)
|
||||
files$(arraysizeFiles-1) = splitdir$(i)
|
||||
endif
|
||||
next i
|
||||
for i=0 to arraysizeDir-1
|
||||
FileboxAdd(ID$, directories$(i), true)
|
||||
next i
|
||||
for i=0 to arraysizeFiles-1
|
||||
FileboxAdd(ID$, files$(i), false)
|
||||
next i
|
||||
return
|
||||
end sub
|
||||
|
||||
sub FileboxAdd(ID$, Name$, IsFolder)
|
||||
local maxpos
|
||||
|
||||
maxpos = (columnbox count ID$) + 1
|
||||
|
||||
if(IsFolder) then
|
||||
columnbox add ID$, 1, maxpos, 18, "__Mime__=application/x-vnd.Be-directory"
|
||||
else
|
||||
columnbox add ID$, 1, maxpos, 18, "__Mime__=application/octet-stream"
|
||||
endif
|
||||
columnbox add ID$, 2, maxpos, 20, Name$
|
||||
return
|
||||
end sub
|
||||
46
yab-IDE/Programs/Examples/FileboxDemo.yab
Executable file
@@ -0,0 +1,46 @@
|
||||
import Filebox
|
||||
|
||||
|
||||
dir$ = "/boot/home/"
|
||||
|
||||
window open 100,100 to 500,500, "Demo","Demo"
|
||||
Filebox(10,10,350,390,"Filebox", 1, "Demo")
|
||||
FileboxDirectory("Filebox", dir$, false)
|
||||
button 360,10,390,30, "DirUp", "..", "Demo"
|
||||
|
||||
dim msg$(1)
|
||||
inloop = true
|
||||
while(inloop)
|
||||
n = split(message$, msg$(), "|")
|
||||
for i=1 to n
|
||||
// Quit
|
||||
if(msg$(i) = "Demo:_QuitRequested") inloop = false
|
||||
|
||||
// Button pressed and we are not in the root directory
|
||||
if(msg$(i) = "DirUp" and dir$<>"/") then
|
||||
t = len(dir$)-1
|
||||
while(mid$(dir$,t,1)<>"/")
|
||||
t = t - 1
|
||||
wend
|
||||
dir$ = left$(dir$,t)
|
||||
FileboxDirectory("Filebox", dir$, false)
|
||||
endif
|
||||
|
||||
// An item is invoked
|
||||
if(instr(msg$(i),"Filebox:_Invoke:")) then
|
||||
position = val(right$(msg$(i),len(msg$(i))-16))
|
||||
|
||||
// if the item is a directory, then update the filebox else print the filename
|
||||
if(FileboxIsDirectory("Filebox", position)) then
|
||||
dir$ = dir$ + FileboxName$("Filebox", position) + "/"
|
||||
FileboxDirectory("Filebox", dir$, false)
|
||||
else
|
||||
print FileboxName$("Filebox", position)
|
||||
endif
|
||||
endif
|
||||
next i
|
||||
|
||||
sleep 0.01
|
||||
wend
|
||||
|
||||
window close "Demo"
|
||||
444
yab-IDE/Programs/Examples/GUI-World.yab
Executable file
@@ -0,0 +1,444 @@
|
||||
#!yab
|
||||
|
||||
// Set Backgroundcolors as variables.
|
||||
bgr = 216 : bgg = 216 : bgb = 226
|
||||
|
||||
window open 100, 100 to 610, 400, "MainView" ,"GUI - World"
|
||||
window set "MainView", "flags", "not-h-resizable"
|
||||
draw set "bgcolor", bgr, bgg, bgb, "MainView"
|
||||
draw set "lowcolor", bgr, bgg, bgb, "MainView"
|
||||
draw set "highcolor", 0, 0, 0, "MainView"
|
||||
draw set "Zurich, Bold, 16", "MainView"
|
||||
draw text 10, 20, "GUI - World", "MainView"
|
||||
|
||||
listbox 200, 5 to 505, 235, "SourceView", 1, "MainView"
|
||||
|
||||
view 5, 241 to 505, 265, "LineView", "MainView"
|
||||
draw set "bgcolor", bgr-16, bgg-16, bgb-16, "LineView"
|
||||
draw set "lowcolor", bgr-16, bgg-16, bgb-16, "LineView"
|
||||
draw set "highcolor", 155, 0, 0, "LineView"
|
||||
draw set "Zurich, Bold, 14", "LineView"
|
||||
|
||||
view 0, 270 to 510, 300, "ButtonView", "MainView"
|
||||
draw set "bgcolor", bgr, bgg, bgb, "ButtonView"
|
||||
|
||||
button 10, 0 to 70, 20, "Quit_", "Quit", "ButtonView"
|
||||
button 205, 0 to 500, 20, "Step_", "Next step", "ButtonView"
|
||||
|
||||
layout "left, top", "MainView"
|
||||
view 5, 25 to 190, 240, "StatusView", "MainView"
|
||||
draw set "bgcolor", bgr, bgg, bgb, "StatusView"
|
||||
draw set "Zurich, Roman, 10", "StatusView"
|
||||
|
||||
NextStep(0)
|
||||
option set "Step_", "focus", true
|
||||
|
||||
dim choice$(1)
|
||||
inloop = true
|
||||
while (inloop)
|
||||
msg$ = message$
|
||||
if (split(msg$, choice$(), ":|") > 2) btn$ = choice$(3)
|
||||
if (msg$ <> "") print msg$
|
||||
|
||||
switch msg$
|
||||
|
||||
case "Step_|"
|
||||
stp = stp+1
|
||||
NextStep(stp)
|
||||
L = 0
|
||||
option set "Step_", "focus", true
|
||||
break
|
||||
|
||||
case "SourceView:_Invoke:"+btn$+"|"
|
||||
if (L = 0) stp = stp-1
|
||||
L = 1
|
||||
NextStep(val(btn$))
|
||||
break
|
||||
|
||||
case "Quit_|":
|
||||
case "MainView:_QuitRequested|":
|
||||
inloop = false
|
||||
break
|
||||
|
||||
end switch
|
||||
sleep 0.01
|
||||
wend
|
||||
exit
|
||||
|
||||
sub NextStep(n)
|
||||
draw flush "StatusView"
|
||||
m = n
|
||||
if (n = 0) then
|
||||
draw text 5, 20, "With GUI-World you can", "StatusView"
|
||||
draw text 5, 35, "create a window with a few", "StatusView"
|
||||
draw text 5, 50, "contents, as examples.", "StatusView"
|
||||
draw text 5, 75, "The currently executed line will be", "StatusView"
|
||||
draw text 5, 90, "shown down above the buttons.", "StatusView"
|
||||
draw text 5, 115, "The complete source will be", "StatusView"
|
||||
draw text 5, 130, "collected in the right list.", "StatusView"
|
||||
draw text 5, 200, "Click on 'Next step' to start ...", "StatusView"
|
||||
ShowLine("Welcome to GUI-World!")
|
||||
fi
|
||||
|
||||
if (n = 1) then
|
||||
draw text 5, 20, "At first, we need to create the window.", "StatusView"
|
||||
draw text 5, 35, "We will create a window", "StatusView"
|
||||
draw text 5, 60, "with a size of 400, 300 (x, y)", "StatusView"
|
||||
draw text 5, 75, "at the position 200x200", "StatusView"
|
||||
draw text 5, 90, "of your monitor.", "StatusView"
|
||||
draw text 5, 110, "The name of the window is ''New App''.", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("window open 200, 200 to 600, 500, ''View1'', ''New App''")
|
||||
fi
|
||||
|
||||
if (n = 2) then
|
||||
if (L = 0) window open 200, 450 to 600, 750, "View1", "New App"
|
||||
if (L = 0) listbox add "SourceView", "window open 200, 200 to 600, 500, ''View1'', ''New App''"
|
||||
|
||||
draw text 5, 20, "The window should be opened now.", "StatusView"
|
||||
draw text 5, 45, "It has no function yet,", "StatusView"
|
||||
draw text 5, 60, "so we'll change that.", "StatusView"
|
||||
draw text 5, 85, "But first let us define the", "StatusView"
|
||||
draw text 5, 100, "background color of the window.", "StatusView"
|
||||
draw text 5, 125, "We'll choose white for background.", "StatusView"
|
||||
draw text 5, 140, "Red 255 + Green 255 + Green 255", "StatusView"
|
||||
draw text 5, 155, " = white.", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("draw set ''bgcolor'', 255, 255, 255, ''View1''")
|
||||
fi
|
||||
|
||||
if (n = 3) then
|
||||
if (L = 0) draw set "bgcolor", 255, 255, 255, "View1"
|
||||
if (L = 0) listbox add "SourceView", "draw set ''bgcolor'', 255, 255, 255, ''View1''"
|
||||
if (L = 0) listbox add "SourceView", ""
|
||||
|
||||
draw text 5, 20, "Ok, white. But still no function!!", "StatusView"
|
||||
draw text 5, 45, "We can now drop in some widgets,", "StatusView"
|
||||
draw text 5, 60, "such as buttons, checkboxes, etc.", "StatusView"
|
||||
draw text 5, 85, "Let's start with a simple button.", "StatusView"
|
||||
draw text 5, 100, "The button will be named 'Quit'", "StatusView"
|
||||
draw text 5, 115, "and will appear down-right.", "StatusView"
|
||||
draw text 5, 140, "Its ID is 'Button1' so it would return", "StatusView"
|
||||
draw text 5, 155, "'Button1' if is pressed.", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("button 330, 270 to 390, 270, ''Button1'', ''Quit'', ''View1''")
|
||||
fi
|
||||
|
||||
if (n = 4) then
|
||||
if (L = 0) button 330, 270 to 390, 270, "Button1", "Quit", "View1"
|
||||
if (L = 0) listbox add "SourceView", "button 330, 270 to 390, 270, ''Button1'', ''Quit'', ''View1''"
|
||||
if (L = 0) listbox add "SourceView", ""
|
||||
|
||||
draw text 5, 20, "Creating views.", "StatusView"
|
||||
draw text 5, 45, "For further widgets, we should create", "StatusView"
|
||||
draw text 5, 60, "extra views inside the View1", "StatusView"
|
||||
draw text 5, 85, "The name of the view is 'View2'", "StatusView"
|
||||
draw text 5, 100, "and we want it in the upper-left corner", "StatusView"
|
||||
draw text 5, 115, "inside the Window (View1).", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("view 5, 5 to 150, 60, ''View2'', ''View1''")
|
||||
fi
|
||||
|
||||
if (n = 5) then
|
||||
if (L = 0) view 5, 5 to 150, 60, "View2", "View1"
|
||||
if (L = 0) listbox add "SourceView", "view 5, 5 to 150, 60, ''View2'', ''View1''"
|
||||
|
||||
draw text 5, 60, "We'd like to change the background", "StatusView"
|
||||
draw text 5, 75, "color of that new view...", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("draw set ''bgcolor'', 216, 230, 250, ''View2''")
|
||||
fi
|
||||
|
||||
if (n = 6) then
|
||||
if (L = 0) draw set "bgcolor", 216, 230, 250, "View2"
|
||||
if (L = 0) listbox add "SourceView", " draw set ''bgcolor'', 216, 230, 250, ''View2''"
|
||||
if (L = 0) listbox add "SourceView", ""
|
||||
|
||||
draw text 5, 20, "Radiobuttons.", "StatusView"
|
||||
draw text 5, 45, "Now we drop a radiobutton", "StatusView"
|
||||
draw text 5, 60, "in the new view.", "StatusView"
|
||||
draw text 5, 85, "Note that we have to use the", "StatusView"
|
||||
draw text 5, 100, "coordinates of 'View2' for everything", "StatusView"
|
||||
draw text 5, 115, "we want to put into it!", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("radiobutton 5, 10, ''rb1'', ''Radiobutton 1'', 0, ''View2''")
|
||||
fi
|
||||
|
||||
if (n = 7) then
|
||||
draw text 5, 20, "Our radiobutton should", "StatusView"
|
||||
draw text 15, 45, "appear at 5, 10 on 'View2',", "StatusView"
|
||||
draw text 15, 60, "be named 'RadioButton 1'", "StatusView"
|
||||
draw text 15, 75, "have the ID 'rb1'", "StatusView"
|
||||
draw text 15, 90, "not be activated (activated = 0)", "StatusView"
|
||||
draw text 5, 115, "It will return the ID and if", "StatusView"
|
||||
draw text 5, 130, "not activated = 0", "StatusView"
|
||||
draw text 5, 145, "activated = 1", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
fi
|
||||
|
||||
if (n = 8) then
|
||||
if (L = 0) radiobutton 5, 10, "rb1", "Radiobutton 1", 0, "View2"
|
||||
if (L = 0) listbox add "SourceView", "radiobutton 5, 10, ''rb1'', ''Radiobutton 1'', 0, ''View2''"
|
||||
|
||||
draw text 5, 20, "What about another one?", "StatusView"
|
||||
draw text 5, 45, "This time activated.", "StatusView"
|
||||
draw text 5, 60, "Because they are on the same view,", "StatusView"
|
||||
draw text 5, 85, "you can switch between them.", "StatusView"
|
||||
draw text 5, 100, "Just try it out...", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on...", "StatusView"
|
||||
ShowLine("radiobutton 5, 30, ''rb2'', ''Radiobutton 2'', 1, ''View2''")
|
||||
fi
|
||||
|
||||
if (n = 9) then
|
||||
if (L = 0) radiobutton 5, 30, "rb2", "Radiobutton 2", 1, "View2"
|
||||
if (L = 0) listbox add "SourceView", "radiobutton 5, 30, ''rb2'', ''Radiobutton 2'', 1, ''View2''"
|
||||
if (L = 0) listbox add "SourceView", ""
|
||||
|
||||
draw text 5, 20, "Checkbuttons.", "StatusView"
|
||||
draw text 5, 45, "Let's make checkbuttons!", "StatusView"
|
||||
draw text 5, 60, "This time placed on 'View1' again.", "StatusView"
|
||||
draw text 5, 85, "It is named 'Checkbox 1',", "StatusView"
|
||||
draw text 5, 100, "has the ID 'cb1' and is", "StatusView"
|
||||
draw text 5, 115, "not activated.", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("checkbox 10, 70, ''cb1'', ''Checkbox 1'', 0, ''View1''")
|
||||
fi
|
||||
|
||||
if (n = 10) then
|
||||
if (L = 0) checkbox 10, 70, "cb1", "Checkbox 1", 0, "View1"
|
||||
if (L = 0) listbox add "SourceView", "checkbox 10, 60, ''cb1'', ''Checkbox 1'', 0, ''View1''"
|
||||
|
||||
draw text 5, 20, "And another one for switching...", "StatusView"
|
||||
draw text 5, 45, "This time activated.", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("checkbox 10, 90, ''cb2'', ''Checkbox 2'', 1, ''View1''")
|
||||
fi
|
||||
|
||||
if (n = 11) then
|
||||
if (L = 0) checkbox 10, 90, "cb2", "Checkbox 2", 1, "View1"
|
||||
if (L = 0) listbox add "SourceView", "checkbox 10, 60, ''cb2'', ''Checkbox 2'', 1, ''View1''"
|
||||
if (L = 0) listbox add "SourceView", ""
|
||||
|
||||
draw text 5, 20, "Textcontrol - Input from the user.", "StatusView"
|
||||
draw text 5, 45, "This shows a text inputfield with a", "StatusView"
|
||||
draw text 5, 60, "short text before it.", "StatusView"
|
||||
draw text 5, 85, "It has the ID 'tc1' and returns it, if", "StatusView"
|
||||
draw text 5, 100, "a user pressed enter after typing", "StatusView"
|
||||
draw text 5, 115, "in the textfield.", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("textcontrol 10, 120 to 180, 130, ''tc1'', ''Tell me:'', ''Text...'', ''View1''")
|
||||
fi
|
||||
|
||||
if (n = 12) then
|
||||
if (L = 0) textcontrol 10, 120 to 180, 130, "tc1", "Tell me:", "Text...", "View1"
|
||||
if (L = 0) listbox add "SourceView", "textcontrol 10, 120 to 180, 130, ''tc1'', ''Tell me:'', ''Text...'', ''View1''"
|
||||
|
||||
draw text 5, 20, "And now a listbox.", "StatusView"
|
||||
draw text 5, 45, "It's a list, where dropboxs can be added to.", "StatusView"
|
||||
draw text 5, 60, "It has the ID 'list1' and returns it,", "StatusView"
|
||||
draw text 5, 85, "followed by the chosen dropbox.", "StatusView"
|
||||
draw text 5, 100, "The '1' in here affects the scrollbars", "StatusView"
|
||||
draw text 15, 115, "0 = no scrollbar", "StatusView"
|
||||
draw text 15, 130, "1 = vertikal scrollbar", "StatusView"
|
||||
draw text 15, 145, "2 = horizontal scrollbar", "StatusView"
|
||||
draw text 15, 160, "3 = both scrollbars", "StatusView"
|
||||
draw text 5, 185, "We'll take just the vertikal one.", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("listbox 200, 10 to 380, 260, ''list1'', 1, ''View1''")
|
||||
fi
|
||||
|
||||
if (n = 13) then
|
||||
if (L = 0) listbox 200,10 to 380,260,"list1",1, "View1"
|
||||
if (L = 0) listbox add "SourceView", "listbox 200, 10 to 380, 260, ''list1'', 1, ''View1''"
|
||||
|
||||
draw text 5, 20, "Add items to the list.", "StatusView"
|
||||
draw text 5, 45, "Now let's put some items into it.", "StatusView"
|
||||
draw text 5, 60, "We will add 3 entries in the list.", "StatusView"
|
||||
draw text 5, 85, "Look on the line and then watch out", "StatusView"
|
||||
draw text 5, 100, "what happens.", "StatusView"
|
||||
draw text 5, 125, "At first we enter 'Hello World'.", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("listbox add ''list1'', ''Hello world!'''")
|
||||
fi
|
||||
|
||||
if (n = 14) then
|
||||
if (L = 0) listbox add "list1", "Hello world!"
|
||||
if (L = 0) listbox add "SourceView", "listbox add ''list1'', ''Hello world!''"
|
||||
|
||||
draw text 5, 20, "Just another entry.", "StatusView"
|
||||
draw text 5, 60, "Now we enter 'How are you?'.", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("listbox add ''list1'', ''How are you?''")
|
||||
fi
|
||||
|
||||
if (n = 15) then
|
||||
if (L = 0) listbox add "list1", "How are you?"
|
||||
if (L = 0) listbox add "SourceView", "listbox add ''list1'', ''How are you?''"
|
||||
|
||||
draw text 5, 20, "The third and last entry.", "StatusView"
|
||||
draw text 5, 45, "Last but not least, we enter", "StatusView"
|
||||
draw text 5, 60, "'I am fine' to the listbox.", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
if (L = 0) ShowLine("listbox add ''list1'', ''I am fine!''")
|
||||
fi
|
||||
|
||||
if (n = 16) then
|
||||
if (L = 0) listbox add "list1", "I am fine!"
|
||||
if (L = 0) listbox add "SourceView", "''dropbox add ''list1'', ''I am fine!''"
|
||||
if (L = 0) listbox add "SourceView", ""
|
||||
|
||||
draw text 5, 20, "Selfexplaining...", "StatusView"
|
||||
draw text 5, 45, "You see everything what differs them", "StatusView"
|
||||
draw text 5, 60, "is the text for the entry.", "StatusView"
|
||||
draw text 5, 85, "So it is important, where you place", "StatusView"
|
||||
draw text 5, 100, "the entries in the sourcecode.", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("...")
|
||||
fi
|
||||
|
||||
if (n = 17) then
|
||||
if (L = 0) draw set "highcolor", 0, 0, 0, "View1"
|
||||
if (L = 0) listbox add "SourceView", "draw set ''highcolor'', 0, 0, 0, ''View1''"
|
||||
|
||||
draw text 5, 20, "Change highcolor.", "StatusView"
|
||||
draw text 5, 45, "If you'd like to draw something", "StatusView"
|
||||
draw text 5, 60, "e.g. a rectangle, you should control", "StatusView"
|
||||
draw text 5, 75, "the background color of the view", "StatusView"
|
||||
draw text 5, 90, "which shall appear in.", "StatusView"
|
||||
draw text 5, 115, "We chose black (0, 0, 0).", "StatusView"
|
||||
draw text 5, 130, "(see sourcecode)", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("draw set ''highcolor'', 0, 0, 0, ''View1''")
|
||||
fi
|
||||
|
||||
if (n = 18) then
|
||||
draw text 5, 20, "Now we set the color, we can draw.", "StatusView"
|
||||
draw text 5, 45, "A rectangle will now be drawn", "StatusView"
|
||||
draw text 5, 60, " with the previously chosen color", "StatusView"
|
||||
draw text 5, 75, "in the window.", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("draw rect 10, 150 to 180, 190, ''View1''")
|
||||
fi
|
||||
|
||||
if (n = 19) then
|
||||
if (L = 0) draw rect 10, 150 to 180, 190, "View1"
|
||||
if (L = 0) listbox add "SourceView", "draw rect 10, 150 to 180, 190, ''View1''"
|
||||
if (L = 0) listbox add "SourceView", ""
|
||||
|
||||
draw text 5, 20, "Draw text on the rectangle.", "StatusView"
|
||||
draw text 5, 45, "Now we'll do some writing but", "StatusView"
|
||||
draw text 5, 60, "first we should control the color.", "StatusView"
|
||||
draw text 5, 85, "The highcolor is the color the", "StatusView"
|
||||
draw text 5, 100, "text will be in.", "StatusView"
|
||||
draw text 5, 125, "We chose red here.", "StatusView"
|
||||
draw text 5, 205, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("draw set ''highcolor'', 255, 0, 0, ''View1''")
|
||||
fi
|
||||
|
||||
if (n = 20) then
|
||||
if (L = 0) draw set "highcolor", 255, 0, 0, "View1"
|
||||
if (L = 0) draw set "lowcolor", 0, 0, 0, "View1"
|
||||
if (L = 0) listbox add "SourceView", "draw set ''highcolor'', 255, 0, 0, ''View1''"
|
||||
|
||||
draw text 5, 20, "Font -type and -size.", "StatusView"
|
||||
draw text 5, 45, "Next we have to define the", "StatusView"
|
||||
draw text 5, 60, "fonttype and its size.", "StatusView"
|
||||
draw text 5, 85, "You can see the font-idents best", "StatusView"
|
||||
draw text 5, 100, "in GoBe productive or something", "StatusView"
|
||||
draw text 5, 115, "like that.", "StatusView"
|
||||
draw text 5, 200, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("draw set ''Zurich, Bold, 24'', ''View1''")
|
||||
fi
|
||||
|
||||
if (n = 21) then
|
||||
if (L = 0) draw set "Zurich, Bold, 24", "View1"
|
||||
if (L = 0) listbox add "SourceView", "draw set ''Zurich, Bold, 24'', ''View1''"
|
||||
|
||||
draw text 5, 20, "Let's go writing.", "StatusView"
|
||||
draw text 5, 45, "The text shall appear in red", "StatusView"
|
||||
draw text 5, 60, "right on the rectangle.", "StatusView"
|
||||
draw text 5, 85, "We will write the word", "StatusView"
|
||||
draw text 5, 100, "'easy", "StatusView"
|
||||
draw text 5, 115, "", "StatusView"
|
||||
draw text 5, 200, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("draw text 40, 180, ''easy'', ''View1''")
|
||||
fi
|
||||
|
||||
if (n = 22) then
|
||||
if (L = 0) draw text 40, 180, "easy", "View1"
|
||||
if (L = 0) listbox add "SourceView", "draw text 40, 180, ''easy'', ''View1''"
|
||||
|
||||
draw text 5, 20, "Dropboxes.", "StatusView"
|
||||
draw text 5, 45, "If you want to provide the user a selection", "StatusView"
|
||||
draw text 5, 60, "on a small room, take a dropbox!", "StatusView"
|
||||
draw text 5, 85, "This dropbox has the ID ''db1'' and returns", "StatusView"
|
||||
draw text 5, 100, "it, if there are entries in it, together with", "StatusView"
|
||||
draw text 5, 115, "that entry.", "StatusView"
|
||||
draw text 5, 200, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("dropbox 10, 200 to 180, 220, ''db1'', ''Choose'', ''View1''")
|
||||
fi
|
||||
|
||||
if (n = 23) then
|
||||
if (L = 0) dropbox 10, 200 to 180, 220, "db1", "Choose", "View1"
|
||||
if (L = 0) listbox add "SourceView", "dropbox 10, 200 to 180, 220, ''db1'', ''Choose'', ''View1''"
|
||||
|
||||
draw text 5, 20, "Add items to the dropbox.", "StatusView"
|
||||
draw text 5, 45, "Adding items to a dropbox is the same", "StatusView"
|
||||
draw text 5, 60, "procedure as for listboxes.", "StatusView"
|
||||
draw text 5, 85, "We give the ID of the dropbox", "StatusView"
|
||||
draw text 5, 100, "which is 'db1' and the name, the", "StatusView"
|
||||
draw text 5, 115, "dropbox should have, followed by the", "StatusView"
|
||||
draw text 5, 130, "view the dropbox is on.", "StatusView"
|
||||
draw text 5, 155, "We'll make three entries again and", "StatusView"
|
||||
draw text 5, 170, "start with that line below. ", "StatusView"
|
||||
draw text 5, 200, "Click on 'Next step' to go on ...", "StatusView"
|
||||
ShowLine("dropbox add ''db1'', ''yab interpreter''")
|
||||
fi
|
||||
|
||||
if (n = 24) then
|
||||
if (L = 0) dropbox add "db1", "yab interpreter"
|
||||
if (L = 0) listbox add "SourceView", "dropbox add ''db1'', ''yab interpreter''"
|
||||
ShowLine("dropbox add ''db1'', ''yet another''")
|
||||
sleep 0.5
|
||||
if (L = 0) dropbox add "db1", "yet another"
|
||||
if (L = 0) listbox add "SourceView", "dropbox add ''db1'', ''yet another''"
|
||||
ShowLine("dropbox add ''db1'', ''basic''")
|
||||
sleep 0.5
|
||||
if (L = 0) dropbox add "db1", "basic"
|
||||
if (L = 0) listbox add "SourceView", "dropbox add ''db1'', ''basic''"
|
||||
|
||||
draw text 5, 20, "That's it for today, man!", "StatusView"
|
||||
draw text 5, 45, "More help do you get from the file", "StatusView"
|
||||
draw text 5, 60, "DONE_AND_TODO", "StatusView"
|
||||
draw text 5, 85, "", "StatusView"
|
||||
draw text 5, 100, "To be continued...", "StatusView"
|
||||
draw text 5, 115, "", "StatusView"
|
||||
draw text 5, 200, "Click on 'Next step' to go insane...", "StatusView"
|
||||
ShowLine("Nothing more to tell ...")
|
||||
fi
|
||||
|
||||
if (n = 25) then
|
||||
|
||||
|
||||
draw text 5, 20, "That's it for today, man!", "StatusView"
|
||||
draw text 5, 45, "More help do you get from the file", "StatusView"
|
||||
draw text 5, 60, "DONE_AND_TODO", "StatusView"
|
||||
draw text 5, 85, "", "StatusView"
|
||||
draw text 5, 100, "To be continued...", "StatusView"
|
||||
draw text 5, 115, "", "StatusView"
|
||||
draw text 5, 200, "Click on 'Next step' to go insane...", "StatusView"
|
||||
ShowLine("Nothing more to tell ...")
|
||||
|
||||
stp = stp-1
|
||||
fi
|
||||
|
||||
return
|
||||
end sub
|
||||
|
||||
sub ShowLine(CurrLine$)
|
||||
|
||||
draw flush "LineView"
|
||||
draw text 10, 17, CurrLine$, "LineView"
|
||||
|
||||
return
|
||||
end sub
|
||||
30
yab-IDE/Programs/Examples/IconWorld.yab
Executable file
@@ -0,0 +1,30 @@
|
||||
#!yab
|
||||
|
||||
window open 100,100 to 600,600, "Main", "IconWorld"
|
||||
|
||||
systempath$ = "/boot/system/apps/Mail"
|
||||
|
||||
draw text 70,30, "bitmap get \"BMP_icon\", \"path\", \"" + systempath$ +"\"", "Main"
|
||||
bitmap get "BMP_icon", "path", systempath$
|
||||
draw bitmap 10, 10, "BMP_icon", "alpha", "Main"
|
||||
bitmap remove "BMP_icon"
|
||||
|
||||
draw text 70,70, "bitmap get \"BMP_icon\", \"mime16\", \"application/x-vnd.Be-MAIL\"", "Main"
|
||||
bitmap get "BMP_icon", "mime16", "application/x-vnd.Be-MAIL"
|
||||
draw bitmap 10, 60, "BMP_icon", "alpha", "Main"
|
||||
bitmap remove "BMP_icon"
|
||||
|
||||
draw text 70,110, "bitmap get \"BMP_icon\", \"mime32\", \"application/x-vnd.Be-MAIL\"", "Main"
|
||||
bitmap get "BMP_icon", "mime32", "application/x-vnd.Be-MAIL"
|
||||
draw bitmap 10, 90, "BMP_icon", "alpha", "Main"
|
||||
bitmap remove "BMP_icon"
|
||||
|
||||
draw text 70,150, "bitmap get 32, \"BMP_icon\", \"" + systempath$ + "\"", "Main"
|
||||
bitmap get 32, "BMP_icon", systempath$
|
||||
draw bitmap 10, 130, "BMP_icon", "alpha", "Main"
|
||||
bitmap remove "BMP_icon"
|
||||
|
||||
while(not instr(message$, "Quit"))
|
||||
wend
|
||||
|
||||
window close "Main"
|
||||
32
yab-IDE/Programs/Examples/ImageWorld.yab
Executable file
@@ -0,0 +1,32 @@
|
||||
#!yab
|
||||
|
||||
window open 200,200 to 520,391, "MainView", "ImageWorld"
|
||||
button 50,163 to 270,183, "Ok_", "Ok", "MainView"
|
||||
|
||||
err = draw image 0,0, "img/image.png", "MainView"
|
||||
|
||||
if(err = 1) then
|
||||
alert "Problem while loading image.png!", "Quit", "stop"
|
||||
window close "MainView"
|
||||
exit 1
|
||||
endif
|
||||
|
||||
alert "This shows how to show Images in your windows.", "Ok", "idea"
|
||||
|
||||
inloop = true
|
||||
while(inloop)
|
||||
msg$ = message$
|
||||
|
||||
switch msg$
|
||||
case "Ok_|":
|
||||
case "MainView:_QuitRequested|":
|
||||
inloop = false
|
||||
break
|
||||
|
||||
end switch
|
||||
|
||||
wend
|
||||
|
||||
exit
|
||||
|
||||
|
||||
69
yab-IDE/Programs/Examples/JDemo.yab
Executable file
@@ -0,0 +1,69 @@
|
||||
#!yab
|
||||
|
||||
// JDemo - just a smiley
|
||||
// by DasJott
|
||||
|
||||
window open 300,100 to 800,500,"mainview","Smiley - DEMO"
|
||||
window set "mainview", "flags","not-zoomable, not-h-resizable, not-v-resizable"
|
||||
draw set "bgcolor", 0,0,0,"mainview"
|
||||
draw set "highcolor",255,255,0,"mainview"
|
||||
draw circle 250,200,180,"mainview"
|
||||
|
||||
// Eyes
|
||||
draw set "highcolor",0,0,0,"mainview"
|
||||
draw circle 170,110,20,"mainview"
|
||||
view 310,90 to 350,130,"twinkleview","mainview"
|
||||
draw set "bgcolor",255,255,0,"twinkleview"
|
||||
draw set "highcolor",0,0,0,"twinkleview"
|
||||
draw circle 20,20,20,"twinkleview"
|
||||
|
||||
// Smiling mouth
|
||||
view 140,220 to 360,320,"mouthview","mainview"
|
||||
draw set "bgcolor",255,255,0,"mouthview"
|
||||
draw set "highcolor",0,0,0,"mouthview"
|
||||
draw set 1, "HighSolidFill"
|
||||
draw circle 110,-11, 110,"mouthview"
|
||||
draw set 0, "HighSolidFill"
|
||||
|
||||
button 450,370 to 490,390,"Exit","Quit","mainview"
|
||||
|
||||
|
||||
|
||||
inloop = true
|
||||
while (inloop = true)
|
||||
msg$ = message$
|
||||
|
||||
if (t < 20) then
|
||||
draw flush "twinkleview"
|
||||
draw ellipse 20,20, 20, 20-t,"twinkleview"
|
||||
fi
|
||||
|
||||
if (t > 20 and t < 41) then
|
||||
draw flush "twinkleview"
|
||||
draw ellipse 20,20, 20, t-20,"twinkleview"
|
||||
fi
|
||||
|
||||
if (t = 100) t = 0
|
||||
|
||||
t = t+1
|
||||
n = n+1
|
||||
|
||||
if(n = 200) then
|
||||
draw flush "mouthview"
|
||||
draw circle 110,-11, 110,"mouthview"
|
||||
n = 0
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
if(n = 0) then
|
||||
draw flush "mouthview"
|
||||
draw set 1, "HighSolidFill"
|
||||
draw circle 110,-11, 110,"mouthview"
|
||||
draw set 0, "HighSolidFill"
|
||||
fi
|
||||
|
||||
if (msg$ = "Exit|") inloop = false
|
||||
if (msg$ = "mainview:_QuitRequested|") inloop = false
|
||||
wend
|
||||
|
||||
window close "mainview"
|
||||
115
yab-IDE/Programs/Examples/Keyboard.yab
Executable file
@@ -0,0 +1,115 @@
|
||||
#!yab
|
||||
|
||||
window open 200, 200 to 710, 600, "MainView" ,"YAB-Keyboard"
|
||||
window set "MainView", "flags", "not-h-resizable, not-v-resizable"
|
||||
|
||||
view 10,10 to 500, 180, "TextView", "MainView"
|
||||
draw set "bgcolor", 0, 50, 0, "TextView"
|
||||
draw set "lowcolor", 0, 50, 0, "TextView"
|
||||
draw set "highcolor", 245, 245, 245, "TextView"
|
||||
draw set "Zurich, Bold, 20", "TextView"
|
||||
|
||||
button 10, 200 to 50, 240, "Button:Q", "Q", "MainView"
|
||||
button 60, 200 to 100, 240, "Button:W", "W", "MainView"
|
||||
button 110, 200 to 150, 240, "Button:E", "E", "MainView"
|
||||
button 160, 200 to 200, 240, "Button:R", "R", "MainView"
|
||||
button 210, 200 to 250, 240, "Button:T", "T", "MainView"
|
||||
button 260, 200 to 300, 240, "Button:Z", "Z", "MainView"
|
||||
button 310, 200 to 350, 240, "Button:U", "U", "MainView"
|
||||
button 360, 200 to 400, 240, "Button:I", "I", "MainView"
|
||||
button 410, 200 to 450, 240, "Button:O", "O", "MainView"
|
||||
button 460, 200 to 500, 240, "Button:P", "P", "MainView"
|
||||
|
||||
button 20, 250 to 60, 290, "Button:A", "A", "MainView"
|
||||
button 70, 250 to 110, 290, "Button:S", "S", "MainView"
|
||||
button 120, 250 to 160, 290, "Button:D", "D", "MainView"
|
||||
button 170, 250 to 210, 290, "Button:F", "F", "MainView"
|
||||
button 220, 250 to 260, 290, "Button:G", "G", "MainView"
|
||||
button 270, 250 to 310, 290, "Button:H", "H", "MainView"
|
||||
button 320, 250 to 360, 290, "Button:J", "J", "MainView"
|
||||
button 370, 250 to 410, 290, "Button:K", "K", "MainView"
|
||||
button 420, 250 to 460, 290, "Button:L", "L", "MainView"
|
||||
button 465, 250 to 500, 340, "Enter_", "Enter", "MainView"
|
||||
|
||||
button 30, 300 to 70, 340, "Button:Y", "Y", "MainView"
|
||||
button 80, 300 to 120, 340, "Button:X", "X", "MainView"
|
||||
button 130, 300 to 170, 340, "Button:C", "C", "MainView"
|
||||
button 180, 300 to 220, 340, "Button:V", "V", "MainView"
|
||||
button 230, 300 to 270, 340, "Button:B", "B", "MainView"
|
||||
button 280, 300 to 320, 340, "Button:N", "N", "MainView"
|
||||
button 330, 300 to 370, 340, "Button:M", "M", "MainView"
|
||||
button 380, 300 to 415, 340, "Button:,", ",", "MainView"
|
||||
button 425, 300 to 460, 340, "Button:.", ".", "MainView"
|
||||
|
||||
button 10, 350 to 60, 390, "About_", "About", "MainView"
|
||||
button 70, 350 to 430, 390, "Spacebar_", "", "MainView"
|
||||
button 440, 350 to 500, 390, "Clear_", "Clear all", "MainView"
|
||||
|
||||
a = 10 : b = 25
|
||||
dim choice$(1)
|
||||
inloop = true
|
||||
while (inloop)
|
||||
msg$ = message$
|
||||
if (split(msg$, choice$(), ":|") >= 2) btn$ = choice$(2)
|
||||
if (msg$ <> "") print msg$
|
||||
|
||||
switch msg$
|
||||
|
||||
case "MainView:_QuitRequested|"
|
||||
inloop = false
|
||||
break
|
||||
|
||||
case "Button:"+btn$+"|"
|
||||
draw text a, b, btn$, "TextView"
|
||||
if (btn$ = "J" ) then
|
||||
a = a+10
|
||||
elsif (btn$ = "I" or btn$ = "," or btn$ = ".") then
|
||||
a = a+6
|
||||
elsif (btn$ = "W") then
|
||||
a = a+20
|
||||
elsif (btn$ = "F" or btn$ = "T") then
|
||||
a = a+12
|
||||
elsif (btn$ = "M") then
|
||||
a = a+18
|
||||
elsif (btn$ = "N" or btn$ = "G" or btn$ = "Q" or btn$ = "O") then
|
||||
a=a+15
|
||||
else
|
||||
a = a+14
|
||||
fi
|
||||
break
|
||||
|
||||
case "Enter_|"
|
||||
a = 10 : b = b+25
|
||||
break
|
||||
|
||||
case "Spacebar_|"
|
||||
a = a+12
|
||||
break
|
||||
|
||||
case "Clear_|"
|
||||
draw flush "TextView"
|
||||
a = 10 : b = 25
|
||||
break
|
||||
|
||||
case "About_|"
|
||||
ShowAbout()
|
||||
break
|
||||
|
||||
end switch
|
||||
sleep 0.01
|
||||
wend
|
||||
exit
|
||||
|
||||
sub ShowAbout()
|
||||
for i = 0 to 215
|
||||
msg$ = message$
|
||||
draw flush "TextView"
|
||||
draw text 200, 190-i, "This is:", "TextView"
|
||||
draw text 160, 215-i, "YAB - Keyboard", "TextView"
|
||||
if (msg$ = "About_|") break
|
||||
sleep 0.01
|
||||
next i
|
||||
a = 10 : b = 25
|
||||
draw flush "TextView"
|
||||
return
|
||||
end sub
|
||||
401
yab-IDE/Programs/Examples/Loop-World.yab
Executable file
@@ -0,0 +1,401 @@
|
||||
#!yab
|
||||
|
||||
// Main background colors:
|
||||
r = 206 : g = 226 : b = 236
|
||||
|
||||
// Open main window:
|
||||
window open 100, 250 to 600, 650, "MainView", "Loop-World"
|
||||
window set "MainView", "flags","not-zoomable"
|
||||
window set "MainView", "minimumto",500,400
|
||||
window set "MainView", "maximumto",500,400
|
||||
draw set "bgcolor", r, g, b, "MainView"
|
||||
draw set "lowcolor", r-75, g-75, b-75, "MainView"
|
||||
draw line 10, 365 to 490, 365, "MainView"
|
||||
draw set "lowcolor", r+40, g+40, b+40, "MainView"
|
||||
draw line 10, 366 to 490, 366, "MainView"
|
||||
draw set "lowcolor", r, g, b, "MainView"
|
||||
draw set "Swis721 BT, Bold, 14", "MainView"
|
||||
draw text 10, 20, "Loop-World", "MainView"
|
||||
draw text 200, 20, "Sourcecode:", "MainView"
|
||||
|
||||
|
||||
|
||||
// make views inside the main window:
|
||||
view 0, 30 to 190, 360, "ExplainView", "MainView"
|
||||
draw set "bgcolor", r, g, b, "ExplainView"
|
||||
draw set "Swis721 BT, Roman, 10", "ExplainView"
|
||||
|
||||
view 200, 30 to 490, 360, "SourceView", "MainView"
|
||||
draw set "bgcolor", r+39, g+39, b+39, "SourceView"
|
||||
draw set "Swis721 BT, Roman, 10", "SourceView"
|
||||
|
||||
//draw text 10, 265, "Choose a kind of loop:", "MainView"
|
||||
button 10, 370 to 60, 390, "For_Loop_", "for/next", "MainView"
|
||||
button 65, 370 to 115, 390, "While_Loop_", "while", "MainView"
|
||||
button 120, 370 to 170, 390, "Do_Loop_", "do/loop", "MainView"
|
||||
button 175, 370 to 225, 390, "Sub_Loop_", "sub m(n)", "MainView"
|
||||
button 230, 370 to 280, 390, "Other_Loop_", "Other", "MainView"
|
||||
//button 285, 370 to 335, 390, "None_", "None", "MainView"
|
||||
button 345, 370 to 395, 390, "None_", "Back", "MainView"
|
||||
button 405, 370 to 490, 390, "Exec_", "Execute", "MainView"
|
||||
|
||||
dim SourceLine$(20)
|
||||
ShowSource("none")
|
||||
|
||||
// mainloop of the program:
|
||||
dim cmd$(1)
|
||||
inloop = true
|
||||
while (inloop)
|
||||
msg$ = message$
|
||||
if (split(msg$, cmd$(), ":|") > 2) item$ = cmd$(2)
|
||||
|
||||
if (msg$ <> "") print msg$
|
||||
|
||||
switch msg$
|
||||
|
||||
case "For_Loop_|"
|
||||
if (CurrentSource$ = "For_Loop") break
|
||||
ShowSource("For_Loop")
|
||||
break
|
||||
|
||||
case "While_Loop_|"
|
||||
if (CurrentSource$ = "While_Loop") break
|
||||
ShowSource("While_Loop")
|
||||
break
|
||||
|
||||
case "Do_Loop_|"
|
||||
if (CurrentSource$ = "Do_Loop") break
|
||||
ShowSource("Do_Loop")
|
||||
break
|
||||
|
||||
case "Sub_Loop_|"
|
||||
if (CurrentSource$ = "Sub_Loop") break
|
||||
ShowSource("Sub_Loop")
|
||||
break
|
||||
|
||||
case "Other_Loop_|"
|
||||
if (CurrentSource$ = "Other_Loop") break
|
||||
ShowSource("Other_Loop")
|
||||
break
|
||||
|
||||
case "None_|"
|
||||
if (CurrentSource$ = "none") break
|
||||
ShowSource("none")
|
||||
break
|
||||
|
||||
case "Exec_|"
|
||||
if (DemoWin = true) break
|
||||
if (CurrentSource$ = "none") break
|
||||
ExecSource(CurrentSource$)
|
||||
break
|
||||
|
||||
case "Quit_|"
|
||||
case "MainView:_QuitRequested|"
|
||||
inloop = false
|
||||
break
|
||||
|
||||
end switch
|
||||
sleep 0.01
|
||||
wend
|
||||
exit
|
||||
|
||||
sub ShowSource(CurrSource$)
|
||||
CurrentSource$ = CurrSource$
|
||||
draw flush "SourceView"
|
||||
draw flush "ExplainView"
|
||||
|
||||
draw text 5, 10, "#!yab", "SourceView"
|
||||
draw text 5, 35, "window open 100, 100 to 200, 200, ''MainView'', ''Loop''", "SourceView"
|
||||
draw text 5, 50, "window set ''MainView'', ''minimumto'',100,100", "SourceView"
|
||||
draw text 5, 65, "window set ''MainView'', ''maximumto'',100,100", "SourceView"
|
||||
|
||||
if (CurrSource$ = "none") then
|
||||
draw text 5, 10, "Welcome to LoopWorld!", "ExplainView"
|
||||
draw text 5, 35, "This program will show you the different", "ExplainView"
|
||||
draw text 5, 50, "kinds of loops in yab.", "ExplainView"
|
||||
draw text 5, 75, "On the left you see the sourcecode", "ExplainView"
|
||||
draw text 5, 90, "that is used in the examples.", "ExplainView"
|
||||
draw text 5, 105, "Please see GUI-World(2), if you want to", "ExplainView"
|
||||
draw text 5, 120, "know more about that code, as I won't", "ExplainView"
|
||||
draw text 5, 135, "explain that here in Loop-World.", "ExplainView"
|
||||
draw text 5, 160, "Each loop will run about 10 seconds", "ExplainView"
|
||||
draw text 5, 175, "and show its loop number and its", "ExplainView"
|
||||
draw text 5, 190, "name in the window.", "ExplainView"
|
||||
draw text 5, 205, "Therefore I will simply execute the", "ExplainView"
|
||||
draw text 5, 220, "whole sourcecode shown right.", "ExplainView"
|
||||
draw text 5, 245, "Select the loop you want to know more", "ExplainView"
|
||||
draw text 5, 260, "about with the buttons down right.", "ExplainView"
|
||||
draw text 5, 285, "Note: While each loop is running", "ExplainView"
|
||||
draw text 5, 300, "this main window will be blocked !", "ExplainView"
|
||||
|
||||
z = 1
|
||||
SourceLine$(1) = "// the loop will appear here."
|
||||
fi
|
||||
|
||||
if (CurrSource$ = "For_Loop") then
|
||||
draw text 5, 10, "The 'for next' loop.", "ExplainView"
|
||||
|
||||
draw text 5, 35, "The 'for next' loop works in a defined", "ExplainView"
|
||||
draw text 5, 50, "range that must be set.", "ExplainView"
|
||||
|
||||
draw text 5, 75, "This loop is counting the range from", "ExplainView"
|
||||
draw text 5, 90, "the first to the last number.", "ExplainView"
|
||||
draw text 5, 105, "For each count it puts the number into", "ExplainView"
|
||||
draw text 5, 120, "the given variable and executes the lines", "ExplainView"
|
||||
draw text 5, 135, "down to 'next'.", "ExplainView"
|
||||
|
||||
draw text 5, 160, "", "ExplainView"
|
||||
draw text 5, 175, "", "ExplainView"
|
||||
draw text 5, 190, "", "ExplainView"
|
||||
draw text 5, 205, "", "ExplainView"
|
||||
draw text 5, 220, "", "ExplainView"
|
||||
draw text 5, 245, "", "ExplainView"
|
||||
draw text 5, 260, "", "ExplainView"
|
||||
|
||||
draw text 5, 285, "", "ExplainView"
|
||||
draw text 5, 300, "", "ExplainView"
|
||||
|
||||
z = 7
|
||||
SourceLine$(0) = ""
|
||||
SourceLine$(1) = "for n = 1 to 10"
|
||||
SourceLine$(2) = " draw flush ''MainView''"
|
||||
SourceLine$(3) = " draw text 50, 50, str$(n), ''MainView''"
|
||||
SourceLine$(4) = " draw text 10, 90, ''For_Loop'', ''MainView''"
|
||||
SourceLine$(5) = " sleep 1"
|
||||
SourceLine$(6) = "next n"
|
||||
SourceLine$(7) = "exit"
|
||||
fi
|
||||
|
||||
if (CurrSource$ = "While_Loop") then
|
||||
draw text 5, 10, "The 'while wend' loop.", "ExplainView"
|
||||
|
||||
draw text 5, 35, "", "ExplainView"
|
||||
draw text 5, 50, "", "ExplainView"
|
||||
|
||||
draw text 5, 75, "", "ExplainView"
|
||||
draw text 5, 90, "", "ExplainView"
|
||||
draw text 5, 105, "", "ExplainView"
|
||||
draw text 5, 120, "", "ExplainView"
|
||||
draw text 5, 135, "", "ExplainView"
|
||||
|
||||
draw text 5, 160, "", "ExplainView"
|
||||
draw text 5, 175, "", "ExplainView"
|
||||
draw text 5, 190, "", "ExplainView"
|
||||
draw text 5, 205, "", "ExplainView"
|
||||
draw text 5, 220, "", "ExplainView"
|
||||
draw text 5, 245, "", "ExplainView"
|
||||
draw text 5, 260, "", "ExplainView"
|
||||
|
||||
draw text 5, 285, "", "ExplainView"
|
||||
draw text 5, 300, "", "ExplainView"
|
||||
|
||||
z = 9
|
||||
SourceLine$(0) = ""
|
||||
SourceLine$(1) = "n = 1"
|
||||
SourceLine$(2) = "while (n < 11)"
|
||||
SourceLine$(3) = " draw flush ''MainView''"
|
||||
SourceLine$(4) = " draw text 50, 50, str$(n), ''MainView''"
|
||||
SourceLine$(5) = " draw text 10, 90, ''While_Loop'', ''MainView''"
|
||||
SourceLine$(6) = " n = n+1"
|
||||
SourceLine$(7) = " sleep 1"
|
||||
SourceLine$(8) = "wend"
|
||||
SourceLine$(9) = "exit"
|
||||
fi
|
||||
|
||||
if (CurrSource$ = "Do_Loop") then
|
||||
draw text 5, 10, "The 'do loop' loop", "ExplainView"
|
||||
|
||||
draw text 5, 35, "", "ExplainView"
|
||||
draw text 5, 50, "", "ExplainView"
|
||||
|
||||
draw text 5, 75, "", "ExplainView"
|
||||
draw text 5, 90, "", "ExplainView"
|
||||
draw text 5, 105, "", "ExplainView"
|
||||
draw text 5, 120, "", "ExplainView"
|
||||
draw text 5, 135, "", "ExplainView"
|
||||
|
||||
draw text 5, 160, "", "ExplainView"
|
||||
draw text 5, 175, "", "ExplainView"
|
||||
draw text 5, 190, "", "ExplainView"
|
||||
draw text 5, 205, "", "ExplainView"
|
||||
draw text 5, 220, "", "ExplainView"
|
||||
draw text 5, 245, "", "ExplainView"
|
||||
draw text 5, 260, "", "ExplainView"
|
||||
|
||||
draw text 5, 285, "", "ExplainView"
|
||||
draw text 5, 300, "", "ExplainView"
|
||||
|
||||
z = 8
|
||||
SourceLine$(0) = ""
|
||||
SourceLine$(1) = "do"
|
||||
SourceLine$(2) = " n = n+1"
|
||||
SourceLine$(3) = " draw flush ''MainView''"
|
||||
SourceLine$(4) = " draw text 50, 50, str$(n), ''MainView''"
|
||||
SourceLine$(5) = " draw text 10, 90, ''Do_Loop'', ''MainView''"
|
||||
SourceLine$(6) = " sleep 1"
|
||||
SourceLine$(7) = "loop"
|
||||
SourceLine$(8) = "exit"
|
||||
fi
|
||||
|
||||
if (CurrSource$ = "Sub_Loop") then
|
||||
draw text 5, 10, "The 'sub' loop.", "ExplainView"
|
||||
|
||||
draw text 5, 35, "", "ExplainView"
|
||||
draw text 5, 50, "", "ExplainView"
|
||||
|
||||
draw text 5, 75, "", "ExplainView"
|
||||
draw text 5, 90, "", "ExplainView"
|
||||
draw text 5, 105, "", "ExplainView"
|
||||
draw text 5, 120, "", "ExplainView"
|
||||
draw text 5, 135, "", "ExplainView"
|
||||
|
||||
draw text 5, 160, "", "ExplainView"
|
||||
draw text 5, 175, "", "ExplainView"
|
||||
draw text 5, 190, "", "ExplainView"
|
||||
draw text 5, 205, "", "ExplainView"
|
||||
draw text 5, 220, "", "ExplainView"
|
||||
draw text 5, 245, "", "ExplainView"
|
||||
draw text 5, 260, "", "ExplainView"
|
||||
|
||||
draw text 5, 285, "", "ExplainView"
|
||||
draw text 5, 300, "", "ExplainView"
|
||||
|
||||
z = 13
|
||||
SourceLine$(0) = ""
|
||||
SourceLine$(1) = "Counter(n)"
|
||||
SourceLine$(2) = ""
|
||||
SourceLine$(3) = "sub Counter(n)"
|
||||
SourceLine$(4) = " if (n < 11) then"
|
||||
SourceLine$(5) = " draw flush ''MainView''"
|
||||
SourceLine$(6) = " draw text 50, 50, str$(n), ''MainView''"
|
||||
SourceLine$(7) = " draw text 10, 90, ''Sub_Loop'', ''MainView''"
|
||||
SourceLine$(8) = " sleep 1"
|
||||
SourceLine$(9) = " Counter(n+1)"
|
||||
SourceLine$(10) = " fi"
|
||||
SourceLine$(11) = " return"
|
||||
SourceLine$(12) = "end sub"
|
||||
SourceLine$(13) = "exit"
|
||||
fi
|
||||
|
||||
if (CurrSource$ = "Other_Loop") then
|
||||
draw text 5, 10, "Other loops!", "ExplainView"
|
||||
|
||||
draw text 5, 35, "There are no other loops known", "ExplainView"
|
||||
draw text 5, 50, "or known to be described.", "ExplainView"
|
||||
|
||||
draw text 5, 75, "If there is one it could be entered", "ExplainView"
|
||||
draw text 5, 90, "very easily.", "ExplainView"
|
||||
draw text 5, 105, "Just see the source, yabman! ;-)", "ExplainView"
|
||||
|
||||
z = 2
|
||||
SourceLine$(0) = ""
|
||||
SourceLine$(1) = "// there is no other loop, my friend."
|
||||
SourceLine$(2) = "exit"
|
||||
fi
|
||||
|
||||
for s = 0 to z
|
||||
draw text 5, 80+s*15, SourceLine$(s), "SourceView"
|
||||
next s
|
||||
|
||||
return
|
||||
end sub
|
||||
|
||||
sub ExecSource(ExecLoop$)
|
||||
DemoWin = true
|
||||
window open 100, 100 to 200, 200, "DemoView", "Loop"
|
||||
window set "DemoView", "minimumto", 100, 100
|
||||
window set "DemoView", "maximumto", 100, 100
|
||||
|
||||
if (ExecLoop$ = "For_Loop") then
|
||||
for n = 1 to 10
|
||||
draw flush "DemoView"
|
||||
draw text 50, 50, str$(n), "DemoView"
|
||||
draw text 10, 90, ExecLoop$, "DemoView"
|
||||
sleep 1
|
||||
next n
|
||||
window close "DemoView"
|
||||
fi
|
||||
|
||||
if (ExecLoop$ = "While_Loop") then
|
||||
n = 1
|
||||
while (n < 11)
|
||||
draw flush "DemoView"
|
||||
draw text 50, 50, str$(n), "DemoView"
|
||||
draw text 10, 90, ExecLoop$, "DemoView"
|
||||
sleep 1
|
||||
n = n+1
|
||||
wend
|
||||
window close "DemoView"
|
||||
fi
|
||||
|
||||
if (ExecLoop$ = "Do_Loop") then
|
||||
n = 0
|
||||
do
|
||||
msg$ = message$
|
||||
if (msg$ = "QuitDemo_|") break
|
||||
n = n+1
|
||||
draw flush "DemoView"
|
||||
draw text 50, 50, str$(n), "DemoView"
|
||||
draw text 10, 90, ExecLoop$, "DemoView"
|
||||
|
||||
if (n = 11) then
|
||||
draw text 5, 100, "You see that this loop won't be ended", "ExplainView"
|
||||
draw text 5, 115, "by itself.", "ExplainView"
|
||||
fi
|
||||
|
||||
if (n = 13) draw text 5, 130, "For this, we need a Quit-button!", "ExplainView"
|
||||
|
||||
if (n = 15) then
|
||||
draw flush "SourceView"
|
||||
draw text 5, 10, "#!yab", "SourceView"
|
||||
draw text 5, 35, "window open 100, 100 to 200, 200, ''MainView'', ''Loop''", "SourceView"
|
||||
draw text 5, 50, "window set ''MainView'', ''minimumto'',100,100", "SourceView"
|
||||
draw text 5, 65, "window set ''MainView'', ''maximumto'',100,100''", "SourceView"
|
||||
SourceLine$(0) = "button 30, 70 to 90, 90, ''Quit_'', ''Quit'', ''MainView''"
|
||||
SourceLine$(1) = ""
|
||||
SourceLine$(2) = "do"
|
||||
SourceLine$(3) = " msg$ = message$"
|
||||
SourceLine$(4) = " if (msg$ = ''Quit_'') break"
|
||||
SourceLine$(5) = " n = n+1"
|
||||
SourceLine$(6) = " draw flush ''MainView''"
|
||||
SourceLine$(7) = " draw text 50, 50, str$(n), ''MainView''"
|
||||
SourceLine$(8) = " draw text 10, 90, ''Do_Loop'', ''MainView''"
|
||||
SourceLine$(9) = " sleep 1"
|
||||
SourceLine$(10) = "loop"
|
||||
SourceLine$(11) = "exit"
|
||||
for s = 0 to 11
|
||||
draw text 5, 80+s*15, SourceLine$(s), "SourceView"
|
||||
next s
|
||||
button 10, 10 to 90, 30, "QuitDemo_", "Quit", "DemoView"
|
||||
draw text 5, 145, "Press the Quit button to exit that loop.", "ExplainView"
|
||||
fi
|
||||
sleep 1
|
||||
loop
|
||||
window close "DemoView"
|
||||
fi
|
||||
|
||||
if (ExecLoop$ = "Sub_Loop") then
|
||||
Counter(1)
|
||||
window close "DemoView"
|
||||
fi
|
||||
|
||||
if (ExecLoop$ = "Other_Loop") then
|
||||
sleep 0.1
|
||||
window close "DemoView"
|
||||
fi
|
||||
|
||||
msg$ = ""
|
||||
DemoWin = false
|
||||
return
|
||||
end sub
|
||||
|
||||
sub Counter(n)
|
||||
if (n < 11) then
|
||||
draw flush "DemoView"
|
||||
draw text 50, 50, str$(n), "DemoView"
|
||||
draw text 10, 90, "Sub_Loop", "DemoView"
|
||||
sleep 1
|
||||
Counter(n+1)
|
||||
fi
|
||||
return
|
||||
end sub
|
||||
283
yab-IDE/Programs/Examples/MessageWorld.yab
Executable file
@@ -0,0 +1,283 @@
|
||||
#!yab
|
||||
|
||||
// MessageWorld - shows the messages the widgets return
|
||||
// by DasJott
|
||||
|
||||
// Main background colors
|
||||
r = 206 : g = 226 : b = 246
|
||||
|
||||
// open main window
|
||||
window open 100, 200 to 600, 450, "MainView", "MessageWorld - Select a widget to be explained"
|
||||
window set "MainView", "maximumto", 500, 250
|
||||
window set "MainView", "minimumto", 500, 250
|
||||
draw set "bgcolor", r, g, b, "MainView"
|
||||
|
||||
// open view inside the main window
|
||||
view 0, 0 to 500, 180, "ContentView", "MainView" // for the contents; widgets and text.
|
||||
draw set "bgcolor", r+20, g+20, b+20, "ContentView"
|
||||
draw text 210, 60, "MessageWorld", "ContentView"
|
||||
draw text 150, 75, "Shows the messages the widgets return.", "ContentView"
|
||||
draw text 149, 100, "Please select the widget to be explained.", "ContentView"
|
||||
draw text 125, 125, "Please use each widget to get the message shown.", "ContentView"
|
||||
draw text 135, 140, "The sourcecode is also shown for each widget.", "ContentView"
|
||||
|
||||
view 0, 181 to 500, 199, "MessageView", "MainView" // for the message display
|
||||
draw set "bgcolor", r+20, g+20, b+20, "MessageView"
|
||||
draw set "lowcolor", r+10, g+10, b+10, "MessageView"
|
||||
draw set "highcolor", 255, 0, 0, "MessageView"
|
||||
draw set "Swis721 BT, Roman, 12", "MessageView"
|
||||
|
||||
view 0, 200 to 500, 250, "SwitchView", "MainView" // for the buttons
|
||||
draw set "bgcolor", r, g, b, "SwitchView"
|
||||
|
||||
//color the buttons
|
||||
for cc = 0 to 25
|
||||
draw set "highcolor", r+30-(2*cc), g+30-(2*cc), b+30-(2*cc), "SwitchView"
|
||||
draw line 0, cc to 500, cc, "SwitchView"
|
||||
next cc
|
||||
for cc = 0 to 25
|
||||
draw set "highcolor", r+30-(2*cc), g+30-(2*cc), b+30-(2*cc), "SwitchView"
|
||||
draw line 0, 25+cc to 500, 25+cc, "SwitchView"
|
||||
next cc
|
||||
|
||||
// draw lines between the buttons
|
||||
draw set "highcolor", r-70, g-70, b-70, "SwitchView"
|
||||
draw line 0, 0 to 500, 0, "SwitchView"
|
||||
draw line 0, 25 to 500, 25, "SwitchView"
|
||||
draw line 99, 0 to 99, 50, "SwitchView"
|
||||
draw line 199, 0 to 199, 50, "SwitchView"
|
||||
draw line 299, 0 to 299, 50, "SwitchView"
|
||||
draw line 399, 0 to 399, 50, "SwitchView"
|
||||
draw set "highcolor", r+35, g+35, b+35, "SwitchView"
|
||||
draw line 0, 1 to 500, 1, "SwitchView"
|
||||
draw line 0, 26 to 500, 26, "SwitchView"
|
||||
draw line 100, 1 to 100, 50, "SwitchView"
|
||||
draw line 200, 1 to 200, 50, "SwitchView"
|
||||
draw line 300, 1 to 300, 50, "SwitchView"
|
||||
draw line 400, 1 to 400, 50, "SwitchView"
|
||||
draw set "highcolor", 0, 0, 0, "SwitchView"
|
||||
draw text 10, 15, "Button", "SwitchView"
|
||||
draw text 110, 15, "Menu", "SwitchView"
|
||||
draw text 210, 15, "Listbox", "SwitchView"
|
||||
draw text 310, 15, "Textcontrol", "SwitchView"
|
||||
draw text 410, 15, "Checkbox", "SwitchView"
|
||||
draw text 10, 40, "Radiobutton", "SwitchView"
|
||||
draw text 110, 40, "Dropbox", "SwitchView"
|
||||
draw text 210, 40, "Dropzone", "SwitchView"
|
||||
draw text 310, 40, "Slider", "SwitchView"
|
||||
draw text 410, 40, "Colorcontrol", "SwitchView"
|
||||
|
||||
// main program loop
|
||||
Xmouse = 1000
|
||||
dim cmd$(1)
|
||||
dim mouse$(10)
|
||||
|
||||
// NEU!
|
||||
if(ismousein("SwitchView")) then
|
||||
outsideButton = false
|
||||
else
|
||||
outsideButton = true
|
||||
fi
|
||||
|
||||
inloop = true
|
||||
while (inloop)
|
||||
msg$ = message$
|
||||
if (split(msg$, cmd$(), ":|") > 2) item$ = cmd$(2)
|
||||
mmsg$ = mouse message$("SwitchView")
|
||||
n = split(mmsg$, mouse$(), ":")
|
||||
|
||||
if (msg$ <> "") then
|
||||
draw flush "MessageView"
|
||||
draw Text 10, 10, "Message: "+msg$, "MessageView"
|
||||
fi
|
||||
|
||||
if (ismousein("SwitchView")) then
|
||||
// NEU!
|
||||
if(outsideButton) then
|
||||
while(ismousein("SwitchView") and mouse$(3) = "1")
|
||||
mmsg$ = mousemessage$("SwitchView")
|
||||
n = split(mmsg$, mouse$(), ":")
|
||||
sleep 0.1
|
||||
wend
|
||||
fi
|
||||
if(ismousein("SwitchView")) then
|
||||
outsideButton = false
|
||||
Xmouse = val(mouse$(1))
|
||||
Ymouse = val(mouse$(2))
|
||||
BLmouse = val(mouse$(3))
|
||||
else
|
||||
outsideButton = true
|
||||
fi
|
||||
else
|
||||
outsideButton = true
|
||||
fi
|
||||
|
||||
if (BLmouse = 0) Fbl = 0
|
||||
|
||||
if (Ymouse < 25 and BLmouse = 1 and Ymouse > 0 and Fbl = 0) then
|
||||
if (Xmouse < 100) then
|
||||
VButton(0)
|
||||
fi
|
||||
|
||||
if (Xmouse > 100 and Xmouse < 200) then
|
||||
VButton(1)
|
||||
fi
|
||||
|
||||
if (Xmouse > 200 and Xmouse < 300) then
|
||||
VButton(2)
|
||||
fi
|
||||
|
||||
if (Xmouse > 300 and Xmouse < 400) then
|
||||
VButton(3)
|
||||
fi
|
||||
|
||||
if (Xmouse > 400 and Xmouse < 500) then
|
||||
VButton(4)
|
||||
fi
|
||||
Fbl = 1
|
||||
fi
|
||||
|
||||
if (Ymouse > 25 and BLmouse = 1 and Fbl = 0) then
|
||||
if (Xmouse < 100) then
|
||||
VButton(5)
|
||||
fi
|
||||
|
||||
if (Xmouse > 100 and Xmouse < 200) then
|
||||
VButton(6)
|
||||
fi
|
||||
|
||||
if (Xmouse > 200 and Xmouse < 300) then
|
||||
VButton(7)
|
||||
fi
|
||||
|
||||
if (Xmouse > 300 and Xmouse < 400) then
|
||||
VButton(8)
|
||||
fi
|
||||
|
||||
if (Xmouse > 400 and Xmouse < 500) then
|
||||
VButton(9)
|
||||
fi
|
||||
Fbl = 1
|
||||
fi
|
||||
|
||||
switch msg$
|
||||
|
||||
case "MainView:_QuitRequested|"
|
||||
inloop = false
|
||||
break
|
||||
|
||||
end switch
|
||||
sleep 0.01
|
||||
wend
|
||||
exit
|
||||
|
||||
sub VButton(n)
|
||||
draw flush "MessageView"
|
||||
if(ck) then
|
||||
view remove "CBView"
|
||||
ck = false
|
||||
endif
|
||||
view remove "ContentView"
|
||||
view 0, 0 to 500, 200, "ContentView", "MainView"
|
||||
draw set "bgcolor", r+20, g+20, b+20, "ContentView"
|
||||
draw set "lowcolor", r, g, b, "ContentView"
|
||||
draw set "Swis721 BT, Bold, 16", "ContentView"
|
||||
|
||||
if (n = 0) then // Button
|
||||
draw text 10, 25, "BUTTON x1,y1 TO x2,y2, ID$, Label$, View$", "ContentView"
|
||||
draw set "Swis721 BT, Roman, 12", "ContentView"
|
||||
button 100, 50 to 400, 70, "Button_", "Testbutton", "ContentView"
|
||||
draw text 60, 130, "button 100, 50 to 400, 70, \"Button_\", \"Testbutton\", \"MainView\"", "ContentView"
|
||||
fi
|
||||
|
||||
if (n = 1) then // Menu
|
||||
draw text 10, 25, "MENU Head$, Menu$, Shortcut$, View$", "ContentView"
|
||||
draw set "Swis721 BT, Roman, 12", "ContentView"
|
||||
view 40, 50 to 460, 100, "MenuView", "ContentView"
|
||||
draw text 60, 130, "view 40, 50 to 460, 100, \"MenuView\", \"MainView\"", "ContentView"
|
||||
menu "File", "Open file", "", "MenuView"
|
||||
menu "File", "Quit", "", "MenuView"
|
||||
draw text 60, 145, "menu \"File\", \"Open file\", \"\", \"MenuView\"", "ContentView"
|
||||
draw text 60, 160, "menu \"File\", \"Quit\", \"\", \"MenuView\"", "ContentView"
|
||||
fi
|
||||
|
||||
if (n = 2) then // Listbox
|
||||
draw text 10, 25, "LISTBOX x1,y1 TO x2,y2, ID$, ScrollbarType, View$", "ContentView"
|
||||
draw set "Swis721 BT, Roman, 12", "ContentView"
|
||||
listbox 40, 50 to 460, 100, "ListBox_", 1, "ContentView"
|
||||
draw text 60, 130, "listbox 40, 50 to 460, 100, \"ListBox_\", 1, \"MainView\"", "ContentView"
|
||||
listbox add "ListBox_", "First entry"
|
||||
listbox add "ListBox_", "Second entry"
|
||||
draw text 60, 145, "listbox add \"ListBox_\", \"First entry\"", "ContentView"
|
||||
draw text 60, 160, "listbox add \"ListBox_\", \"Second entry\"", "ContentView"
|
||||
fi
|
||||
|
||||
if (n = 3) then // Textcontrol
|
||||
draw text 10, 25, "TEXTCONTROL x1,y1 TO x2,y2, ID$, Label$, Text$, View$", "ContentView"
|
||||
draw set "Swis721 BT, Roman, 12", "ContentView"
|
||||
textcontrol 100, 50 to 400, 70, "Textcontrol-ID", "Label", "Text", "ContentView"
|
||||
draw text 60, 130, "textcontrol 100, 50 to 400, 70, \"Textcontrol-ID\", \"Label\", \"Text\", \"MainView\"", "ContentView"
|
||||
fi
|
||||
|
||||
if (n = 4) then // Checkbox
|
||||
draw text 10, 25, "CHECKBOX x1,y1, ID$, Label$, IsActivated, View$", "ContentView"
|
||||
draw set "Swis721 BT, Roman, 12", "ContentView"
|
||||
view 100, 50 to 400, 100, "CBView", "ContentView"
|
||||
draw text 60, 130, "view 100, 50 to 400, 100, \"CBView\", \"MainView\"", "ContentView"
|
||||
checkbox 10, 8, "Checkbox1-ID", "Label1", 0, "CBView"
|
||||
checkbox 10, 28, "Checkbox2-ID", "Label2", 1, "CBView"
|
||||
draw text 60, 145, "checkbox 10, 8, \"Checkbox1-ID\", \"Label1\", 0, \"CBView\"", "ContentView"
|
||||
draw text 60, 160, "checkbox 10, 28, \"Checkbox2-ID\", \"Label2\", 1, \"CBView\"", "ContentView"
|
||||
ck = true
|
||||
fi
|
||||
|
||||
if (n = 5) then // Radiobutton
|
||||
draw text 10, 25, "RADIOBUTTON x1,y1, ID$, Label$, IsActivated, View$", "ContentView"
|
||||
draw set "Swis721 BT, Roman, 12", "ContentView"
|
||||
view 100, 50 to 400, 100, "RBView", "ContentView"
|
||||
draw text 60, 130, "view 100, 50 to 400, 100, \"RBView\", \"MainView\"", "ContentView"
|
||||
radiobutton 10, 8, "Radiobutton1-ID", "Label1", 0, "RBView"
|
||||
radiobutton 10, 28, "Radiobutton2-ID", "Label2", 1, "RBView"
|
||||
draw text 60, 145, "radiobutton 10, 8, \"Radiobutton1-ID\", \"Label1\", 0, \"RBView\"", "ContentView"
|
||||
draw text 60, 160, "radiobutton 10, 28, \"Radiobutton2-ID\", \"Label2\", 1, \"RBView\"", "ContentView"
|
||||
fi
|
||||
|
||||
if (n = 6) then // Dropbox
|
||||
draw text 10, 25, "DROPBOX x1,y1 TO x2,y2, ID$, Label$, View$", "ContentView"
|
||||
draw set "Swis721 BT, Roman, 12", "ContentView"
|
||||
dropbox 40, 50 to 460, 100, "DropBox_", "Label", "ContentView"
|
||||
draw text 60, 130, "dropbox 40, 50 to 460, 100, \"DropBox_\", \"Label\", \"MainView\"", "ContentView"
|
||||
dropbox add "DropBox_", "First entry"
|
||||
dropbox add "DropBox_", "Second entry"
|
||||
draw text 60, 145, "dropbox add \"DropBox_\", \"First entry\"", "ContentView"
|
||||
draw text 60, 160, "dropbox add \"DropBox_\", \"Second entry\"", "ContentView"
|
||||
fi
|
||||
|
||||
if (n = 7) then // Dropzone
|
||||
draw text 10, 25, "VIEW DROPZONE View$", "ContentView"
|
||||
draw set "Swis721 BT, Roman, 12", "ContentView"
|
||||
view 100, 50 to 400, 100, "DropView", "ContentView"
|
||||
draw text 60, 130, "view 100, 50 to 400, 100, \"DropView\", \"MainView\"", "ContentView"
|
||||
view dropzone "DropView"
|
||||
draw text 60, 145, "view dropzone \"DropView\"", "ContentView"
|
||||
fi
|
||||
|
||||
if (n = 8) then // Slider
|
||||
draw text 10, 25, "SLIDER x1,y1 TO x2,y2, ID$, Label$, Min, Max, Option$, View$", "ContentView"
|
||||
draw set "Swis721 BT, Roman, 12", "ContentView"
|
||||
slider 100, 50 to 400, 70, "Slider-ID", "Label", 0, 255, "horizontal", "ContentView"
|
||||
draw text 60, 130, "slider 100, 50 to 400, 70, \"slider-ID\", \"Label\", 0, 255, \"horizontal\", \"MainView\"", "ContentView"
|
||||
fi
|
||||
|
||||
if (n = 9) then // Colorcontrol
|
||||
draw text 10, 25, "COLORCONTROL x,y, ID$, View$", "ContentView"
|
||||
draw set "Swis721 BT, Roman, 12", "ContentView"
|
||||
colorcontrol 100, 50, "ColCon-ID", "ContentView"
|
||||
draw text 60, 130, "colorcontrol 100, 50, \"ColCon-ID\", \"MainView\"", "ContentView"
|
||||
fi
|
||||
|
||||
draw text 10, 130, "Source:", "ContentView"
|
||||
|
||||
BLmouse = 0
|
||||
return
|
||||
end sub
|
||||
83
yab-IDE/Programs/Examples/MouseWorld.yab
Executable file
@@ -0,0 +1,83 @@
|
||||
#!yab
|
||||
|
||||
// MouseWorld - shows mousemessages
|
||||
// by DasJott
|
||||
|
||||
window open 100, 100 to 500, 400, "MainView", "Mouse-World"
|
||||
window set "MainView", "flags","not-zoomable, not-h-resizable, not-v-resizable"
|
||||
draw set "Zurich, Bold, 20", "MainView"
|
||||
|
||||
view 0, 20 to 100, 110, "MouseView", "MainView"
|
||||
draw set "bgcolor", 255, 255, 255, "MouseView"
|
||||
draw set "lowcolor", 255, 255, 255, "MouseView"
|
||||
draw set "highcolor", 0, 0, 0, "MouseView"
|
||||
|
||||
draw text 60, 150, "Press the Quit button to Quit!", "MainView"
|
||||
draw text 330, 290, "Haha!", "MainView"
|
||||
|
||||
dim cmd$(1)
|
||||
dim mouse$(1)
|
||||
inloop = true
|
||||
while (inloop)
|
||||
msg$ = message$
|
||||
mmsg$ = mouse message$("MainView")
|
||||
|
||||
if (not mmsg$ = Fmmsg$) then
|
||||
Fmmsg$ = mmsg$
|
||||
n = split(mmsg$, mouse$(), ":")
|
||||
Xmouse = val(mouse$(1))
|
||||
Ymouse = val(mouse$(2))
|
||||
BLmouse = val(mouse$(3))
|
||||
BCmouse = val(mouse$(4))
|
||||
BRmouse = val(mouse$(5))
|
||||
ShowMouseMessage()
|
||||
fi
|
||||
|
||||
if (Xmouse > 324 and Ymouse > 264) then
|
||||
HideQbutton()
|
||||
else
|
||||
if (Qbutton = false) ShowQbutton()
|
||||
fi
|
||||
|
||||
switch msg$
|
||||
|
||||
case "MainView:_QuitRequested|"
|
||||
inloop = false
|
||||
break
|
||||
|
||||
end switch
|
||||
sleep 0.01
|
||||
wend
|
||||
window close "MainView"
|
||||
|
||||
sub ShowMouseMessage()
|
||||
draw flush "MouseView"
|
||||
draw text 10, 10, "Mouse X:", "MouseView"
|
||||
draw text 10, 25, "Mouse Y:", "MouseView"
|
||||
draw text 10, 40, "Mouse buttons:", "MouseView"
|
||||
draw text 20, 55, "Button 1:", "MouseView"
|
||||
draw text 20, 70, "Button 2:", "MouseView"
|
||||
draw text 20, 85, "Button 3:", "MouseView"
|
||||
|
||||
draw text 60, 10, str$(Xmouse), "MouseView"
|
||||
draw text 60, 25, str$(Ymouse), "MouseView"
|
||||
draw text 70, 55, str$(BLmouse), "MouseView"
|
||||
draw text 70, 70, str$(BRmouse), "MouseView"
|
||||
draw text 70, 85, str$(BCmouse), "MouseView"
|
||||
return
|
||||
end sub
|
||||
|
||||
sub HideQbutton()
|
||||
if(Qbutton) then
|
||||
view remove "ButtonView"
|
||||
endif
|
||||
Qbutton = false
|
||||
return
|
||||
end sub
|
||||
|
||||
sub ShowQbutton()
|
||||
view 325, 265 to 395, 295, "ButtonView", "MainView"
|
||||
button 5, 5 to 65, 25, "Quit_", "Quit", "ButtonView"
|
||||
Qbutton = true
|
||||
return
|
||||
end sub
|
||||
33
yab-IDE/Programs/Examples/Ping.yab
Executable file
@@ -0,0 +1,33 @@
|
||||
#!yab
|
||||
|
||||
doc Start Ping.yab first by double clicking it,
|
||||
doc then start Pong.yab.
|
||||
doc This demonstrates how yab sends messages to another yab application.
|
||||
doc Note: don't start Ping.yab in the IDE as the IDE only allows one
|
||||
doc running yab program at a time.
|
||||
|
||||
window open 100,100 to 300,300, "Ping", "Ping"
|
||||
|
||||
x = 20
|
||||
y = 50
|
||||
stepx = 5
|
||||
stepy = 5
|
||||
|
||||
while(not instr(message$, "Quit"))
|
||||
x = x + stepx
|
||||
y = y + stepy
|
||||
if(x <= 0 or x >= 400) stepx = -stepx
|
||||
if(y <= 0 or y >= 200) stepy = -stepy
|
||||
if(x >= 190) then
|
||||
ret = message send "application/x-vnd.Pong.yab", str$(x) + ":" + str$(y)
|
||||
if(ret <> 0) then
|
||||
stepx = -stepx
|
||||
if(x > 190) x = 190
|
||||
endif
|
||||
endif
|
||||
|
||||
draw flush "Ping"
|
||||
draw circle x,y, 8, "Ping"
|
||||
wend
|
||||
|
||||
window close "Ping"
|
||||
22
yab-IDE/Programs/Examples/Pong.yab
Executable file
@@ -0,0 +1,22 @@
|
||||
#!yab
|
||||
# mimetype "application/x-vnd.Pong.yab"
|
||||
|
||||
doc See Ping.yab for more information.
|
||||
|
||||
window open 400,100 to 600,300, "Pong", "Pong"
|
||||
|
||||
dim msg$(1)
|
||||
while(not finished)
|
||||
n = token(message$, msg$(), ":|")
|
||||
for i = 1 to n
|
||||
if(instr(msg$(i), "Quit")) finished = true
|
||||
if(instr(msg$(i), "_Scripting") and n>=i+2) then
|
||||
x = val(msg$(i+1)) - 200
|
||||
y = val(msg$(i+2))
|
||||
draw flush "Pong"
|
||||
draw circle x,y, 8, "Pong"
|
||||
endif
|
||||
next i
|
||||
wend
|
||||
|
||||
window close "Pong"
|
||||
36
yab-IDE/Programs/Examples/SlideDemo.yab
Executable file
@@ -0,0 +1,36 @@
|
||||
#!yab
|
||||
|
||||
DOCU SlideDemo, Object scale per Slidebar
|
||||
DOCU by Stargater
|
||||
|
||||
WINDOW OPEN 100,100 to 500,600, "MainView" ,"SlideDemo"
|
||||
WINDOW SET "MainView", "MaximumTo", 400,500
|
||||
|
||||
VIEW 0,0 to 500,400, "CircleView", "MainView"
|
||||
DRAW SET "bgcolor",000,000,000,"CircleView"
|
||||
DRAW SET "lowcolor",140,140,240,"CircleView"
|
||||
|
||||
SLIDER 20,430 to 380,430, "Slider", "Scale the Circle", 0, 190, "MainView"
|
||||
SLIDER LABEL "Slider", "0", "190"
|
||||
SLIDER COLOR "Slider", "barcolor", 140,140,240
|
||||
SLIDER SET "Slider", 20
|
||||
|
||||
DRAW SET 0, "LowSolidFill"
|
||||
DRAW CIRCLE 200,200, 20, "CircleView"
|
||||
|
||||
oldr=20
|
||||
|
||||
while(not instr(message$, "_QuitRequested"))
|
||||
r = SLIDER GET "Slider"
|
||||
|
||||
if(oldr<>r) then
|
||||
oldr = r
|
||||
draw flush "CircleView"
|
||||
DRAW CIRCLE 200,200, r, "CircleView"
|
||||
endif
|
||||
|
||||
wend
|
||||
|
||||
window close "MainView"
|
||||
|
||||
|
||||
32
yab-IDE/Programs/Examples/SliderWorld.yab
Executable file
@@ -0,0 +1,32 @@
|
||||
#!yab
|
||||
|
||||
window open 100,100 to 560,320, "WView", "SliderWorld"
|
||||
|
||||
slider 20,20 to 350,50, "Slider1", "1. Slider with block thumb from 0.1 to 1", 1, 10, "WView"
|
||||
|
||||
slider 20,70 to 350,100, "Slider2", "2. Slider with triangle thumb from 1 to 100 and limit labels; set to 20", 1, 100, "triangle", "WView"
|
||||
slider label "Slider2", "Foo", "Bar"
|
||||
slider set "Slider2", 20
|
||||
|
||||
slider 20,120 to 350,150, "Slider3", "3. Slider from 50 to 75, with 5 bottom hash markings, disabled", 50, 75, "WView"
|
||||
slider label "Slider3", "Foo", "Bar"
|
||||
slider set "Slider3", "bottom", 5
|
||||
option set "Slider3", "enabled", false
|
||||
|
||||
slider 20,170 to 350,200, "Slider4", "4. Slider from -20 to 20, with colors", -20, 20, "WView"
|
||||
slider color "Slider4", "barcolor", 240,140,140
|
||||
slider color "Slider4", "fillcolor", 140,140,240
|
||||
|
||||
slider 360,20 to 440,200, "Slider5", "5. Slider vertical", 1, 100, "vertical", "WView"
|
||||
slider set "Slider5", "left", 15
|
||||
slider color "Slider5", "barcolor", 240,140,140
|
||||
slider set "Slider5", 70
|
||||
|
||||
inloop = true
|
||||
while(inloop)
|
||||
msg$ = message$
|
||||
if(msg$<>"") print msg$
|
||||
if(instr(msg$,"Quit")) inloop = false
|
||||
wend
|
||||
|
||||
window close "WView"
|
||||
305
yab-IDE/Programs/Examples/Sokoban.yab
Executable file
@@ -0,0 +1,305 @@
|
||||
doc Simple game example
|
||||
doc based on the popular Sokoban
|
||||
doc graphics taken from Rocks'n'Diamonds
|
||||
|
||||
|
||||
// Initialize the window, load the sprites and put up the canvas
|
||||
window open 100,100 to 484,484, "Win", "Simple Sokoban Example"
|
||||
window set "Win", "flags", "not-zoomable, not-h-resizable, not-v-resizable"
|
||||
|
||||
bitmap 32,32, "wall"
|
||||
err = draw image 0,0 to 31,31, "img/wall.png", "wall"
|
||||
bitmap 32,32, "front1"
|
||||
err = err + draw image 0,0 to 31,31, "img/front.png", "front1"
|
||||
bitmap 32,32, "bulb"
|
||||
err = err + draw image 0,0 to 31,31, "img/bulb.png", "bulb"
|
||||
bitmap 32,32, "target"
|
||||
err = err + draw image 0,0 to 31,31, "img/target.png", "target"
|
||||
bitmap 32,32, "final"
|
||||
err = err + draw image 0,0 to 31,31, "img/final.png", "final"
|
||||
bitmap 32,32, "background"
|
||||
draw set "highcolor", 0,0,0, "background"
|
||||
draw rect 0,0 to 31,31, "background"
|
||||
|
||||
if(err>0) then
|
||||
alert "Could not load images", "Ok", "stop"
|
||||
window close "Win"
|
||||
exit(1)
|
||||
endif
|
||||
|
||||
option set "Win", "focus", true
|
||||
|
||||
canvas 0,0 to 384,384, "Canvas", "Win"
|
||||
|
||||
draw set "highcolor", 0,0,0, "Canvas"
|
||||
draw rect 0,0 to 384,384, "Canvas"
|
||||
|
||||
// Read in the demo level and show it
|
||||
dim levelline$(12)
|
||||
for i=1 to 12
|
||||
read levelline$(i)
|
||||
for j = 1 to 12
|
||||
switch(mid$(levelline$(i), j, 1))
|
||||
case " "
|
||||
draw bitmap x,y, "background", "copy", "Canvas"
|
||||
break
|
||||
case "w"
|
||||
draw bitmap x,y, "wall", "copy", "Canvas"
|
||||
break
|
||||
case "b"
|
||||
draw bitmap x,y, "bulb", "copy", "Canvas"
|
||||
break
|
||||
case "t"
|
||||
draw bitmap x,y, "target", "copy", "Canvas"
|
||||
break
|
||||
case "s"
|
||||
draw bitmap x,y, "front1", "alpha", "Canvas"
|
||||
mapx = j
|
||||
mapy = i
|
||||
mid$(levelline$(i), j, 1) = " "
|
||||
break
|
||||
end switch
|
||||
x = x + 32
|
||||
next j
|
||||
x = 0
|
||||
y = y + 32
|
||||
next i
|
||||
|
||||
playerx = (mapx-1)*32
|
||||
playery = (mapy-1)*32
|
||||
|
||||
// soundplay "rhythmloop.wav", true
|
||||
|
||||
// handle the movements
|
||||
while(not quitting)
|
||||
key$ = keyboard message$("Win")
|
||||
switch(key$)
|
||||
case "down"
|
||||
if(instr(" t", mid$(levelline$(mapy+1), mapx, 1))) then
|
||||
// soundplay "base.wav", false
|
||||
WalkDown()
|
||||
elseif(instr("bf", mid$(levelline$(mapy+1), mapx, 1)) and instr(" t", mid$(levelline$(mapy+2), mapx,1))) then
|
||||
PushDown()
|
||||
endif
|
||||
sleep 0.10
|
||||
break
|
||||
case "up"
|
||||
if(instr(" t", mid$(levelline$(mapy-1), mapx, 1))) then
|
||||
// soundplay "base.wav", false
|
||||
WalkUp()
|
||||
elseif(instr("bf", mid$(levelline$(mapy-1), mapx, 1)) and instr(" t", mid$(levelline$(mapy-2), mapx,1))) then
|
||||
PushUp()
|
||||
endif
|
||||
sleep 0.10
|
||||
break
|
||||
case "left"
|
||||
if(instr(" t", mid$(levelline$(mapy), mapx-1, 1))) then
|
||||
// soundplay "base.wav", false
|
||||
WalkLeft()
|
||||
elseif(instr("bf", mid$(levelline$(mapy), mapx-1, 1)) and instr(" t", mid$(levelline$(mapy), mapx-2,1))) then
|
||||
PushLeft()
|
||||
endif
|
||||
sleep 0.10
|
||||
break
|
||||
case "right"
|
||||
if(instr(" t", mid$(levelline$(mapy), mapx+1, 1))) then
|
||||
// soundplay "base.wav", false
|
||||
WalkRight()
|
||||
elseif(instr("bf", mid$(levelline$(mapy), mapx+1, 1)) and instr(" t", mid$(levelline$(mapy), mapx+2,1))) then
|
||||
PushRight()
|
||||
endif
|
||||
sleep 0.10
|
||||
break
|
||||
case "esc"
|
||||
quitting = true
|
||||
break
|
||||
end switch
|
||||
m$ = message$
|
||||
if(m$ = "Win:_QuitRequested|" or m$ = "_QuitRequested") quitting = true
|
||||
wend
|
||||
|
||||
window close "Win"
|
||||
|
||||
sub WalkDown()
|
||||
mapy = mapy + 1
|
||||
playery = playery + 32
|
||||
draw bitmap playerx, playery, "front1","alpha", "Canvas"
|
||||
if(mid$(levelline$(mapy-1), mapx,1) = " ") then
|
||||
draw bitmap playerx, playery-32, "background","copy", "Canvas"
|
||||
elseif(mid$(levelline$(mapy-1), mapx,1) = "t") then
|
||||
draw bitmap playerx, playery-32, "target","copy", "Canvas"
|
||||
elseif(mid$(levelline$(mapy-1), mapx,1) = "f") then
|
||||
draw bitmap playerx, playery-32, "final","copy", "Canvas"
|
||||
endif
|
||||
return
|
||||
end sub
|
||||
|
||||
sub WalkUp()
|
||||
mapy = mapy - 1
|
||||
playery = playery - 32
|
||||
draw bitmap playerx, playery, "front1","alpha", "Canvas"
|
||||
if(mid$(levelline$(mapy+1), mapx,1) = " ") then
|
||||
draw bitmap playerx, playery+32, "background","copy", "Canvas"
|
||||
elseif(mid$(levelline$(mapy+1), mapx,1) = "t") then
|
||||
draw bitmap playerx, playery+32, "target","copy", "Canvas"
|
||||
elseif(mid$(levelline$(mapy+1), mapx,1) = "f") then
|
||||
draw bitmap playerx, playery+32, "final","copy", "Canvas"
|
||||
endif
|
||||
return
|
||||
end sub
|
||||
|
||||
sub WalkLeft()
|
||||
mapx = mapx - 1
|
||||
playerx = playerx - 32
|
||||
draw bitmap playerx, playery, "front1","alpha", "Canvas"
|
||||
if(mid$(levelline$(mapy), mapx+1,1) = " ") then
|
||||
draw bitmap playerx+32, playery, "background","copy", "Canvas"
|
||||
elseif(mid$(levelline$(mapy), mapx+1,1) = "t") then
|
||||
draw bitmap playerx+32, playery, "target","copy", "Canvas"
|
||||
elseif(mid$(levelline$(mapy), mapx+1,1) = "f") then
|
||||
draw bitmap playerx+32, playery, "final","copy", "Canvas"
|
||||
endif
|
||||
return
|
||||
end sub
|
||||
|
||||
sub WalkRight()
|
||||
mapx = mapx + 1
|
||||
playerx = playerx + 32
|
||||
draw bitmap playerx, playery, "front1","alpha", "Canvas"
|
||||
if(mid$(levelline$(mapy), mapx-1,1) = " ") then
|
||||
draw bitmap playerx-32, playery, "background","copy", "Canvas"
|
||||
elseif(mid$(levelline$(mapy), mapx-1,1) = "t") then
|
||||
draw bitmap playerx-32, playery, "target","copy", "Canvas"
|
||||
elseif(mid$(levelline$(mapy), mapx-1,1) = "f") then
|
||||
draw bitmap playerx-32, playery, "final","copy", "Canvas"
|
||||
endif
|
||||
return
|
||||
end sub
|
||||
|
||||
sub PushDown()
|
||||
local t$
|
||||
|
||||
t$ = mid$(levelline$(mapy+1), mapx, 1)
|
||||
if(t$ = "b") then
|
||||
mid$(levelline$(mapy+1), mapx, 1) = " "
|
||||
draw bitmap playerx,playery+32, "background", "copy", "Canvas"
|
||||
else
|
||||
mid$(levelline$(mapy+1), mapx, 1) = "t"
|
||||
draw bitmap playerx,playery+32, "target", "copy", "Canvas"
|
||||
endif
|
||||
t$ = mid$(levelline$(mapy+2), mapx, 1)
|
||||
if(t$ = " ") then
|
||||
mid$(levelline$(mapy+2), mapx, 1) = "b"
|
||||
draw bitmap playerx,playery+64, "bulb", "copy", "Canvas"
|
||||
// soundplay "roehr.wav", false
|
||||
else
|
||||
mid$(levelline$(mapy+2), mapx, 1) = "f"
|
||||
draw bitmap playerx,playery+64, "final", "copy", "Canvas"
|
||||
// soundplay "pong.wav", false
|
||||
endif
|
||||
WalkDown()
|
||||
CheckFinished()
|
||||
return
|
||||
end sub
|
||||
|
||||
sub PushUp()
|
||||
local t$
|
||||
|
||||
t$ = mid$(levelline$(mapy-1), mapx, 1)
|
||||
if(t$ = "b") then
|
||||
mid$(levelline$(mapy-1), mapx, 1) = " "
|
||||
draw bitmap playerx,playery-32, "background", "copy", "Canvas"
|
||||
else
|
||||
mid$(levelline$(mapy-1), mapx, 1) = "t"
|
||||
draw bitmap playerx,playery-32, "target", "copy", "Canvas"
|
||||
endif
|
||||
t$ = mid$(levelline$(mapy-2), mapx, 1)
|
||||
if(t$ = " ") then
|
||||
mid$(levelline$(mapy-2), mapx, 1) = "b"
|
||||
draw bitmap playerx,playery-64, "bulb", "copy", "Canvas"
|
||||
// soundplay "roehr.wav", false
|
||||
else
|
||||
mid$(levelline$(mapy-2), mapx, 1) = "f"
|
||||
draw bitmap playerx,playery-64, "final", "copy", "Canvas"
|
||||
// soundplay "pong.wav", false
|
||||
endif
|
||||
WalkUp()
|
||||
CheckFinished()
|
||||
return
|
||||
end sub
|
||||
|
||||
sub PushLeft()
|
||||
local t$
|
||||
|
||||
t$ = mid$(levelline$(mapy), mapx-1, 1)
|
||||
if(t$ = "b") then
|
||||
mid$(levelline$(mapy), mapx-1, 1) = " "
|
||||
draw bitmap playerx-32,playery, "background", "copy", "Canvas"
|
||||
else
|
||||
mid$(levelline$(mapy), mapx-1, 1) = "t"
|
||||
draw bitmap playerx-32,playery, "target", "copy", "Canvas"
|
||||
endif
|
||||
t$ = mid$(levelline$(mapy), mapx-2, 1)
|
||||
if(t$ = " ") then
|
||||
mid$(levelline$(mapy), mapx-2, 1) = "b"
|
||||
draw bitmap playerx-64,playery, "bulb", "copy", "Canvas"
|
||||
// soundplay "roehr.wav", false
|
||||
else
|
||||
mid$(levelline$(mapy), mapx-2, 1) = "f"
|
||||
draw bitmap playerx-64,playery, "final", "copy", "Canvas"
|
||||
// soundplay "pong.wav", false
|
||||
endif
|
||||
WalkLeft()
|
||||
CheckFinished()
|
||||
return
|
||||
end sub
|
||||
|
||||
sub PushRight()
|
||||
local t$
|
||||
|
||||
t$ = mid$(levelline$(mapy), mapx+1, 1)
|
||||
if(t$ = "b") then
|
||||
mid$(levelline$(mapy), mapx+1, 1) = " "
|
||||
draw bitmap playerx+32,playery, "background", "copy", "Canvas"
|
||||
else
|
||||
mid$(levelline$(mapy), mapx+1, 1) = "t"
|
||||
draw bitmap playerx+32,playery, "target", "copy", "Canvas"
|
||||
endif
|
||||
t$ = mid$(levelline$(mapy), mapx+2, 1)
|
||||
if(t$ = " ") then
|
||||
mid$(levelline$(mapy), mapx+2, 1) = "b"
|
||||
draw bitmap playerx+64,playery, "bulb", "copy", "Canvas"
|
||||
// soundplay "roehr.wav", false
|
||||
else
|
||||
mid$(levelline$(mapy), mapx+2, 1) = "f"
|
||||
draw bitmap playerx+64,playery, "final", "copy", "Canvas"
|
||||
// soundplay "pong.wav", false
|
||||
endif
|
||||
WalkRight()
|
||||
CheckFinished()
|
||||
return
|
||||
end sub
|
||||
|
||||
sub CheckFinished()
|
||||
local i
|
||||
for i = 1 to 12
|
||||
if(instr(levelline$(i), "b")) return
|
||||
next i
|
||||
// soundplay "halloffame.wav", false
|
||||
alert "Solved! This was too easy ;)", "Ok", "info"
|
||||
quitting = true
|
||||
return
|
||||
end sub
|
||||
|
||||
data " ww "
|
||||
data "wwwwww www "
|
||||
data "wtt w wwsww"
|
||||
data "wtt www w"
|
||||
data "wtt bb w"
|
||||
data "wtt w w b w"
|
||||
data "wttwww w b w"
|
||||
data "wwww b wb w"
|
||||
data " w bw b w"
|
||||
data " w b b w"
|
||||
data " w ww w"
|
||||
data " wwwwwwwww"
|
||||
17
yab-IDE/Programs/Examples/Timer.yab
Executable file
@@ -0,0 +1,17 @@
|
||||
#!yab
|
||||
|
||||
doc Place a description of your
|
||||
doc program here.
|
||||
doc
|
||||
doc Author, date, license
|
||||
|
||||
|
||||
|
||||
print date$
|
||||
|
||||
print time$
|
||||
print mid$(date$,3,10)+" "+time$
|
||||
|
||||
dim fields$(6)
|
||||
a=split(date$,fields$(),"-")
|
||||
print fields$(2),"-",fields$(3),"-",fields$(4)
|
||||
30
yab-IDE/Programs/Examples/TreeDemo.yab
Executable file
@@ -0,0 +1,30 @@
|
||||
#!yab
|
||||
|
||||
window open 100,100 to 500,300, "A", "TreeDemo"
|
||||
window set "A", "flags", "not-h-resizable, not-v-resizable"
|
||||
|
||||
treebox 10,10 to 380,190, "Tree1", 1, "A"
|
||||
|
||||
treebox add "Tree1", "Hello1"
|
||||
treebox add "Tree1", "Hello1", "Test1", 1
|
||||
treebox add "Tree1", "Test1", "foo", 0
|
||||
treebox add "Tree1", "Test1", "bar", 0
|
||||
treebox add "Tree1", "Hello2"
|
||||
treebox add "Tree1", "Hello3"
|
||||
treebox add "Tree1", "Hello3", "Test3",0
|
||||
treebox add "Tree1", "Test3", "gugst",0
|
||||
treebox add "Tree1", "gugst", "du",0
|
||||
treebox add "Tree1", "Hello4"
|
||||
|
||||
print treebox get$ "Tree1", 1
|
||||
|
||||
inloop = true
|
||||
|
||||
while(inloop)
|
||||
m$ = message$
|
||||
if(m$<>"") print m$
|
||||
if(instr(m$, "Quit")) inloop = false
|
||||
wend
|
||||
|
||||
window close "A"
|
||||
exit
|
||||
81
yab-IDE/Programs/Examples/Typewriter.yab
Executable file
@@ -0,0 +1,81 @@
|
||||
#!yab
|
||||
|
||||
|
||||
window open 100,100 to 600,400, "Main", "Typewriter"
|
||||
window set "Main", "minimumto",100,100
|
||||
|
||||
layout "all", "Main"
|
||||
view 10,10 to 490,280, "Type", "Main"
|
||||
option set "Type", "Focus", true
|
||||
|
||||
oldx = 100
|
||||
oldy = 100
|
||||
oldw = 500
|
||||
oldh = 300
|
||||
|
||||
offsetx = 5
|
||||
offsety = 15
|
||||
|
||||
draw set "highcolor", 255,255,255, "Type"
|
||||
draw set "lowcolor", 0,100,0, "Type"
|
||||
draw set "bgcolor", 0,100,0, "Type"
|
||||
|
||||
draw text 10,295, str$(oldx)+" "+str$(oldy)+" "+str$(oldw)+" "+str$(oldh), "Main"
|
||||
|
||||
while(not instr(message$, "_QuitRequested|"))
|
||||
x = window get "Main", "position-x"
|
||||
if(oldx<>x) then
|
||||
oldx = x
|
||||
Update()
|
||||
endif
|
||||
y = window get "Main", "position-y"
|
||||
if(oldy<>y) then
|
||||
oldy = y
|
||||
Update()
|
||||
endif
|
||||
w = window get "Main", "width"
|
||||
if(oldw<>w) then
|
||||
oldw = w
|
||||
Update()
|
||||
endif
|
||||
h = window get "Main", "height"
|
||||
if(oldh<>h) then
|
||||
oldh = h
|
||||
Update()
|
||||
endif
|
||||
|
||||
// option set "Type", "focus", true
|
||||
TypeKey("Type")
|
||||
wend
|
||||
exit
|
||||
|
||||
sub TypeKey(view$)
|
||||
local k$
|
||||
local old$
|
||||
|
||||
k$ = keyboard message$(view$)
|
||||
if(k$ = "") then
|
||||
// sleep 0.001
|
||||
else
|
||||
if(k$ = "enter") then
|
||||
offsety = offsety + 12
|
||||
offsetx = 5
|
||||
else
|
||||
if(len(k$)=1) then
|
||||
draw text offsetx,offsety, k$, "Type"
|
||||
offsetx = offsetx + 10
|
||||
endif
|
||||
endif
|
||||
old$ = k$
|
||||
while(old$ = k$)
|
||||
k$ = keyboard message$(view$)
|
||||
wend
|
||||
endif
|
||||
return
|
||||
end sub
|
||||
|
||||
sub Update()
|
||||
draw flush "Main"
|
||||
draw text 10,h-5, str$(x)+" "+str$(y)+" "+str$(w)+" "+str$(h), "Main"
|
||||
return
|
||||
end sub
|
||||
30
yab-IDE/Programs/Examples/Walk.yab
Executable file
@@ -0,0 +1,30 @@
|
||||
#!yab
|
||||
|
||||
window open 100,100 to 500,160, "Win", "Walk"
|
||||
window set "Win", "flags", "not-zoomable, not-h-resizable, not-v-resizable"
|
||||
|
||||
bitmap 1152,256, "player"
|
||||
err = draw image 0,0 to 1152,256, "img/player.png", "player"
|
||||
for i=15 to 405 step 65
|
||||
bitmap get i,196 to i+30,252, str$((i+50)/65), "player"
|
||||
next i
|
||||
|
||||
canvas 0,0 to 400,400, "MyCanvas", "Win"
|
||||
|
||||
while(not quitting)
|
||||
|
||||
for a = 0 to 400 step (30/7)
|
||||
DRAW SET "highcolor",255,255,255,"MyCanvas"
|
||||
draw rect 0,0 to a+29,55, "MyCanvas"
|
||||
draw bitmap a,0, str$(mod(a/(30/7),6) +1),"copy", "MyCanvas"
|
||||
sleep 00.2
|
||||
|
||||
m$ = message$
|
||||
if(m$ = "Win:_QuitRequested|" or m$ = "_QuitRequested|") then
|
||||
quitting = true
|
||||
break
|
||||
endif
|
||||
next a
|
||||
|
||||
wend
|
||||
window close "Win"
|
||||
52
yab-IDE/Programs/Examples/WindowWorld.yab
Executable file
@@ -0,0 +1,52 @@
|
||||
#!yab
|
||||
|
||||
window open 100,100 to 230,200, "win0", "Window0"
|
||||
|
||||
layout "V-Center, H-Center", "win0"
|
||||
|
||||
button 10,10 to 120,30, "NewWin_", "New Window", "win0"
|
||||
button 10,40 to 120,60, "NumWin_", "Show Number...", "win0"
|
||||
button 10,70 to 120,90, "Quit_", "Close All", "win0"
|
||||
|
||||
alert "WindowWorld demonstrates how Windows are created and closed!", "Ok", "idea"
|
||||
|
||||
dim msgpart$(1)
|
||||
maxcount = 1
|
||||
|
||||
inloop = true
|
||||
while(inloop = true)
|
||||
msg$= message$
|
||||
if (split(msg$, msgpart$(),":") = 2) item$ = msgpart$(1)
|
||||
if (msg$ <> "") print msg$
|
||||
|
||||
switch msg$
|
||||
case "NumWin_|"
|
||||
alert "The number of open windows is "+str$(window count), "Ok", "info"
|
||||
break
|
||||
|
||||
case "NewWin_|"
|
||||
number$ = str$(maxcount)
|
||||
i = maxcount * 10
|
||||
window open 100+i,100+i to 230+i,200+i, "win"+number$, "Window"+number$
|
||||
layout "v-center, h-center", "win"+number$
|
||||
button 10,10 to 120,30, "NewWin_","New Window", "win"+number$
|
||||
button 10,40 to 120,60, "NumWin_","Show Number...", "win"+number$
|
||||
button 10,70 to 120,90, "Quit_","Close All", "win"+number$
|
||||
maxcount = maxcount + 1
|
||||
break
|
||||
|
||||
case "Quit_|"
|
||||
inloop = false
|
||||
break
|
||||
|
||||
case item$+":_QuitRequested|"
|
||||
window close item$
|
||||
break
|
||||
|
||||
end switch
|
||||
|
||||
if (window count < 1) inloop = false
|
||||
|
||||
wend
|
||||
|
||||
exit
|
||||
BIN
yab-IDE/Programs/Examples/img/bulb.png
Normal file
|
After Width: | Height: | Size: 400 B |
BIN
yab-IDE/Programs/Examples/img/button_disabled.png
Normal file
|
After Width: | Height: | Size: 719 B |
BIN
yab-IDE/Programs/Examples/img/button_norm.png
Normal file
|
After Width: | Height: | Size: 332 B |
BIN
yab-IDE/Programs/Examples/img/button_pressed.png
Normal file
|
After Width: | Height: | Size: 333 B |
BIN
yab-IDE/Programs/Examples/img/checkbutton_disabledOff.png
Normal file
|
After Width: | Height: | Size: 399 B |
BIN
yab-IDE/Programs/Examples/img/checkbutton_disabledOn.png
Normal file
|
After Width: | Height: | Size: 407 B |
BIN
yab-IDE/Programs/Examples/img/checkbutton_enabledOff.png
Normal file
|
After Width: | Height: | Size: 398 B |
BIN
yab-IDE/Programs/Examples/img/checkbutton_enabledOn.png
Normal file
|
After Width: | Height: | Size: 412 B |
BIN
yab-IDE/Programs/Examples/img/final.png
Normal file
|
After Width: | Height: | Size: 522 B |
BIN
yab-IDE/Programs/Examples/img/front.png
Normal file
|
After Width: | Height: | Size: 796 B |
BIN
yab-IDE/Programs/Examples/img/image.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
yab-IDE/Programs/Examples/img/player.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
yab-IDE/Programs/Examples/img/target.png
Normal file
|
After Width: | Height: | Size: 402 B |
BIN
yab-IDE/Programs/Examples/img/wall.png
Normal file
|
After Width: | Height: | Size: 438 B |
BIN
yab-IDE/Programs/Examples/img/yab.png
Normal file
|
After Width: | Height: | Size: 378 B |