PageTurnView: text scale issue

varbello

Member
Licensed User
Longtime User
When i set '#FullScreen: true', and 'Activity.Height - 50dip' on the activity , the text is not scaled properly.
If the last line of the previous page is short , i get a 'crlf' in the beginning of the next page, making the last line(of new page) disappear at the bottom.

I have tried different combinations with all the dip's but no luck.

I basically want '#FullScreen: true' and
B4X:
Activity.AddView(PageTurner, 0dip, 0dip, Activity.Width, Activity.Height - 50dip)

Can someone tell me what i am doing wrong ?

B4X:
#Region Module Attributes
   #FullScreen: true
   #IncludeTitle: True
   #ApplicationLabel: PageTurnView Demo
   #VersionCode: 1
   #VersionName: 
   #SupportedOrientations: unspecified
   #CanInstallToExternalStorage: False
#End Region

'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Dim PageNumber As Int ' save page number during device rotation
   
   Dim ipsum As String
   
'   Dim paracount As Int : paracount = 8
   Dim LeftMargin As Int : LeftMargin = 10dip
   Dim TopMargin As Int : TopMargin = 10dip
   Dim LineSpacing As Int : LineSpacing = 1
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 PageTurner As PageTurnView
   Dim Pager As TextPaginator
   Dim Font As Typeface
End Sub

Sub Activity_Create(FirstTime As Boolean)
   PageTurner.Initialize("PageTurner", 20)
   Activity.AddView(PageTurner, 0dip, 0dip, Activity.Width, Activity.Height - 50dip)

   If Activity.Width > Activity.Height Then
      PageTurner.TwoPages = True ' the default is False
      PageTurner.RenderLeftPage = True ' the default is True
      Pager.SetPageParameters(Pager.ALIGN_NORMAL, PageTurner.Width/2 - 12dip, LeftMargin, PageTurner.Height - 12dip, TopMargin, LineSpacing)
      PageTurner.SetMarginPixels(6dip, 6dip, 6dip, 6dip)
   Else   
      PageTurner.TwoPages = False 
      PageTurner.RenderLeftPage = False
      Pager.SetPageParameters(Pager.ALIGN_NORMAL, PageTurner.Width-20dip , LeftMargin, PageTurner.Height -20dip, TopMargin, LineSpacing)
      PageTurner.SetMarginPixels(10dip, 10dip, 10dip, 10dip)
   End If
   PageTurner.AllowLastPageCurl = False ' the default is true   
   

   ipsum = File.ReadString(File.DirAssets,"7-.txt")
   Font = Font.CreateNew(Typeface.SERIF, Typeface.STYLE_NORMAL)
   Dim text As String
'   For i = 0 To paracount - 1
      text = ipsum & CRLF & CRLF
'   Next
   Pager.SetPaintParameters(Font, 16, Colors.Black, True)
   Pager.Paginate(text)
   
End Sub
 
Last edited:
Top