alireza_kh
New Member
B4X:
Sub Globals
Dim p As Panel
Dim StrUtil As StringUtils
Private Sclmatn As ScrollView
Private Pnlmatn As Panel
Private LblArabic As Label
Private Lblfarsi As Label
Private Lbltozih As Label
Dim s As Int = 3%y
Private Btnshare As Button
Private Btnlike As Button
Private plus As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("scrollmatn")
Sql2.Initialize(File.DirInternal,"data.db",True)
cur = Sql2.ExecQuery2("SELECT * FROM TblMatn1 WHERE FehID = ?", Array As String(meghdar))
For i = 0 To cur.RowCount-1
cur.Position = i
p.Initialize("p")
p.LoadLayout("matn")
p.Color=Colors.Green
Sclmatn.Panel.AddView(p,0,s,100%x,100%y)
LblArabic.Text = cur.GetString("MatnArabi")
Log(LblArabic.Text)
LblArabic.Height = StrUtil.MeasureMultilineTextHeight(LblArabic,LblArabic.Text)
plus.Tag=1
Lblfarsi.Text = cur.GetString("MatnFarsi")
Lblfarsi.Top=LblArabic.Height+LblArabic.Top+3%y
Lblfarsi.Height = StrUtil.MeasureMultilineTextHeight(Lblfarsi,Lblfarsi.Text)
Log(Lblfarsi.Text)
Lbltozih.Text = cur.GetString("Tozihat")
Lbltozih.Top=Lblfarsi.Height+Lblfarsi.Top+3%y
Lbltozih.Height = StrUtil.MeasureMultilineTextHeight(Lbltozih,Lbltozih.Text)
Log(Lbltozih.Text)
p.Height=Btnshare.Height+LblArabic.Height+Lblfarsi.Height+Lbltozih.Height+9%y
Pnlmatn.Height=Btnshare.Height+LblArabic.Height+Lblfarsi.Height+Lbltozih.Height+10%y
s = s +Btnshare.Height+LblArabic.Height+Lblfarsi.Height+Lbltozih.Height+10%y
Sclmatn.Panel.Height = s
Btnshare.Tag=cur.GetString("MatnArabi")&cur.GetString("MatnFarsi")
Next
End Sub
Sub plus_Click
Dim tag As Int
Dim Mybtn As Button
Mybtn = Sender
tag = Mybtn.Tag
Log(tag)
For Each v As View In Sclmatn.Panel.GetAllViewsRecursive
If v Is Label Then
Dim myLabel As Label = v
myLabel.TextSize=myLabel.TextSize+1
myLabel.Height = StrUtil.MeasureMultilineTextHeight(myLabel,myLabel.Text)
End If
Next
End Sub