#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.
Dim PageNumber As Int
Dim paragraph As String
paragraph = "I’ve came across this mediocre status quo of my life. I’m almost on the primal point of conformity in this world. I’ve come out on peak where rivalries are extremely vied. I have passed those vendettas and feuds of life and came to groove with the rhythm of dynamism in living. I let slithered those failures and slipped a bit at the grip of living, but I always had my flag held up high for those laurels and feats I have experienced. I still remember clearly. It was a few months ago. It was the mystical month of January when flowers then were in bloom and the breeze felt like fresh hay. When my fate led me to this woman and still admired till today."
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)
Activity.LoadLayout("ketab")
PageTurner.Initialize("PageTurner", 20)
Activity.AddView(PageTurner, 10dip, 10dip, Activity.Width - 20dip, Activity.Height - 20dip)
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_CENTER, PageTurner.Width - 20dip, LeftMargin, PageTurner.Height - 20dip, TopMargin, LineSpacing)
PageTurner.SetMarginPixels(10dip, 10dip, 10dip, 10dip)
End If
PageTurner.AllowLastPageCurl = False ' the default is true
Font = Font.CreateNew(Typeface.SERIF, Typeface.STYLE_NORMAL)
Dim text As String
For i = 0 To paracount - 1
text = text & paragraph & CRLF & CRLF
Next
Pager.SetPaintParameters(Font, 16, Colors.Black, True)
Pager.Paginate(text)
End Sub
Sub Activity_Resume
PageTurner.CurrentPage = PageNumber
PageTurner.Color = Colors.LightGray ' otherwise it gets lost on Pause and Resume without a Create
PageTurner.OnResume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
PageNumber = PageTurner.CurrentPage
PageTurner.OnPause
End Sub
Sub ShowPTError(title As String, msg As String)
Msgbox(msg, title)
End Sub
Sub PageTurner_GetBitmap(Width As Int, Height As Int, Page As Int) As Bitmap
Dim bmp As Bitmap
Dim cnv As Canvas
bmp.InitializeMutable(Width, Height)
Try
If Page = 0 Then
cnv.Initialize2(bmp)
cnv.DrawColor(Colors.ARGB(255,129,23,56))
cnv.DrawText( "(To the Seraph of Angels..) ", Width/2, 100dip, Typeface.DEFAULT, 24, Colors.White, "CENTER")
Return bmp
Else If Page = Pager.PageCount + 1 Then
cnv.Initialize2(bmp)
cnv.DrawColor(Colors.DarkGray)
cnv.DrawText( "The End", Width/2, 100dip, Typeface.DEFAULT, 24, Colors.White, "CENTER")
Return bmp
Else
Return Pager.GetPageBitmap(Page - 1, Colors.Cyan)
End If
Catch
PTException
End Try
Return bmp
End Sub
Sub PageTurner_GetPages() As Int
Try
Return Pager.PageCount + 2
Catch
Return 0
End Try
End Sub
Sub PTException()
Dim Ex As ExceptionEx
Dim where As String
Ex = LastException
Dim args(2) As Object
args(0) = LastException.Message
where = Ex.StackTraceElement(2)
args(1) = where
PageTurner.RunOnGuiThread("ShowPTError", args)
End Sub
سوال
farshid71 3
سلام من از کد ورق خوردن توی برنامه استفاده کردم اما موقع اجرا خطای زیر رومیده
B4A version: 6.80
Parsing code. (0.00s)
Compiling code. (0.09s)
Compiling layouts code. (0.01s)
Organizing libraries. (0.00s)
Generating R file. (0.05s)
Compiling generated Java code. Error
javac 1.8.0_121
src\b4a\example\ketab1.java:62: error: cannot find symbol
if (anywheresoftware.b4a.objects.ServiceHelper.StarterHelper.startFromActivity(processBA, wl, false))
^
symbol: variable StarterHelper
location: class ServiceHelper
1 error
اینم کد برنامه
#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. Dim PageNumber As Int Dim paragraph As String paragraph = "I’ve came across this mediocre status quo of my life. I’m almost on the primal point of conformity in this world. I’ve come out on peak where rivalries are extremely vied. I have passed those vendettas and feuds of life and came to groove with the rhythm of dynamism in living. I let slithered those failures and slipped a bit at the grip of living, but I always had my flag held up high for those laurels and feats I have experienced. I still remember clearly. It was a few months ago. It was the mystical month of January when flowers then were in bloom and the breeze felt like fresh hay. When my fate led me to this woman and still admired till today." 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) Activity.LoadLayout("ketab") PageTurner.Initialize("PageTurner", 20) Activity.AddView(PageTurner, 10dip, 10dip, Activity.Width - 20dip, Activity.Height - 20dip) 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_CENTER, PageTurner.Width - 20dip, LeftMargin, PageTurner.Height - 20dip, TopMargin, LineSpacing) PageTurner.SetMarginPixels(10dip, 10dip, 10dip, 10dip) End If PageTurner.AllowLastPageCurl = False ' the default is true Font = Font.CreateNew(Typeface.SERIF, Typeface.STYLE_NORMAL) Dim text As String For i = 0 To paracount - 1 text = text & paragraph & CRLF & CRLF Next Pager.SetPaintParameters(Font, 16, Colors.Black, True) Pager.Paginate(text) End Sub Sub Activity_Resume PageTurner.CurrentPage = PageNumber PageTurner.Color = Colors.LightGray ' otherwise it gets lost on Pause and Resume without a Create PageTurner.OnResume End Sub Sub Activity_Pause (UserClosed As Boolean) PageNumber = PageTurner.CurrentPage PageTurner.OnPause End Sub Sub ShowPTError(title As String, msg As String) Msgbox(msg, title) End Sub Sub PageTurner_GetBitmap(Width As Int, Height As Int, Page As Int) As Bitmap Dim bmp As Bitmap Dim cnv As Canvas bmp.InitializeMutable(Width, Height) Try If Page = 0 Then cnv.Initialize2(bmp) cnv.DrawColor(Colors.ARGB(255,129,23,56)) cnv.DrawText( "(To the Seraph of Angels..) ", Width/2, 100dip, Typeface.DEFAULT, 24, Colors.White, "CENTER") Return bmp Else If Page = Pager.PageCount + 1 Then cnv.Initialize2(bmp) cnv.DrawColor(Colors.DarkGray) cnv.DrawText( "The End", Width/2, 100dip, Typeface.DEFAULT, 24, Colors.White, "CENTER") Return bmp Else Return Pager.GetPageBitmap(Page - 1, Colors.Cyan) End If Catch PTException End Try Return bmp End Sub Sub PageTurner_GetPages() As Int Try Return Pager.PageCount + 2 Catch Return 0 End Try End Sub Sub PTException() Dim Ex As ExceptionEx Dim where As String Ex = LastException Dim args(2) As Object args(0) = LastException.Message where = Ex.StackTraceElement(2) args(1) = where PageTurner.RunOnGuiThread("ShowPTError", args) End Sub
لینک ارسال
به اشتراک گذاری در سایت های دیگر
0 پاسخ به این سوال تاکنون داده شده است
ارسالهای توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.