Hi guys,
Well, the title is kind of misleading...
A form cannot be styled to be BOTH as UTILITY and as TRANSPARENT...
So I found a little workaround
The class code is as simple as can be, and is here only to give a kick start..
Well, the title is kind of misleading...
A form cannot be styled to be BOTH as UTILITY and as TRANSPARENT...
So I found a little workaround
B4X:
#Region Project Attributes
#MainFormWidth: 10
#MainFormHeight: 10
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private MyTray As SystemTray
Private MyTrayIcon As TrayIcon
Private MyTrayIconImage As Image
Private MenuItems() As String
Private LauncherTimer As Timer
Private MyLauncher As Launcher
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.SetFormStyle("UTILITY") 'Prevents from appearing in the taskbar
'Providing a way to close the app
MyTray.Initialize
MyTrayIconImage = fx.LoadImage(File.DirAssets,"1.png")
MenuItems = Array As String("Exit B4X-Launcher")
MyTrayIcon.Initialize("MyTray",MyTrayIconImage,MenuItems)
MyTray.AddTrayIcon(MyTrayIcon)
'we place the main form way outside the visible area
MainForm.WindowTop = -1000
'we set a timer to call the "other main form" after this one is shown
LauncherTimer.Initialize("LauncherStart", 200)
LauncherTimer.Enabled = True
MainForm.Show
End Sub
Sub MyTray_MenuClick (Text As String)
Select Text
Case "Exit Launcher"
MyTray.RemoveTrayIcon(MyTrayIcon)
ExitApplication
End Select
End Sub
Private Sub LauncherStart_Tick
LauncherTimer.Enabled = False
MyLauncher.Initialize(MainForm) 'this is the "NewMainForm" class, and we pass MainForm to be then set as the owner
End Sub
The class code is as simple as can be, and is here only to give a kick start..
B4X:
Public Sub Initialize(Owner As Form)
LauncherForm.Initialize("",300,400)
LauncherForm.SetFormStyle("TRANSPARENT")
LauncherForm.BackColor = fx.Colors.Transparent
LauncherForm.SetOwner(Owner)
LauncherForm.Show
End Sub