Ask Your Question
0

BASIC: how to raise temporary popup message ("toast")

asked 2019-10-26 12:06:21 +0100

kxr gravatar image

BASIC: how to raise a temporary popup message ("toast") - not a normal MsgBox which needs to be clicked away?

edit retag flag offensive close merge delete

Comments

Hello,

Please when referring to something in another product, please mention the product. Did not know "toast" (android messaging) until searched for it.

Ratslinger gravatar imageRatslinger ( 2019-10-26 22:18:02 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2019-10-26 22:19:43 +0100

Ratslinger gravatar image

Hello,

You can do this with a simple dialog:

Sub Dialog1Show
    DialogLibraries.LoadLibrary("Standard")
    oDialog1 = CreateUnoDialog( DialogLibraries.Standard.Dialog1 )
    oDialog1.setVisible(true)
    wait 2000
End Sub

Dialog will close after 2 seconds (wait 2000).

edit flag offensive delete link more

Comments

I think, setVisible should set visible dialog, not hide after... why automatic hide it?

mauricio gravatar imagemauricio ( 2019-10-27 17:26:02 +0100 )edit

@mauricio,

This is what temporary popup message ("toast") actually does. It is a short term message which requires no user intervention to close. See How TO - Snackbar / Toast and example you can try there.

Ratslinger gravatar imageRatslinger ( 2019-10-27 17:54:58 +0100 )edit

Yes, I understand the requirement. But, for me, setVisible should show (or hidden) object. Only that.

mauricio gravatar imagemauricio ( 2019-10-27 19:00:01 +0100 )edit

Guess I am not understanding your comments. To stop user intervention, instead of "execute' of Dialog, setVisible displays the dialog and when the timer expires the dialog is destroyed. This is also a process to use in a non-modal dialog (see How to make non-modal dialog?) although for this I prefer to create the entire dialog in a macro and specify it as non modal.

Ratslinger gravatar imageRatslinger ( 2019-10-27 19:15:09 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-10-26 12:06:21 +0100

Seen: 39 times

Last updated: Oct 26