Microsoft Small Basic

Program Listing: NHJ269
'WINDOW
GraphicsWindow.Hide()
GraphicsWindow.Width = 510
GraphicsWindow.Height = 435
GraphicsWindow.Left = (Desktop.Width - 510) / 2
GraphicsWindow.Top = 100
GraphicsWindow.CanResize = "false"
GraphicsWindow.Title = "RGB Menu"
GraphicsWindow.BackgroundColor = "black"

'TRAFFIC_POLICEMAN
Rhandleactive = Controls.AddButton(0, 0, 0)
Controls.HideControl(Rhandleactive)
Ghandleactive = Controls.AddButton(0, 0, 0)
Controls.HideControl(Ghandleactive)
Bhandleactive = Controls.AddButton(0, 0, 0)
Controls.HideControl(Bhandleactive)

Ramount = Controls.AddButton(0 0 0)
Controls.HideControl(Ramount)
Gamount = Controls.AddButton(0 0 0)
Controls.HideControl(Gamount)
Bamount = Controls.AddButton(0 0 0)
Controls.HideControl(Bamount)

'RGB
'*'*'*'*'*'
GraphicsWindow.FontName = "consolas"
GraphicsWindow.FontBold = "fasle"
GraphicsWindow.BrushColor = "black"
GraphicsWindow.FontSize = 20

'BACKS
GraphicsWindow.BrushColor = "red"
Rback = Shapes.AddRectangle(35, 35)
Shapes.Move(Rback, 88, 94)
GraphicsWindow.BrushColor = "green"
Gback = Shapes.AddRectangle(35, 35)
Shapes.Move(Gback, 88, 194)
GraphicsWindow.BrushColor = "blue"
Bback = Shapes.AddRectangle(35, 35)
Shapes.Move(Bback, 88, 294)

'LETTERS
GraphicsWindow.BrushColor = "black"
R = Shapes.AddText("R")
Shapes.Move(R, 100, 100)
G = Shapes.AddText("G")
Shapes.Move(G, 100, 200)
B = Shapes.AddText("B")
Shapes.Move(B, 100, 300)

'BARS
GraphicsWindow.BrushColor = "red"
Rback = Shapes.AddRectangle(260, 25)
Shapes.Move(Rback, 150, 100)
GraphicsWindow.BrushColor = "green"
Gback = Shapes.AddRectangle(260, 25)
Shapes.Move(Gback, 150, 200)
GraphicsWindow.BrushColor = "blue"
Bback = Shapes.AddRectangle(260, 25)
Shapes.Move(Bback, 150, 300)

'HANDLES
GraphicsWindow.BrushColor = "white"
Rhandle = Shapes.AddRectangle(35, 35)
Shapes.Move(Rhandle, 150, 95)
Ghandle = Shapes.AddRectangle(35, 35)
Shapes.Move(Ghandle, 150, 195)
Bhandle = Shapes.AddRectangle(35, 35)
Shapes.Move(Bhandle, 150, 295)

'SHOW_WINDOW
GraphicsWindow.Show()

'SUBROUTINES
'*'*'*'*'*'*'*'*'*'*'*'
'MOUSE_DOWN
GraphicsWindow.MouseDown = md
Sub md
'CLICK_RHANDLE
If x > Rhandleleft And x < Rhandleleft + 35 And y > Rhandletop And y < Rhandletop + 35 Then
Sound.PlayClick()
Controls.SetButtonCaption(Rhandleactive, 1)
EndIf
'CLICK_GHANDLE
If x > Ghandleleft And x < Ghandleleft + 35 And y > Ghandletop And y < Ghandletop + 35 Then
Sound.PlayClick()
Controls.SetButtonCaption(Ghandleactive, 1)
EndIf
'CLICK_BHANDLE
If x > Bhandleleft And x < Bhandleleft + 35 And y > Bhandletop And y < Bhandletop + 35 Then
Sound.PlayClick()
Controls.SetButtonCaption(Bhandleactive, 1)
EndIf
EndSub

'MOUSE_MOVE
GraphicsWindow.MouseMove = mm
Sub mm
x = GraphicsWindow.MouseX
y = GraphicsWindow.MouseY

getRhandleactive = Controls.GetButtonCaption(Rhandleactive)
getGhandleactive = Controls.GetButtonCaption(Ghandleactive)
getBhandleactive = Controls.GetButtonCaption(Bhandleactive)

Rhandleleft = Shapes.GetLeft(Rhandle)
Rhandletop = Shapes.GetTop(Rhandle)

Ghandleleft = Shapes.GetLeft(Ghandle)
Ghandletop = Shapes.GetTop(Ghandle)

Bhandleleft = Shapes.GetLeft(Bhandle)
Bhandletop = Shapes.GetTop(Bhandle)

'MOVE_RHANDLE
If getRhandleactive = 1 Then
If x > 150 And x < 415 And y > 100 And y < 125 Then
Shapes.Move(Rhandle, x - 10, Rhandletop)
Controls.SetButtonCaption(Ramount, Rhandleleft - 150)
getRamount = Controls.GetButtonCaption(Ramount)
If Rhandleleft > 415 Then
Shapes.Move(Rhandle, 414, Rhandletop)
EndIf
If Rhandleleft < 150 Then
Shapes.Move(Rhandle, 151, Rhandletop)
EndIf
EndIf
EndIf

'MOVE_GHANDLE
If getGhandleactive = 1 Then
If x > 150 And x < 415 And y > 200 And y < 225 Then
Shapes.Move(Ghandle, x - 10, Ghandletop)
Controls.SetButtonCaption(Gamount, Ghandleleft - 150)
getGamount = Controls.GetButtonCaption(Gamount)
If Ghandleleft > 415 Then
Shapes.Move(Ghandle, 414, Ghandletop)
EndIf
If Ghandleleft < 150 Then
Shapes.Move(Ghandle, 151, Ghandletop)
EndIf
EndIf
EndIf

'MOVE_BHANDLE
If getBhandleactive = 1 Then
If x > 150 And x < 415 And y > 300 And y < 325 Then
Shapes.Move(Bhandle, x - 10, Bhandletop)
Controls.SetButtonCaption(Bamount, Bhandleleft - 150)
getBamount = Controls.GetButtonCaption(Bamount)
If Bhandleleft > 415 Then
Shapes.Move(Bhandle, 414, Bhandletop)
EndIf
If Bhandleleft < 150 Then
Shapes.Move(Bhandle, 151, Bhandletop)
EndIf
EndIf
EndIf

'COLOR
color = GraphicsWindow.GetColorFromRGB(getRamount, getGamount, getBamount)
GraphicsWindow.BackgroundColor = color
EndSub

'MOUSE_UP
GraphicsWindow.MouseUp = mu
Sub mu
Controls.SetButtonCaption(rhandleactive, 0)
Controls.SetButtonCaption(ghandleactive, 0)
Controls.SetButtonCaption(bhandleactive, 0)
EndSub