Platforms to show: All Mac Windows Linux Cross-Platform
/Util/Console and GUI in one project
Required plugins for this example: MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/Console and GUI in one project
This example is the version from Wed, 13th Aug 2019.
Project "Console and GUI in one project.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
// check for arguments
Dim args() As String = Me.ArgumentsMBS
Dim u As Integer = UBound(args)
If u = 0 Then
Return // GUI
Else
RunConsole args
StdoutMBS.Flush
ExitMBS(0)
End If
End EventHandler
Sub RunConsole(args() as string)
isConsole = True
// Console
If TargetWin32 Then
// important on Windows to get anything to show
call StdoutMBS.AttachConsole
end if
StdoutMBS.Write "Hello World"+EndOfLine
// check parameters
Dim u As Integer = UBound(args)
for i as integer = 1 to u
Dim arg As String = args(i)
StdoutMBS.Write str(i)+" "+arg+EndOfLine
next
End Sub
Property isConsole As Boolean
End Class
Class MainWindow Inherits Window
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
The items on this page are in the following plugins: MBS Util Plugin.