Well i am trying...
to set specific font size to a node - seems that style get the property / but result not seen at screen...
Is actually for the snippet here:
replace SizeControls with this:
CSSUtils.setStyleProperty(N,"-fx-font-size",sstyle) ??
to set specific font size to a node - seems that style get the property / but result not seen at screen...
Is actually for the snippet here:
[B4J] Scaling Form Controls to new size of Form
Well, sometimes questions get answers --> sometimes creating simple and crazy ideas... but here we are... Well this question: https://www.b4x.com/android/forum/threads/b4x-zoom-form-pane-b4xview.136107/#post-861197 made me think how to resizecontrols/scale them to a bigger or smaller form...
www.b4x.com
replace SizeControls with this:
B4X:
Sub SizeControls(t As Form, width1 As Double, height1 As Double, width2 As Double, height2 As Double)
Dim praxi1 As String, praxi2 As String
Dim mp1 As Double, mp2 As Double
Dim sstyle As String, ss As Int
If width2 > width1 Then praxi1="*" Else praxi1=":"
If height2 > height1 Then praxi2="*" Else praxi2=":"
If praxi1="*" Then
mp1=width2/width1
Else
mp1=width1/width2
End If
If praxi2="*" Then
mp2=height2/height1
Else
mp2=height1/height2
End If
For a = 0 To t.RootPane.NumberOfNodes -1
Dim N As Node = t.RootPane.GetNode(a)
If praxi1="*" Then n.Left=n.left * mp1 Else n.Left=n.left / mp1
If praxi2="*" Then n.Top=n.Top*mp2 Else n.Top=n.Top/mp2
If praxi1="*" Then n.PrefWidth=n.PrefWidth*mp1 Else n.PrefWidth=n.PrefWidth/mp1
If praxi2="*" Then n.PrefHeight=n.PrefHeight*mp2 Else n.PrefHeight=n.PrefHeight/mp2
sstyle=CSSUtils.GetStyleProperty(N,"-fx-font-size")
Log(sstyle)
If sstyle.Trim="" Or sstyle.Trim=Null Then sstyle="0"
ss=sstyle.Trim
If ss=0 Then
sstyle="15.00"
ss=15
End If
If praxi2="*" Then
ss=ss * mp2
sstyle=NumberFormat2(ss,1,2,2,False)
CSSUtils.setStyleProperty(N, "-fx-font-size",sstyle) 'seems that setstyle setting the style - because after recalling sizecontrols getting the new style... but not see the result !
Else
ss=ss / mp2
sstyle=NumberFormat2(ss,1,2,2,False)
CSSUtils.setStyleProperty(N,"-fx-font-size",sstyle)
End If
'For Each subN As Node In N. -------------> how to get sub nodes and recall the sizecontrols to size them all ?
'-------
'-----
'Next
Next
End Sub
CSSUtils.setStyleProperty(N,"-fx-font-size",sstyle) ??