B4J Question [Solved]How to change fx.MSGBOX_WARNING in Msgbox2Async()

Theera

Expert
Licensed User
Longtime User
B4X:
Private Sub Button2_Click
    'old
'    Dim res As Int = fx.Msgbox2(MainForm, "Do you want to save changes?", "Save Data", "Yes", "Cancel", "No", fx.MSGBOX_WARNING)
'    If res = fx.DialogResponse.POSITIVE Then
'        Log("Saving changes...")
'    End If
'-------------------------------------------------------------------------------------
     'new
   
    Dim res As Object=  xui.Msgbox2Async("Do you want to save changes?","Save Data","Yes","Cancel","No", fx.MSGBOX_WARNING )
    Wait For (res) Msgbox_Result (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Log("Saving changes...")
    End If
      
End Sub
 

Fernando Solá

Member
Licensed User
Longtime User
Just use your own image file and load it.

B4X:
Dim res As Object=  xui.Msgbox2Async("Do you want to save changes?","Save Data","Yes","Cancel","No", fx.LoadImage(File.DirAssets,"yourfile.png"))

You could have any number of images for any case you may need.
 
Upvote 0

Theera

Expert
Licensed User
Longtime User
Just use your own image file and load it.

B4X:
Dim res As Object=  xui.Msgbox2Async("Do you want to save changes?","Save Data","Yes","Cancel","No", fx.LoadImage(File.DirAssets,"yourfile.png"))

You could have any number of images for any case you may need.
Thank you for your reply.
 
Upvote 0

Theera

Expert
Licensed User
Longtime User
Is possibility using fx.MSGBOX_WARNING directly?
 
Upvote 0

Theera

Expert
Licensed User
Longtime User
I don't think it is possible since these values are matched to the JavaFX static final constants. By definition they can not be modified. Check the JavaFX documentation on AlertType.
After I have tested your strategy ,it doesn't work.
B4X:
Dim res As Object=  xui.Msgbox2Async("Do you want to save changes?","Save Data","Yes","Cancel","No", fx.LoadImage(File.DirAssets,"yourfile.png"))
 

Attachments

  • MsgBoxToBeMsgBoxAysc.zip
    4.9 KB · Views: 26
Upvote 0

klaus

Expert
Licensed User
Longtime User
This works:
B4X:
Dim res As Object=  xui.Msgbox2Async("Do you want to save changes?","Save Data","Yes","Cancel","No", xui.LoadBitmap(File.DirAssets,"yourfile.png"))
You must have an image file in the Files folder of the project. Replace "yourfile.png" by the name of the image file you want to use.
 
Upvote 0

Fernando Solá

Member
Licensed User
Longtime User
screencap.png

I don't see the issue... besides the fact that there was a double declaration for the same variable in the code. One as Int one as Object.
 
Upvote 0
Solution
Top