B4J Question [RESOLVED] fx.MsgBox - center dialog to owner

mfstuart

Active Member
Licensed User
Longtime User
Hi all,
In B4J, I use the fx.MsgBox and fx.MsgBox2 to display a message.

B4X:
    Dim res As Int = fx.Msgbox2(frm, "Delete this record?", "Confirm", "Yes", "", "No", fx.MSGBOX_CONFIRMATION)
    If res = fx.DialogResponse.POSITIVE Then
        'delete the record
        DBManager.Delete_URLRecord(SelectedID)
        fx.Msgbox(frm,"Record deleted.", "Attention")
    End If

The position of the opened dialog seems to be random. I'd like it to display center to the owner: frm.

If this is possible, how is it done?

Thanx,
Mark Stuart
 

mfstuart

Active Member
Licensed User
Longtime User
Hi Erel,
Will this nicer dialog allow positioning: center parent?
Or is there a javaobject script/property that can be set to do the above?

Thanx,
Mark Stuart
 
Upvote 0

mfstuart

Active Member
Licensed User
Longtime User
Never mind. I've implemented the xui.MsgBox2Async and xui.MsgBoxAsync methods and they appear to center to the screen instead of random positioning as stated in post #1.

B4X:
    Dim sf As Object = xui.Msgbox2Async("Delete selected record?", "Confirm", "Yes", "", "No", Null)
    Wait For (sf) Msgbox_Result (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        'delete the record
        DBManager.Delete_URLRecord(SelectedID)
        InitTVData   'reload tableview
        xui.MsgboxAsync("Record deleted.", "Attention")
    End If


Thanx Erel,
Mark Stuart
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…