iOS Question How do I change the font size of the first line in AddTwoLines?

Discussion in 'iOS Questions' started by davepamn, Mar 18, 2015.

  1. davepamn

    davepamn Active Member Licensed User

    Code:
    Dim tc As TableCell=tvMembers.AddTwoLines(sMemberName,"")

                
    Dim oDetailText As AttributedString

                tc.IndentationLevel=
    2

                oDetailText.Initialize(sMemberNumber,
    Font.CreateNew(30),Colors.Blue)

                tc.DetailText=oDetailText

                tc.Tag=sMemberNumber
    The second line has a large font size, but the first line has a small font size
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Have you posted it as an example? It should work.
     
  3. davepamn

    davepamn Active Member Licensed User

    I had too write a two line custom function to get it work
     
  4. davepamn

    davepamn Active Member Licensed User

    Code:
    Private tvMembers As TableView

                
    Dim tc As TableCell=tvMembers.AddSingleLine("")

                tc.CustomView=Createitem2(tvMembers,sMemberName,sMemberNumber,
    255,255,255,255,30,Colors.Black)

                tc.Tag=sMemberNumber


    Private Sub Createitem2(tvTableview As TableView, sLine1Value As String,sLine2Value As String, iAlpha As Int, iRed As Int, iGreen As Int, iBlue As Int,iFontSize As Int,iFontColor As Int) As Panel

        
    Dim oPanel As Panel

        
    Dim lblLine1Data As Label

        
    Dim lblLine2Data As Label

        
    Dim iOffset As Int=0

        oPanel.Initialize(
    "2ItemPanel")

        lblLine1Data.Initialize(
    "line1data")

        lblLine1Data.Text=sLine1Value
     
        lblLine1Data.Tag=sLine1Value

        lblLine1Data.color=
    Colors.ARGB(iAlpha,iRed,iGreen,iBlue)

        lblLine1Data.Font=
    Font.CreateNew(iFontSize)

        lblLine1Data.TextColor=iFontColor

        iOffset=tvTableview.RowHeight/
    2

        oPanel.Width=
    100%x

        oPanel.Height=tvTableview.RowHeight

        oPanel.AddView(lblLine1Data,
    0,0,100%x,tvTableview.RowHeight/2)

        
    'Line 2

        lblLine2Data.Initialize(
    "line2data")

        lblLine2Data.Text=sLine2Value

        lblLine2Data.Tag=sLine2Value

        lblLine2Data.color=
    Colors.ARGB(iAlpha,iRed,iGreen,iBlue)

        lblLine2Data.Font=
    Font.CreateNew(iFontSize)

        lblLine2Data.TextColor=iFontColor

        oPanel.AddView(lblLine2Data,
    20dip,iOffset,100%x ,tvTableview.RowHeight/2)

        
    Return(oPanel)

    End Sub

    Sub tvMembers_SelectedChanged(SectionIndex As Int, Cell As TableCell)

        
    Try

                
    'Get the Cell Tag value
                sGlobalKey=Cell.Tag

                
    'Get the 1 line label tag value
                sGlobalLine1Tag=Cell.CustomView.GetView(0).Tag
                sGlobalLine2Tag=Cell.CustomView.GetView(
    1).Tag
          
        
    Catch

                oError.ShowLastException(
    "tvMember Selected Changed")

        EndTry



    End Sub
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice