Microsoft Small Basic

Program Listing: ZJH367
imm= "afg@09352.jpg aus@09001.gif cro@10418.gif cyp@10379.gif fin@10715.gif gre@10395.gif ice@10136.gif isr@09415.gif kaz@10348.gif kos@10449.gif mld@11417.gif mzb@08849.gif
imm=imm+" grn@09738.gif gmb@08295.gif gtm@09718.gif mdg@08805.gif jam@09684.gif mrs@09217.gif nzl@09173.gif pak@11223.gif per@10056.gif sin@11109.gif svg@09726.gif spn@10470.gif usa@07302.gif uae@09289.gif vnz@09997.gif urg@09640.gif sey@08499.gif tkm@10634.gif slk@11147.gif thl@11170.gif
imm=imm+" ids@11057.gif pol@10783.gif ttb@09801.gif scn@09733.gif stp@08410.gif png@09211.gif qat@09367.gif mex@10051.gif mlw@08828.gif
imm=imm+" alb@10196.gif but@11346.gif bru@11292.gif chn@10767.gif chl@09808.gif csr@09759.gif ecd@09625.gif geo@10429.gif den@10575.gif ind@11037.gif fmc@10860.gif mne@10907.jpg mic@09242.gif mng@11431.gif nep@11196.gif
imm=imm+" ukk@10295.gif nor@10661.gif swe@10512.gif ser@10622.gif pan@09880.gif mlt@10865.gif swi@10484.gif vat@10646.gif por@10828.gif lat@10919.gif est@10339.gif slk@10553.gif slv@10569.gif czk@10539.gif snm@10463.gif and@10155.gif
imm=ldtext.Replace (imm "@" ";0000")
im=ldtext.Split (imm " ")
im1= "xxx@10175.gif xxx@10845.gif xxx@10810.gif xxx@10930.gif xxx@10895.gif xxx@10886.gif xxx@10231.gif xxx@10266.gif xxx@10526.gif xxx@08300.gif xxx@08799.gif xxx@08476.gif xxx@08642.gif xxx@08668.gif xxx@08542.gif xxx@08786.gif xxx@08589.gif xxx@08404.gif xxx@08376.gif xxx@08773.gif xxx@08335.gif
im1=im1+" bra@09959.gif bol@10084.gif blz@09953.gif bbd@09916.gif cub@09700.gif bhr@09554.gif bhm@09894.gif dmr@09847.gif esl@09658.gif roc@11183.gif mls@11384.gif lst@08948.gif prg@09926.gif phl@11322.gif sng@08571.gif tky@09513.gif syr@09485.gif rwa@08913.gif slm@09110.gif
im1=im1+" sur@09709.gif sam@09094.gif tng@09141.gif vnm@11315.gif nau@09159.gif nmb@08720.gif lby@08940.gif mor@08916.gif mrt@08882.gif
im1=im1+" dmk@09832.gif ert@08199.gif guy@09682.gif fji@09191.gif eth@08282.gif jrd@09501.gif irq@09462.gif irn@09283.gif hnd@10024.gif hai@09849.gif alg@08105.gif arg@09594.gif clb@09780.gif cmb@11077.gif
im1=im1+" abb@09614.gif kwt@09395.gif lao@11449.gif lib@08980.gif lbn@09528.gif ken@08371.gif kir@09054.gif myn@11376.gif vnu@09134.gif sml@08653.gif stl@09761.gif tvl@09123.gif ssd@08750.gif saf@08874.gif tls@11259.gif nic@09826.gif omn@09346.gif eqg@08524.gif cmr@08262.gif cok@09077.gif cbv@08229.gif bfs@08752.gif kyr@10389.gif niu@81359.gif swz@08578.gif
im1=ldtext.Replace (im1 "@" ";0000")
imi=ldtext.Split (im1 " ")
stt="Afganistan;Australia;Croatia;Cyprus;Finland;Greece;Iceland;Israel;Kazakhistan;Kosovo;Maldives;Mozambique;Grenada;Gambia;Guatemala;
stt=stt+"Madagascar;Jamaica;Marshall;New Zealand;Pakistan;Peru;Singapore;Saint Vincent and the Grenadines;Spain;USA;UAE;Venezuela;Urugvay;
stt=stt+"Seychelles;Turkmenistan;Sri Lanka;Thailand;Indonesia;Poland;Trinidad&Tobago;St Christopher&Nevis;Sao Tome&Principe;Papua New Guinea;
stt=stt+"Qatar;Mexico;Malawi;Albania;Bhutan;Brunei;China;Chile;Costa Rica;Ecuador;Georgia;Denmark;India;FYR Macedonia;Montenegro;Micronesia;Mongolia;Nepal;
stt=stt+"UK;Norway;Sweden;Serbia;Panama;Malta;Switzerland;Vatican;Portugal;Latvia;Estonia;Slovakia;Slovenia;Chech Rep.;San Marino;Andorra;
stt=stt+"Austria;Belgium;France;Germany;Hungary;Italy;The Netherlands;Japan;Bangladesh;Palau;Luxembourg;Romania;Bulgaria;Ireland;Lithuania;Ivory Coast;
stt=stt+"Nigeria;Armenia;Russia;Gabon;Sierra Leone;Yemen;Niger;Mali;Guinea;Azerbaijan;Belarus;B&H;Liechtenstein;Moldova;Monaco;Ucraine;Uzbekistan;Tajikistan;Egypt;Benin;Djibouti;Togo;Tanzania;Sudan;Burundi;CAR;DR Kongo;R.of Kongo;Botswana;Comoros;
stt=stt+"Brazil;Bolivia;Belize;Barbados;Cuba;Bahrain;Bahamas;Dominican Rep.;El Salvador;Rep.of Korea;Malaysia;Lesotho;Paraguay;Philippines;Senegal;Turkey;Syria;Rwanda;Solomon;Suriname;Samoa;Tonga;Viet Nam;Nauru;Namibia;Libya;Morocco;Mauritius;Dominica;Eritrea;Guyana;Fiji;Ethiopia;Jordan;
stt=stt+"Iraq;Iran;Honduras;Haiti;Algeria;Argentina;Colombia;Cambodia;Antigua&Barbuda;Kuwait;Laos;Liberia;Lebanon;Kenya;Kiribati;Myanmar;Vanuatu;Somalia;St.Lucia;Tuvalu;Sth.Sudan;R.of Sth.Africa;Timor-Leste;Nicaragua;Oman;Equat.Guinea;Cameroon;Cook;Cabo Verde;B.Faso;Kyrgyzstan;Niue;Swaziland;
cnt=ldtext.Split (stt ";")
'TextWindow.WriteLine (cnt)
eu=ldtext.Split ("83 84 85 86 87 3 4 5 6 73 74 75 76 77 78 79 65 66 67 68 69 70 57 59 62 24 34 50" " ")
'TLF895
GraphicsWindow.Title="World of Flags
br="1=blue;2=midnightblue;3=black
LDGraphicsWindow.BackgroundBrush (LDShapes.BrushGradient (br "DD"))
GraphicsWindow.Width=900
GraphicsWindow.Height =850
sf=Array.GetItemCount (im)
sf1=Array.GetItemCount (imi)
mf=sf
fw=112
fh=75
bw=fw/3
lh=fh/3
itt=ldtext.Split ("All;EU;Europe;Asia;Africa;S.America;Islands" ";")
LDDialogs.AddRightClickMenu (itt "")
LDDialogs.RightClickMenu =rmm
LDShapes.ShapeEvent=sew

GraphicsWindow.MouseUp =muu
GraphicsWindow.MouseMove=mwww
lsh=""

For i=1 To sf
ii=ImageList.LoadImage ("http://www.mofa.go.jp/files/"+Text.GetSubTextToEnd (im[i] 5))
ss[i]=Shapes.AddImage (ii )

Shapes.Zoom (ss[i] .8 .8)
LDEffect.DropShadow (ss[i] "color=skyblue")
Shapes.Move (ss[i] math.Remainder (i-1 8)*95+50 55+Math.Floor ((i-1)/8)*65)
if i=56 Then
Shapes.Move(ss[i] math.Remainder (i-1 8)*95+90 55+Math.Floor ((i-1)/8)*65)
endif
LDDialogs.ToolTip (ss[i] cnt[i])
LDShapes.SetShapeEvent (ss[i])
LDShapes.AnimateRotation (ss[i] 1555 4)
Program.Delay (55)
EndFor

Sub mwww
If lsh="" Then
else
LDShapes.Centre (lsh GraphicsWindow.MouseX GraphicsWindow.MouseY )
EndIf
EndSub

Sub muu
lsh=""

EndSub


LDShapes.AnimateZoom (ss[sf] 750 0 1.3 1.3)
LDEvents.MouseWheel=mww
GraphicsWindow.KeyDown=kkk
mm=1000
zz=1
cr=9
args=0

LDCall.Function4("hflg" "white" "red" "red" 1)
LDCall.Function4("vflg" "yellow" "black" "red" 2)
LDCall.Function4("vflg" "white" "blue" "red" 3)
LDCall.Function4("hflg" "red" "black" "yellow" 4)
LDCall.Function4("hflg" "white" "red" "green" 5)
LDCall.Function4("vflg" "white" "green" "red" 6)
LDCall.Function4("hflg" "white" "red" "blue" 7)
LDCall.Function4("vflg" "white" "c" "red" 8)

cr=10
dd=-10
LDCall.Function4("vflg" "green" "c" "red" 1)
LDCall.Function4("vflg" "lightblue" "c" "yellow" 2)
LDCall.Function4("hflg" "white" "red" "lightblue" 3)
LDCall.Function4("vflg" "yellow" "blue" "red" 4)
LDCall.Function4("hflg" "green" "white" "red" 5)
LDCall.Function4("vflg" "white" "green" "orange" 6)
LDCall.Function4("hflg" "green" "yellow" "red" 7)
LDCall.Function4("vflg" "white" "orange" "green" 8)

cr=11
cyn= LDColours.HSLtoRGB (210 1 .55)
LDCall.Function4("vflg" "white" "darkgreen" "darkgreen" 1)
LDCall.Function4("hflg" "blue" "red" "Orange" 2)
LDCall.Function4("hflg" "blue" "white" "red" 3)
LDCall.Function4("hflg" "yellow" "green" cyn 4)
LDCall.Function4("hflg" "white" "green" cyn 5)
LDCall.Function4("hflg" "white" "red" "black" 6)
LDCall.Function4("hflg" "white" "orange" "darkgreen" 7)
LDCall.Function4("vflg" "yellow" "darkgreen" "red" 8)
dx=36
LDCall.Function4("vflg" "yellow" "red" "darkgreen" 10)

For j=1 To sf1
ii=ImageList.LoadImage ("http://www.mofa.go.jp/files/"+Text.GetSubTextToEnd (imi[j] 5))
ss[i]=Shapes.AddImage (ii )
LDShapes.SetShapeEvent (ss[i])
Shapes.Zoom (ss[i] .8 .8)
LDEffect.DropShadow (ss[i] "color=skyblue")
Shapes.Move (ss[i] math.Remainder (j-1 8)*95+870 55+Math.Floor ((j-1)/8)*65)
LDDialogs.ToolTip (ss[i] cnt[i])
LDShapes.AnimateRotation (ss[i] 1555 4)
Program.Delay (55)
i=i+1
mf=i-1
EndFor
GraphicsWindow.Title=mf+ " States Flags Total
Sub rmm
di=LDDialogs.LastRightClickMenuItem
If di=1 Then
For x=1 to mf
Shapes.ShowShape (ss[x])
EndFor
ElseIf di=2 then
For x=1 to mf
If Array.ContainsValue (eu x) then
Shapes.ShowShape (ss[x])
Else
Shapes.hideShape (ss[x])
EndIf
EndFor
EndIf
EndSub

Sub sew
If LDShapes.LastEventType="MouseDown" Then
lsh= LDShapes.LastEventShape
EndIf
EndSub


Sub hflg
gg=FCDrawings.CreateGraphics(fw fh)
FCDrawings.FillRectangle (gg args[1] 0 0 fw fh)
FCDrawings.FillRectangle (gg args[2] 0 0 fw lh)
FCDrawings.FillRectangle (gg args[3] 0 lh*2 fw lh)
If i=95 Then

FCDrawings.FillEllipse(gg "orange" fw/2-10 fh/2-10 20 20)
endif
im=FCDrawings.GenerateImage(gg)
s0=Shapes.AddImage (im )
Shapes.Zoom (s0 .8 .8)
shapes.Move (s0 50+95*(args[4]-1) 55+cr*65)
LDEffect.DropShadow (s0 "color=skyblue")
ss[i]=s0
LDDialogs.ToolTip (ss[i] cnt[i])
LDShapes.AnimateRotation (ss[i] 1555 4)
LDShapes.SetShapeEvent (ss[i])
Program.Delay (55)
mf=mf+1
i=i+1
EndSub

Sub vflg
gg=FCDrawings.CreateGraphics(fw fh)
FCDrawings.FillRectangle (gg args[1] 0 0 fw fh)
If args[2]="c" Then
FCDrawings.FillEllipse (gg args[3] bw+dd lh-5 bw bw)
else
FCDrawings.FillRectangle (gg args[2] 0 0 bw fh)
FCDrawings.FillRectangle (gg args[3] bw*2 0 bw fh)
EndIf
im=FCDrawings.GenerateImage(gg)
s0=Shapes.AddImage (im )
Shapes.Zoom (s0 .8 .8)
shapes.Move (s0 50+95*(args[4]-1)-dx 55+cr*65)
LDEffect.DropShadow (s0 "color=skyblue")
ss[i]=s0
LDDialogs.ToolTip (ss[i] cnt[i])
LDShapes.SetShapeEvent (ss[i])
LDShapes.AnimateRotation (ss[i] 1555 4)
Program.Delay (55)
i=i+1
mf=mf+1
EndSub

Sub mww
If Mouse.IsRightButtonDown Then
aa=aa+ LDEvents.LastMouseWheelDelta *3
Else
zz=zz+ LDEvents.LastMouseWheelDelta/15
EndIf
ldGraphicsWindow.Reposition (zz zz xx yy aa)
EndSub


Sub kkk
LDShapes.AnimateZoom (ss[sf] 0 0 0 0)
Shapes.Zoom(ss[sf] .8 .8)
ls=text.ConvertToLowerCase (GraphicsWindow.LastKey)
If ls="space" Then
sf=sf+1
ElseIf ls="back" then
sf=sf-1

ElseIf ls="left" then
xx=xx-5
ElseIf ls="right" then
xx=xx+5
ElseIf ls="up" then
yy=yy-5
ElseIf ls="down" then
yy=yy+5

EndIf
If sf<1 Then
sf=mf
ElseIf sf>mf then
sf=1
EndIf
GraphicsWindow.Title="State of "+cnt[sf]
mm=mm+1
LDShapes.ZIndex (ss[sf] mm)
LDShapes.AnimateZoom (ss[sf] 750 0 1.3 1.3)
ldGraphicsWindow.Reposition (zz zz xx yy aa)
EndSub