Android Example set and get with more parameters

Now I have started a very big project and I came to the problem how to set and get more parameters.
Yesterday I spent the whole day looking for a solution on the forum how to set and get more than one parameter in Sub setSome / getSome.

But today, I have a ready-made solution that works.
Class module WinOpt:
Private Sub Class_Globals
    Private lblCaption As Label
    Type optFont (aFont As Typeface, aSize As Int, aTypeFace As Typeface, aStyle As Int)
    Private fCls As optFont
End Sub

Public Sub Initialize (Owner As Activity, Module As Object, Event As String)
'    ...............
End Sub

Public Sub AddView (Module As Object, Left As Int, Top As Int, Width As Int, Height As Int)
'    ...............
End Sub

Sub setFont (Font As optFont)
    lblCaption.Typeface = Font.aFont
    lblCaption.TextSize = Font.aSize
    lblCaption.Typeface = Typeface.CreateNew (Font.aTypeFace,Font.aStyle)
End Sub

Sub getFont As optFont
    Return fCls
End Sub

In Main:
Sub Globals
    Dim frmOpen As WinForm
    Dim opt1 As WinOpt
    Dim Sonda (30) As Typeface
    Dim oFont As optFont
    Dim oTypeFace () As Typeface = Array As Typeface   (Typeface.DEFAULT, _
                                                        Typeface.DEFAULT_BOLD, _
                                                        Typeface.MONOSPACE, _
                                                        Typeface.SANS_SERIF, _
                                                        Typeface.SERIF)
    
    Dim oStyle () As Int = Array As Int    (Typeface.STYLE_BOLD, _
                                            Typeface.STYLE_BOLD_ITALIC, _
                                            Typeface.STYLE_ITALIC, _
                                            Typeface.STYLE_NORMAL)
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Sonda(0) = Typeface.LoadFromAssets("courbd.ttf") 'Избор на шрифт
    Sonda(1) = Typeface.LoadFromAssets("anka.ttf")  'Избор на шрифт на дисплея

    Activity.Color = Colors.White

    frmOpen.Initialize (Activity, Me, Null, "frmOpen")
    frmOpen.frmCreate ("This is the ORIGINAL WINDOWS FORM")

    opt1.Initialize (Activity, frmOpen, "opt1")
    opt1.AddView (frmOpen, 2.08%x, 8.62%y, 13.02%x, 5.39%y)
    opt1.Caption = "OptionButton!"

    oFont.aFont = Sonda(0)
    oFont.aSize = 16
    oFont.aStyle = oStyle (0)
    oFont.aTypeFace = oTypeFace (0)
    opt1.FontR = oFont
    Msgbox(oFont.aTypeFace,oFont.aStyle)
End Sub

Before I wrote the above code and after I got desperate that I couldn't enter more than one parameter, I wrote:
setFont / getFont
setFontSize / getFoneSize
setFontStyle / getFontStyle
but my idea is to have many parameters for each component I write, and parameters, as is the case with a font, to combine several at once.
 
I had to change the code slightly:
A type is declared in the main form, and in each module class a variable with a different name for this type is declared.
Class Module WinOpt:
Private Sub Class_Globals
    Private lblCaption As Label
'This type is deleted from the module and moved to the main one
'    Type optFont (aFont As Typeface, aSize As Int, aTypeFace As Typeface, aStyle As Int)
' This variable takes a specific name
    Private optF As optFont
End Sub

Class Module WinChk:
Private Sub Class_Globals
    Private lblCaption As Label
'This type is deleted from the module and moved to the main one
'    Type optFont (aFont As Typeface, aSize As Int, aTypeFace As Typeface, aStyle As Int)
' This variable takes a specific name
    Private chkF As optFont
End Sub

Main:
Sub Globals
    Dim frmOpen As WinForm
    Dim opt1 As WinOpt
    Dim Sonda (30) As Typeface
 'Here we declare the type:
    Type optFont (aFont As Typeface, aSize As Int, aTypeFace As Typeface, aStyle As Int)
     Dim oFont As optFont
    Dim oTypeFace () As Typeface = Array As Typeface   (Typeface.DEFAULT, _
                                                        Typeface.DEFAULT_BOLD, _
                                                        Typeface.MONOSPACE, _
                                                        Typeface.SANS_SERIF, _
                                                        Typeface.SERIF)
The change was necessary because if we have 5, 10, 15, etc. class of the module in the main form we must declare 5, 10, 15, etc. variables with different names of the same type.
 
Top