I am probably doing something wrong, but I am attempting to use the CustomDialog/CustomLayoutView to perform the old "Two Text lines and Image" thing that ListView used to do.
Except in this case, I am only needing one text line so that is what I am doing. I wrote some test code, but its crashing sayin the ImageView/Label isnt initialized, but I am loading the "LogoSlot" layout in each panel which contains the controls. Not sure exactly whats happening,
Code:
Thoughts?
Except in this case, I am only needing one text line so that is what I am doing. I wrote some test code, but its crashing sayin the ImageView/Label isnt initialized, but I am loading the "LogoSlot" layout in each panel which contains the controls. Not sure exactly whats happening,
Code:
B4X:
'Called from specific sports layout classes to set the team logo
Sub SetTeamLogo_Click(Side As Int)
'Grab the Logos stored in the database, if there are no logos we must silently return without prompting for the Logo selection
Wait For (ConfigDB.RetrieveAllLogos) Complete (Result As Int) 'Get the logos
If Result <> 2 Then 'If we didnt get anything out of the database, we mark no logos available and return.
ScoreEngine.LogosAvailable = False
ScoreEngine.TeamLogo.GuestLogoSet = False
ScoreEngine.TeamLogo.HomeLogoSet = False
ScoreEngine.TeamLogo.TeamLogoHome = 0
ScoreEngine.TeamLogo.TeamLogoGuest = 0
Return
End If
'Build a list of logos stored in the database and display them for the operator to choose
Dim LogoDialog As CustomLayoutDialog
LogoDialog.ShowAsync("Choose Team Logo", "", "", "", Null, True) 'Initialize the dialog to be displayed
LogoDialog.SetSize(60%x, 400dip)
Wait For Dialog_Ready(pnl As Panel)
pnl.LoadLayout("CustomDialogLayout") 'Load the layout which contains the list view.
CLVDialog.PressedColor = Colors.ARGB(255, 0x7E, 0xB4, 0xFA)
CLVDialog.Clear
For Each Logo As TeamLogo In ConfigDB.Logos
CLVDialog.Add(CreateListItem(Logo), Logo)
Next
'Wait for the person to pick a slot, or if the dialog is canceled, we never reach here.
Wait For CLVDialog_ItemClick (Index As Int, Value As Object)
'This routine should never evaluate true, but we need to handle it in case it does.
If CLVDialog.Size = 0 Then 'We didn't find any availble initialized connection slots
LogoDialog.CloseDialog(DialogResponse.NEGATIVE)
Return
End If
Log("something")
End Sub
Sub CreateListItem(Logo As TeamLogo) As Panel
Dim ItemPanel As Panel
Dim imgLogoPicture As ImageView
Dim lblLogoName As Label
ItemPanel.Initialize("")
ItemPanel.LoadLayout("LogoSlot")
imgLogoPicture.Bitmap = Common.ReturnImageFromBytes(Logo.Logo)
lblLogoName.Text = Logo.LogoName
Return ItemPanel
End Sub
Thoughts?