B4J Question [SOLVED] B4XDialog - How can I round the sharp edges?

T201016

Active Member
Licensed User
Longtime User
Hi,
When calling Dialog like below, it also shows me the layer
with sharp edges. See the arrow in the left corner.

How can I round the sharp edges of this layer to a similar size
how did I do for MainForm?

Dialog Show:
Private Dialog As B4XDialog
...

    Dialog.Initialize(MainForm.RootPane)
    Dialog.TitleBarTextColor = xu.Color_LightGray
    Dialog.TitleBarColor = xu.Color_Transparent
    Dialog.BackgroundColor = 0xFF4C505B
    Dialog.BorderColor = xu.Color_ARGB(255,218,165,32)
    Dialog.BorderCornersRadius = 11
    Dialog.BorderWidth = 1
    Dialog.ButtonsColor = xu.Color_Transparent
    Dialog.ButtonsHeight = 40dip
    Dialog.ButtonsTextColor = xu.Color_ARGB(255,218,165,32)
    Dialog.ButtonsTextColorDisabled = xu.Color_Black
    Dialog.VisibleAnimationDuration = 600
   
    Dialog.Title = "Exit App"
    Wait For (Dialog.Show($"You want to go out of the application, Are you sure ?"$,"Yes","","Cancel")) Complete (Resp As Int)
    Return Resp
 

Attachments

  • ScreenShot00005.png
    ScreenShot00005.png
    10.6 KB · Views: 141
Solution
I solved the problem myself ?

I just had such an idea:
Private Sub ExitFromTheApplication As ResumableSub
    Dialog.Title = AppTitle
    UpdateClip(MainForm.RootPane, 25)
    Wait For (Dialog.Show($"You want to go out of the application, Are you sure ?"$,"Yes","","Cancel")) Complete (Resp As Int)
    Return Resp
End Sub

'V.1.0
Private Sub UpdateClip (pnl As B4XView, CornersRadius As Int)
#if B4J
    Dim jo As JavaObject = pnl
    Dim shape As JavaObject
    Dim cx As Double = pnl.Width
    Dim cy As Double = pnl.Height
    shape.InitializeNewInstance("javafx.scene.shape.Rectangle", Array(cx, cy))
    If CornersRadius > 0 Then
        Dim d As Double = CornersRadius * 2
        shape.RunMethod("setArcHeight", Array(d))...

T201016

Active Member
Licensed User
Longtime User
I solved the problem myself ?

I just had such an idea:
Private Sub ExitFromTheApplication As ResumableSub
    Dialog.Title = AppTitle
    UpdateClip(MainForm.RootPane, 25)
    Wait For (Dialog.Show($"You want to go out of the application, Are you sure ?"$,"Yes","","Cancel")) Complete (Resp As Int)
    Return Resp
End Sub

'V.1.0
Private Sub UpdateClip (pnl As B4XView, CornersRadius As Int)
#if B4J
    Dim jo As JavaObject = pnl
    Dim shape As JavaObject
    Dim cx As Double = pnl.Width
    Dim cy As Double = pnl.Height
    shape.InitializeNewInstance("javafx.scene.shape.Rectangle", Array(cx, cy))
    If CornersRadius > 0 Then
        Dim d As Double = CornersRadius * 2
        shape.RunMethod("setArcHeight", Array(d))
        shape.RunMethod("setArcWidth", Array(d))
    End If
    jo.RunMethod("setClip", Array(shape))
#else if B4A
    Dim jo As JavaObject = pnl
    jo.RunMethod("setClipToOutline", Array(CornersRadius > 0))
#end if
End Sub
 
Upvote 0
Solution
Top