Microsoft Small Basic

Program Listing: MVK034
' Software Keyboard 0.1a
' Copyright (c) 2014 Nonki Takahashi. MIT License.
' History:
' 0.1a 2014-06-16 Created as Japanese keyboard. ()
'
WQ = Text.GetCharacter(34)
GraphicsWindow.Title = "Software Keyboard 0.1a"
GraphicsWindow.BackgroundColor = "LightGray"
gw = GraphicsWindow.Width
gh = GraphicsWindow.Height
KeyInit()
For i = 1 To 82
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.FillRectangle(keys[i]["x"], keys[i]["y"], keys[i]["width"], keys[i]["height"])
GraphicsWindow.BrushColor = "White"
If keys[i]["shift"] = "" Then
GraphicsWindow.FontSize = 9
ElseIf keys[i]["shift"] = "カタカナ" Then
GraphicsWindow.FontSize = 9
Else
GraphicsWindow.FontSize = 10
EndIf
If keys[i]["font"] <> "" Then
GraphicsWindow.FontName = keys[i]["font"]
Else
GraphicsWindow.FontName = "Meiryo UI"
EndIf
GraphicsWindow.DrawBoundText(keys[i]["x"] + 1, keys[i]["y"] + 1, keys[i]["width"] - 1, keys[i]["top"])
EndFor
Sub KeyInit
keys[1] = "key=Escape;top=Esc;"
keys[2] = "key=F1;top=F1;"
keys[3] = "key=F2;top=F2;"
keys[4] = "key=F3;top=F3;"
keys[5] = "key=F4;top=F4;"
keys[6] = "key=F5;top=F5;"
keys[7] = "key=F6;top=F6;"
keys[8] = "key=F7;top=F7;"
keys[9] = "key=F8;top=F8;"
keys[10] = "key=F9;top=F9;"
keys[11] = "key=System;top=F10;"
keys[12] = "key=F11;top=F11;"
keys[13] = "key=F12;top=F12;"
keys[14] = "key=NumLock;top=Num Lk;"
keys[15] = "key=Pause;top=Pause;"
keys[16] = "key=Insert;top=Insert;"
keys[17] = "key=Delete;top=Delete;"
keys[18] = "key=DbeSbcsChar;top=半角/ 全角;"
keys[19] = "key=D1;top=1;shift=!;"
keys[20] = "key=D2;top=2;shift=" + WQ + ";"
keys[21] = "key=D3;top=3;shift=#;"
keys[22] = "key=D4;top=4;shift=$;"
keys[23] = "key=D5;top=5;shift=%;"
keys[24] = "key=D6;top=6;shift=&;"
keys[25] = "key=D7;top=7;shift=';"
keys[26] = "key=D8;top=8;shift=(;"
keys[27] = "key=D9;top=9;shift=);"
keys[28] = "key=D0;top=0;shift=;"
keys[29] = "key=OemMinus;top=-;shift=\=;"
keys[30] = "key=OemQuotes;top=^;shift=~;"
keys[31] = "key=Oem5;top=¥;shift=|;"
keys[32] = "key=Back;top=Back Space;"
keys[33] = "key=Tab;top=Tab;shift=|←;"
keys[34] = "key=Q;top=q;shift=Q;"
keys[35] = "key=W;top=w;shift=W;"
keys[36] = "key=E;top=e;shift=E;"
keys[37] = "key=R;top=r;shift=R;"
keys[38] = "key=T;top=t;shift=T;"
keys[39] = "key=Y;top=y;shift=Y;"
keys[40] = "key=U;top=u;shift=U;"
keys[41] = "key=I;top=i;shift=I;"
keys[42] = "key=O;top=o;shift=O;"
keys[43] = "key=P;top=p;shift=P;"
keys[44] = "key=Oem3;top=@;shift=`;"
keys[45] = "key=OemOpenBrackets;top=[;shift={;"
keys[46] = "key=Enter;top=Enter;"
keys[47] = "key=OemAttn;top=英数;shift=Caps Lock;"
keys[48] = "key=A;top=a;shift=A;"
keys[49] = "key=S;top=s;shift=S;"
keys[50] = "key=D;top=d;shift=D;"
keys[51] = "key=F;top=f;shift=F;"
keys[52] = "key=G;top=g;shift=G;"
keys[53] = "key=H;top=h;shift=H;"
keys[54] = "key=J;top=j;shift=J;"
keys[55] = "key=K;top=k;shift=K;"
keys[56] = "key=L;top=l;shift=L;"
keys[57] = "key=OemPlus;top=\;;shift=+;"
keys[58] = "key=Oem1;top=:;shift=*;"
keys[59] = "key=Oem6;top=];shift=};"
keys[60] = "key=LeftShift;top=Shift;"
keys[61] = "key=Z;top=z;shift=Z;"
keys[62] = "key=X;top=x;shift=X;"
keys[63] = "key=C;top=c;shift=C;"
keys[64] = "key=V;top=v;shift=V;"
keys[65] = "key=B;top=b;shift=B;"
keys[66] = "key=N;top=n;shift=N;"
keys[67] = "key=M;top=m;shift=M;"
keys[68] = "key=OemComma;top=,;shift=<;"
keys[69] = "key=OemPeriod;top=.;shift=>;"
keys[70] = "key=OemQuestion;top=/;shift=?;"
keys[71] = "key=OemBackslash;top=\\;shift=_;"
keys[72] = "key=RightShift;top=Shift;"
keys[73] = "key=LeftCtrl;top=Ctrl;"
keys[74] = "key=Fn;top=Fn;"
keys[75] = "key=LWin;top=ÿ;font=Wingdings;"
keys[76] = "key=System;top=Alt;"
keys[77] = "key=ImeNonConvert;top=無変換;"
keys[78] = "key=Space;"
keys[79] = "key=ImeConvert;top=変換;"
keys[80] = "key=OemCopy;top=ひらがな;shift=カタカナ;"
keys[81] = "key=Apps;top=⌸;"
keys[82] = "key=RightCtrl;top=Ctrl;"
keys[83] = "key=Up;top=↑;"
keys[84] = "key=Left;top=←;"
keys[85] = "key=Down;top=↓;"
keys[86] = "key=Right;top=→;"
keys[87] = "key=VolumeMute;top=Xr;font=Webdings;"
keys[88] = "key=VolumeDown;top=X6;font=Webdings;"
keys[89] = "key=VolumeUp;top=X5;font=Webdings;"
keys[90] = "key=Scroll;top=Scr Lk;"
keys[91] = "key=PageUp;top=PgUp;"
keys[92] = "key=Home;top=Home;"
keys[93] = "key=Next;top=PgDn;"
keys[94] = "key=End;top=End;"
x0 = 10
y0 = 10
w = (gw - 20) / 17
h = w
For i = 1 To 17
keys[i]["x"] = x0 + (i - 1) * w
keys[i]["y"] = y0
keys[i]["width"] = w - 2
keys[i]["height"] = h - 2
EndFor
w = (gw - 20) / 15
h = w
For i = 18 To 32
keys[i]["x"] = x0 + (i - 18) * w
keys[i]["y"] = y0 + keys[1]["height"] + 2
keys[i]["width"] = w - 2
keys[i]["height"] = h - 2
EndFor
For i = 33 To 46
If i = 33 Then
keys[i]["width"] = 1.4 * w - 2
keys[i]["x"] = x0
ElseIf i = 46 Then
keys[i]["width"] = 1.6 * w - 2
keys[i]["x"] = keys[i - 1]["x"] + keys[i - 1]["width"] + 2
Else
keys[i]["width"] = w - 2
keys[i]["x"] = keys[i - 1]["x"] + keys[i - 1]["width"] + 2
EndIf
keys[i]["y"] = keys[18]["y"] + keys[18]["height"] + 2
keys[i]["height"] = h - 2
EndFor
For i = 47 To 59
If i = 47 Then
keys[i]["width"] = 1.8 * w - 2
keys[i]["x"] = x0
Else
keys[i]["width"] = w - 2
keys[i]["x"] = keys[i - 1]["x"] + keys[i - 1]["width"] + 2
EndIf
keys[i]["y"] = keys[33]["y"] + keys[33]["height"] + 2
keys[i]["height"] = h - 2
EndFor
For i = 60 To 72
If i = 60 Then
keys[i]["width"] = 2.2 * w - 2
keys[i]["x"] = x0
ElseIf i = 72 Then
keys[i]["width"] = 1.8 * w - 2
keys[i]["x"] = keys[i - 1]["x"] + keys[i - 1]["width"] + 2
Else
keys[i]["width"] = w - 2
keys[i]["x"] = keys[i - 1]["x"] + keys[i - 1]["width"] + 2
EndIf
keys[i]["y"] = keys[47]["y"] + keys[47]["height"] + 2
keys[i]["height"] = h - 2
EndFor
For i = 73 To 82
If i = 73 Then
keys[i]["width"] = 1.5 * w - 2
keys[i]["x"] = x0
ElseIf i = 78 Then
keys[i]["width"] = 2.5 * w - 2
keys[i]["x"] = keys[i - 1]["x"] + keys[i - 1]["width"] + 2
Else
keys[i]["width"] = w - 2
keys[i]["x"] = keys[i - 1]["x"] + keys[i - 1]["width"] + 2
EndIf
keys[i]["y"] = keys[60]["y"] + keys[60]["height"] + 2
keys[i]["height"] = h - 2
EndFor
EndSub