' Small Basic for Windows 8 Tablet Example Program ' Copyright (C)2014-2016, Philip Munts, President, Munts AM Corp. ' ' Redistribution and use in source and binary forms, with or without ' modification, are permitted provided that the following conditions are met: ' ' * Redistributions of source code must retain the above copyright notice, ' this list of conditions and the following disclaimer. ' ' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ' IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ' ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE ' LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ' CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ' SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ' INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ' CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ' ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ' POSSIBILITY OF SUCH DAMAGE. ' Layout the GUI GraphicsWindow.Title = "Tablet Example" GraphicsWindow.BrushColor = "black" If LDFile.Exists("C:\ProgramData\MuntsTechnologies\tablet.txt") Then ' Layout the GUI for Windows 8 tablet LDUtilities.GWState = 2 W = GraphicsWindow.Width H = GraphicsWindow.Height GraphicsWindow.FontSize = 36 GraphicsWindow.DrawText(W/2 - 200, 50, "Small Basic Windows 8") GraphicsWindow.DrawText(W/2 - 150, 100, "Tablet Example") GraphicsWindow.FontSize = 30 ButtonChange = Controls.AddButton("Change", W/2 - 200, 200) ButtonQuit = Controls.AddButton("Quit", W/2 + 100, 200) Else ' Layout the GUI for Windows Desktop GraphicsWindow.Width = 260 GraphicsWindow.Height = 150 GraphicsWindow.FontSize = 18 GraphicsWindow.DrawText(25, 20, "Small Basic Windows 8") GraphicsWindow.DrawText(60, 40, "Tablet Example") GraphicsWindow.FontSize = 14 ButtonChange = Controls.AddButton("Change", 60, 80) ButtonQuit = Controls.AddButton("Quit", 160, 80) GraphicsWindow.Show() Endif ' Register the button event handler Controls.ButtonClicked = ButtonHandler ' Implement the button event handler Sub ButtonHandler b = Controls.LastClickedButton If b = ButtonChange Then If GraphicsWindow.BackgroundColor = "#FF0000" Then GraphicsWindow.BackgroundColor = "#FFFFFF" Else GraphicsWindow.BackgroundColor = "#FF0000" EndIf ElseIf b = ButtonQuit Then Program.End() EndIf EndSub