hello to all
I am creating an object that allows me to create a common basis for the activity (why B4A not support class inheritance).
I need help to send messages from the menu class activity linked object.
In practice, the object I create the menu of Activity but I want the message "remain" in the subject without having to send in the same class.
I am creating an object that allows me to create a common basis for the activity (why B4A not support class inheritance).
I need help to send messages from the menu class activity linked object.
In practice, the object I create the menu of Activity but I want the message "remain" in the subject without having to send in the same class.
B4X:
Sub Class_Globals
Private m_Parent As Activity
Private bar As StdActionBar
Private bmpNuova, bmpChiudi, bmpSalva, bmpMenu As Bitmap
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(aActivity As Activity, aSubTitle As String)
m_Parent = aActivity
CreateUI
End Sub
' creo interfaccia utente
Sub CreateUI
bar.Initialize("bar")
bar.ShowUpIndicator = True
bmpChiudi = LoadBitmap( File.DirAssets, "img/indietro.png" )
bmpNuova = LoadBitmap( File.DirAssets, "img/nuovo.png" )
bmpSalva = LoadBitmap( File.DirAssets, "img/salva.png" )
m_Parent.AddMenuItem3("Nuova Anagrafica", "cmdNuova", bmpNuova, True)
m_Parent.AddMenuItem3("Salva Documento", "cmdSalva", bmpSalva, True)
m_Parent.AddMenuItem3("Chiudi", "cmdChiudi", bmpChiudi, True)
End Sub
Sub bar_ButtonClicked
m_Parent.Finish
End Sub
Sub cmdChiudi_Click
m_Parent.Finish
End Sub
Sub cmdNuova_Click
Msgbox("new", "new")
End Sub
B4X:
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim m_BaseClass As CActivityBase
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
m_BaseClass.Initialize(Activity, "title")
Activity.LoadLayout("a")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub cmdChiudi_click
Msgbox("close", "close")
'note
'I wish that this message is sent to the object and not the activity or object that is turned on automatically.
End Sub