When I changed the Framework from Carbon to Cocoa it no longer displays my starting screen. I show a splash screen which works fine, and then the app uses a timer event to close the splash screen and the starting screen for the app is supposed to display. I am not getting any errors and I even built the app without any errors, although when I try to run the built app file it does same thing (shows splash screen but then not the main screen). I do see the icon in the docking area.
Perhaps I am missing something really simple but it works fine with Carbon and not starting out so good with Cocoa. My Mac OS X is 10.9.4. Any suggestions are much appreciated.
Here is code from the Open Event and also from the Timer, which gets triggered when the Splash screen is closed. Apologies that it is a little more than a snippet but perhaps there is something obvious sticking out that isn’t obvious to me.
[code] Dim ScreenHeight As Integer
Dim ScreenWidth As Integer
'save screen resolution
app.ScreenHeight = Screen(0).Height
app.ScreenWidth = Screen(0).Width
app.AutoQuit = True
'get current date for future usage
now3 = new date
l =Len( Str(now3.Month))
If l = 1 Then
app.CurrentDate = “0”
app.CurrentDate = app.CurrentDate + Str(now3.Month)
Else
app.CurrentDate = Str(now3.Month)
End If
app.CurrentDate = app.CurrentDate + “/”
l = Len(Str(now3.Day))
If l = 1 Then
app.CurrentDate = app.CurrentDate + “0”
app.CurrentDate = app.CurrentDate + Str(now3.Day)
Else
app.CurrentDate = app.CurrentDate + Str(now3.Day)
End If
app.CurrentDate = app.CurrentDate + “/”
app.CurrentDate = app.CurrentDate + Str(now3.year)
Dim ScreenHeight As Integer
Dim ScreenWidth As Integer
'save screen resolution
app.ScreenHeight = Screen(0).Height
app.ScreenWidth = Screen(0).Width
app.AutoQuit = True
'get current date for future usage
now3 = new date
l =Len( Str(now3.Month))
If l = 1 Then
app.CurrentDate = “0”
app.CurrentDate = app.CurrentDate + Str(now3.Month)
Else
app.CurrentDate = Str(now3.Month)
End If
app.CurrentDate = app.CurrentDate + “/”
l = Len(Str(now3.Day))
If l = 1 Then
app.CurrentDate = app.CurrentDate + “0”
app.CurrentDate = app.CurrentDate + Str(now3.Day)
Else
app.CurrentDate = app.CurrentDate + Str(now3.Day)
End If
app.CurrentDate = app.CurrentDate + “/”
app.CurrentDate = app.CurrentDate + Str(now3.year)
WindowMainMenu.Visible =False
LabelTextColor = LabelAutoSizeGame1.TextColor 'save default text color for all main menu labels
'assign text so label can resize
LabelAutoSizeSeasons1.Text = "Set Active Season "
LabelAutoSizeSeasons2.Text = "Team Management/Profile -> "
LabelAutoSizeSeasons3.Text = “League/Season Tools”
LabelAutoSizeSeasons4.Text = "SIBB Chart Tools (advanced) "
LabelAutoSizeSeasons5.Text = "Era Normalization (advanced) "
LabelAutoSizeSetting1.Text = "Settings and Preferences (global) "
LabelAutoSizeReport1.Text = “League Reports”
LabelAutoSizeReport2.Text = "Export Reports to File "
LabelAutoSizeReport3.Text = "Build League Website "
#if TargetMacOS
app.CommonPath = SpecialFolder.ApplicationData.Child(“Dombrov Baseball Sim”).Child(“Data”).Child(“Common”)
app.SeasonsPath = SpecialFolder.ApplicationData.Child(“Dombrov Baseball Sim”).Child(“Data”).Child(“Seasons”)
app.HelpPath = SpecialFolder.ApplicationData.Child(“Dombrov Baseball Sim”).Child(“Help”)
app.BallparkImagePath = SpecialFolder.ApplicationData.Child(“Dombrov Baseball Sim”).Child(“Ballpark Images”)
app.PlayerImagePath = SpecialFolder.ApplicationData.Child(“Dombrov Baseball Sim”).Child(“Player Images”)
app.TeamImagePath = SpecialFolder.ApplicationData.Child(“Dombrov Baseball Sim”).Child(“Team Images”)
app.SoundFilesPath = SpecialFolder.ApplicationData.Child(“Dombrov Baseball Sim”).Child(“Sound Files”)
app.ImportPath = SpecialFolder.ApplicationData.Child(“Dombrov Baseball Sim”).Child(“Data”).Child(“Import”)
app.BackdropPath = SpecialFolder.ApplicationData.Child(“Dombrov Baseball Sim”).Child(“Backdrops”)
#else
app.CommonPath = SpecialFolder.Documents.Child(“Dombrov Baseball Sim”).Child(“Data”).Child(“Common”)
app.SeasonsPath = SpecialFolder.Documents.Child(“Dombrov Baseball Sim”).Child(“Data”).Child(“Seasons”)
app.HelpPath = SpecialFolder.Documents.Child(“Dombrov Baseball Sim”).Child(“Help”)
app.BallparkImagePath = SpecialFolder.Documents.Child(“Dombrov Baseball Sim”).Child(“Ballpark Images”)
app.PlayerImagePath = SpecialFolder.Documents.Child(“Dombrov Baseball Sim”).Child(“Player Images”)
app.TeamImagePath = SpecialFolder.Documents.Child(“Dombrov Baseball Sim”).Child(“Team Images”)
app.SoundFilesPath = SpecialFolder.Documents.Child(“Dombrov Baseball Sim”).Child(“Sound Files”)
app.ImportPath = SpecialFolder.Documents.Child(“Dombrov Baseball Sim”).Child(“Data”).Child(“Import”)
app.BackdropPath = SpecialFolder.Documents.Child(“Dombrov Baseball Sim”).Child(“Backdrops”)
#endif
'connect SQLite common database
app.dbcOpen = False
rtn = app.ConnectCommon
if rtn = False Then
Exit Sub
End If
'load game play settings
rtn = app.LoadGameSettings
if rtn = False Then
Exit Sub
End If
'set backdrop and screen text colors
mImage = app.MainScreenImage
CanvasBackdrop.Backdrop = app.MainScreenImage
LabelAutoSizeGame1.TextColor = app.MainScreensTextColor
LabelAutoSizeGame2.TextColor = app.MainScreensTextColor
LabelAutoSizeGame3.TextColor = app.MainScreensTextColor
LabelAutoSizeGame4.TextColor = app.MainScreensTextColor
LabelAutoSizeSeasons1.TextColor = app.MainScreensTextColor
LabelAutoSizeSeasons2.TextColor = app.MainScreensTextColor
LabelAutoSizeSeasons3.TextColor = app.MainScreensTextColor
LabelAutoSizeSeasons4.TextColor = app.MainScreensTextColor
LabelAutoSizeSeasons5.TextColor = app.MainScreensTextColor
LabelAutoSizeSetting1.TextColor = app.MainScreensTextColor
LabelAutoSizeReport1.TextColor = app.MainScreensTextColor
LabelAutoSizeReport2.TextColor = app.MainScreensTextColor
LabelAutoSizeReport3.TextColor = app.MainScreensTextColor
LabelSettings.TextColor = app.MainScreensHeaderColor
LabelSeason.TextColor = app.MainScreensHeaderColor
LabelGamePlay.TextColor = app.MainScreensHeaderColor
LabelReports.TextColor = app.MainScreensHeaderColor
LabelWindowHeader.TextColor = app.MainScreensHeaderColor
HoverColor = app.MainScreensHoverColor
'splash screen and opening sound
'WindowSplash.ShowWithin(WindowMainMenu)
If app.GameSettings.IntroSound <> “” Then
sf = app.SoundFilesPath.Child(app.GameSettings.IntroSound)
If sf <> Nil Then
if sf.Exists Then
snd = sf.OpenAsSound
snd.Play
End If
End If
End If
'load active season
rtn = app.CheckForActiveSeason
if rtn = False Then
Exit Sub
End If
rtn = app.BuildBallparks
if rtn = False Then
Exit Sub
End If
app.Randomizer = New Random
'show splash screen interval
'splash screen and opening sound
WindowMainMenu.Visible =False
WindowSplash.Show
Timer1.Mode = Timer.ModeSingle
Timer1.Period = 2500
'------------------------------------------------------------------------------------------------
‘’ this is code from the Timer Action event (triggered 2.5 seconds after the Open event for the main window)
WindowSplash.Close
WindowMainMenu.Visible =True
WindowMainMenu.Width = app.ScreenWidth
WindowMainMenu.Height = app.ScreenHeight
WindowMainMenu.TextAreaClose.Left = (WindowMainMenu.Width - 124)
WindowMainMenu.CanvasHelp.Left = (WindowMainMenu.Width - 38)
WindowMainMenu.Maximize
If app.GameSettings.FreeEdition = True Then
WindowFreeEdition.ShowModalWithin(WindowMainMenu)
End If
[/code]
The FreeEdition indicator is closed so it isn’t trying to show WindowFreeEdition
WindowMainMenu is setup as a Frame Type of Document.
Thanks,
Richard