2008-01-08, 08:53 AM
Hi Sub,
I figured its best to move the issue I am having with UIStatic to its own thread.
I have tried so many different things as you are aware but still get the null reference issue. I have code that now works fine with all the image stuff in there as long as I remove the @Image composite statement from the skin, as soon as the @image statement is reinstated I get the error shown below.
Code in Activate() I have shown all the code so that you can see where the log messages are within the code.
Here is the logfile from the run where the @Image line insitu:
The log file below shows that it never gets to:
Any more ideas on what to try, I have checks on the Getrenderlist and needsRendering routines to make sure that emulatorIconStatic is not null.
I have tried:
All give the same issue...
Any more thoughts?
Cheers
I figured its best to move the issue I am having with UIStatic to its own thread.
I have tried so many different things as you are aware but still get the null reference issue. I have code that now works fine with all the image stuff in there as long as I remove the @Image composite statement from the skin, as soon as the @image statement is reinstated I get the error shown below.
Code in Activate() I have shown all the code so that you can see where the log messages are within the code.
Code:
Public Sub Activate() Implements IMenuTask.Activate
Logger.Verbose(Me.getName() + ": Activate()")
If Not initialized Then
skinHelper = New SkinHelper2(mSkinDirectory + "\skin.xml")
If skinHelper.checkCompositeImageDefined("ScreenName") Then
Logger.Verbose("GameZone: ScreenName Composite image is defined")
Dim parameters As New Hashtable()
parameters("@screenName") = Me.getName()
Me.screenNameElement = New GBPVR.Public.GBPVRUiElement("ScreenName", skinHelper.getPlacementRect("ScreenName"), skinHelper.getNamedImage("ScreenName", parameters))
Else
MsgBox("GameZone: ScreenName Composite image missing")
End If
NoOFFilesLabel = New WizUiLabel(skinHelper, "NoOFFilesLabel", "You Should never see this text", "NoOFFilesLabelImage")
ctlMgr.AddControl(NoOFFilesLabel)
Logger.Verbose("GameZone: control added = NoOFFilesLabel")
NoOFPagesFilesLabel = New WizUiLabel(skinHelper, "NoOFPagesFilesLabel", "You Should never see this text", "NoOFPagesFilesLabelImage")
ctlMgr.AddControl(NoOFPagesFilesLabel)
Logger.Verbose("GameZone: control added = NoOFPagesFilesLabel")
Dim args As New Hashtable()
args("@Text") = "Activate"
args("@Image") = Image.FromFile("c:\\gamezone.jpg")
If skinHelper.checkCompositeImageDefined("emulatorIcon") Then
Logger.Verbose("about to define emulatorIconStatic in activate")
emulatorIconStatic = New UiStatic(skinHelper, "emulatorIcon", args)
End If
Logger.Verbose("GameZone: Never gets here with @Image in the skin.xml file")
main = True
InitFileList()
If emulatorimage IsNot Nothing Then
Logger.Verbose("GameZone: emulatorimage is set")
End If
Dim captions As String() = DirectCast(menuButtons.ToArray(GetType(String)), String())
cmdButtonList = New WizUiButtonList(skinHelper, "ButtonList", captions)
ctlMgr.AddControl(cmdButtonList)
lstMyList1 = New WizUiList(skinHelper, "ListBox1", Me, Nothing)
lstMyList1.AllowMultipleSelections = False
lstMyList1.AutoPosition = True
ctlMgr.AddControl(lstMyList1)
clsGlobal.AppLaunched = False
Logger.Verbose("GameZone: Exiting Activate")
initialized = True
End If
setPopup(Nothing)
ctlMgr.setFocus(cmdButtonList)
Logger.Verbose(Me.getName() + ": Activate() complete.")
End Sub
Here is the logfile from the run where the @Image line insitu:
Code:
2008-01-08 19:02:35.625 VERBOSE [1] GameZone: Activate()
2008-01-08 19:02:35.625 VERBOSE [1] GameZone: ScreenName Composite image is defined
2008-01-08 19:02:35.640 VERBOSE [1] GameZone: control added = NoOFFilesLabel
2008-01-08 19:02:35.640 VERBOSE [1] GameZone: control added = NoOFPagesFilesLabel
2008-01-08 19:02:35.640 VERBOSE [1] about to define emulatorIconStatic in activate
2008-01-08 19:02:35.750 VERBOSE [1] ReturnToMainMenu()
2008-01-08 19:02:35.750 VERBOSE [1] GameZone is currently active
2008-01-08 19:02:35.750 VERBOSE [1] GameZone.Deactivate() called
2008-01-08 19:02:35.750 VERBOSE [1] GameZone: Deactivated
2008-01-08 19:02:35.750 VERBOSE [1] GameZone: Exited Deactivated
2008-01-08 19:02:35.750 VERBOSE [1] GameZone:needsrendering: Not trying emulatorIconStatic this time around
2008-01-08 19:02:35.750 VERBOSE [1] GameZone: Exiting needsRendering routine
2008-01-08 19:02:35.750 VERBOSE [1] GameZone: Entering GetRenderList routine
2008-01-08 19:02:35.765 VERBOSE [1] ReturnToMainMenu()@2
2008-01-08 19:02:35.765 VERBOSE [1] System.NullReferenceException: Object reference not set to an instance of an object.
at GBPVRX2.SkinHelper2.getNamedImage(Image image, String name, Hashtable parameters, XmlNode fromNode)
at GBPVRX2.SkinHelper2.getNamedImage(String name, Hashtable parameters)
at GBPVRX2.UiSupport.UiStatic..ctor(SkinHelper2 skinHelper, String compositeImageName, Hashtable args)
at GameZone.GameZone.GameZoneTask.Activate() in H:\GB-PVR\project\GameZone 2\GameZone 2\GameZone 2\GameZoneTask.vb:line 1123
at GBPVRX2.MenuTask.xd2a3a83a17aec615.OnKeyDown(KeyEventArgs e)
at GBPVRX2.x0061b801bdf12d35.xdae9991ab918b397(Object xdf2e3583f942db7b, KeyEventArgs xc4f45905cb1fc7ba)
at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
at System.Windows.Forms.Control.WmKeyChar(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at GBPVRX2.x0061b801bdf12d35.WndProc(Message& m)
2008-01-08 19:02:35.765 VERBOSE [1] GameZone:needsrendering: Not trying emulatorIconStatic this time around
2008-01-08 19:02:35.765 VERBOSE [1] GameZone: Exiting needsRendering routine
2008-01-08 19:02:35.765 VERBOSE [1] GameZone: Entering GetRenderList routine
The log file below shows that it never gets to:
Code:
Logger.Verbose("GameZone: Never gets here with @Image in the skin.xml file")
Any more ideas on what to try, I have checks on the Getrenderlist and needsRendering routines to make sure that emulatorIconStatic is not null.
I have tried:
Code:
Dim args As New Hashtable()
args("@Text") = ""
args("@Image") = ""
Code:
Dim args As New Hashtable()
args("@Text") = Nothing
args("@Image") = Nothing
All give the same issue...
Any more thoughts?
Cheers