Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/Windows Console
Function:
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Windows Console
This example is the version from Sun, 17th Mar 2012.
Project "Windows Console.rbp"
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub Open() dim b as boolean dim s as script dim t as string crlf=chr(13)+chr(10) c=new console s=new script if c.gotConsole then c.title="RBScript console" c.textColor=c.red b=c.writeConsole("Please enter a RBScript command:"+crlf) c.textColor=15 // red+blue+green+highlight do b=c.writeConsole(">") t=c.readConsole(80) if t<>"" then if t="quit" then quit else s.source=replaceall(t,";",chr(13)) s.run end if end if loop end if quit End EventHandler
Property c As console
Property crlf As string
End Class
Class Console Inherits WindowsConsoleMBS
EventHandler Function UserClose() As boolean msgBox "User clicked close box." End EventHandler
End Class
Class Script Inherits RbScript
EventHandler Sub CompilerError(line As Integer, errorNumber As Integer, errorMsg As String) if app.c.writeConsole("Compile error at line "+str(line)+" with error "+str(errornumber)+": "+errorMsg+"."+app.crlf) then end if End EventHandler
EventHandler Function Input(prompt As String) As String if app.c.writeConsole(prompt+app.crlf) then return app.c.ReadConsole(80) end if End EventHandler
EventHandler Sub Print(msg As String) if app.c.writeConsole(msg+app.crlf) then end if End EventHandler
EventHandler Sub RuntimeError(line As Integer, error As RuntimeException) if app.c.writeConsole("Runtime error at line "+str(line)+"."+app.crlf) then end if End EventHandler
End Class
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Win Plugin.




Links
MBS Xojo Plugins