In Erel'sB4X] B4XPages + B4XDrawer tutorial, the sample code does not completely set the "Random Background" color when the form is resized using the mouse. I have tried various code modifications in B4J but to no avail. How could I do it Erel or anyone? Thanks.
I got what you mean.
You just need to set the color of panel1. In B4XPage3
B4X:
Sub B4XPage_MenuClick (Tag As String)
Dim rc As Int= Rnd(xui.Color_Black, xui.Color_White)
If Tag = "Random Background" Then
Panel1.Color=rc
cvs.DrawRect(cvs.TargetRect,rc, True, 0)
cvs.Invalidate
End If
End Sub
In B4XPage2
B4X:
Private Sub B4XPage_Resize (Width As Int, Height As Int)
If Page3.Panel1.IsInitialized Then
ImageView1.Parent.Color = Page3.Panel1.Color
Drawer.Resize(Width, Height)
End If
End Sub
Sub UpdateImage
If Page3.Panel1.IsInitialized Then
ImageView1.Parent.Color = Page3.Panel1.Color
ImageView1.SetBitmap(Page3.cvs.CreateBitmap)
End If
End Sub
Isn't the background color of cvs B4XCanvas of Page3 the bg color of the panel1 of the B4xpage3? what is the same color as the background color of cvs B4XCanvas of Page3 and how do you set it
Isn't the background color of cvs B4XCanvas of Page3 the bg color of the panel1 of the B4xpage3? what is the same color as the background color of cvs B4XCanvas of Page3 and how do you set it
Tried this code within Page2 but did not achieved the intended result
B4X:
Private Sub B4XPage_Resize (Width As Int, Height As Int)
If Page3.Panel1.IsInitialized Then
' ImageView1.Parent.Color = Page3.Panel1.Color
ImageView1.Parent.SetColorAndBorder(Page3.Panel1.Color, 0, 0, 0)
End If
End Sub
Tried this code within Page2 but did not achieved the intended result
B4X:
Private Sub B4XPage_Resize (Width As Int, Height As Int)
If Page3.Panel1.IsInitialized Then
' ImageView1.Parent.Color = Page3.Panel1.Color
ImageView1.Parent.SetColorAndBorder(Page3.Panel1.Color, 0, 0, 0)
End If
End Sub
Page2 (and Page3) when resized (increased) has certain areas having no filled color similar to the ImageView1. One way I suppose to resolve this is to set the background color of the form to that of ImageView1, another is to make the size of ImageView1 similar to the size of the page.
I got what you mean.
You just need to set the color of panel1. In B4XPage3
B4X:
Sub B4XPage_MenuClick (Tag As String)
Dim rc As Int= Rnd(xui.Color_Black, xui.Color_White)
If Tag = "Random Background" Then
Panel1.Color=rc
cvs.DrawRect(cvs.TargetRect,rc, True, 0)
cvs.Invalidate
End If
End Sub
In B4XPage2
B4X:
Private Sub B4XPage_Resize (Width As Int, Height As Int)
If Page3.Panel1.IsInitialized Then
ImageView1.Parent.Color = Page3.Panel1.Color
Drawer.Resize(Width, Height)
End If
End Sub
Sub UpdateImage
If Page3.Panel1.IsInitialized Then
ImageView1.Parent.Color = Page3.Panel1.Color
ImageView1.SetBitmap(Page3.cvs.CreateBitmap)
End If
End Sub
I got what you mean.
You just need to set the color of panel1. In B4XPage3
B4X:
Sub B4XPage_MenuClick (Tag As String)
Dim rc As Int= Rnd(xui.Color_Black, xui.Color_White)
If Tag = "Random Background" Then
Panel1.Color=rc
cvs.DrawRect(cvs.TargetRect,rc, True, 0)
cvs.Invalidate
End If
End Sub
In B4XPage2
B4X:
Private Sub B4XPage_Resize (Width As Int, Height As Int)
If Page3.Panel1.IsInitialized Then
ImageView1.Parent.Color = Page3.Panel1.Color
Drawer.Resize(Width, Height)
End If
End Sub
Sub UpdateImage
If Page3.Panel1.IsInitialized Then
ImageView1.Parent.Color = Page3.Panel1.Color
ImageView1.SetBitmap(Page3.cvs.CreateBitmap)
End If
End Sub