I have 2 buttons with same name. One in B4XMain and one in Page1. Both click events are identical except for the reference to the B4XMainPage added in page1. Is there a way to do away with one of the subs. There is a label called lblDate also in each page layout:
'Below In Page1:
Thank you
B4X:
Public Sub btnDate_Click
Wait For (Dialog.ShowTemplate(DateTemplate, "", "", "CANCEL")) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
Log($"Selected Date is: ${DateTime.Date(DateTemplate.Date}"$ ))
lblDate.Text=DateTime.Date(DateTemplate.Date)
lblDate.TextColor =xui.Color_Yellow
End If
End Sub
'Below In Page1:
B4X:
Sub btnDate_Click
Wait For (B4XPages.MainPage.Dialog.ShowTemplate(B4XPages.MainPage.DateTemplate, "", "", "CANCEL")) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
Log($"Selected Date is: ${DateTime.Date(B4XPages.MainPage.DateTemplate.Date}"$ ))
lblDate.Text=DateTime.Date(B4XPages.MainPage.DateTemplate.Date)
lblDate.TextColor =xui.Color_Black
End If
End Sub