请先登录 | 注册 |
MM0759.COM |
■标题:015 msgboxasync跳出提示框,点OK |
■作者:IPSC [2025/3/25 17:54:19] Sub Class_Globals Private Root As B4XView Private xui As XUI End Sub Private Sub Button1_Click xui.MsgboxAsync("Hello world!", "B4X") End Sub 创建一个全新的B4XPAGE项目,默认带的,用过时的msgbox("123","标题321")也是可以的 MsgboxAsync (Message As CharSequence,Title As CharSequence) As Object Shows a non-modal Msgbox. Returns an object that can be used as the sender filter parameter for the optional Msgbox_Result event. Example: (copy)xui.MsgboxAsync("Hello", "World") -------------------------------------- 下面是有【确定】【取消】按钮的提示框,还可带图片 Msgbox2Async (Message As CharSequence, Title As CharSequence, Positive As String, Cancel As String, Negative As String,Icon As Bitmap) As Object Shows a non-modal Msgbox. Returns an object that can be used as the sender filter parameter for the Msgbox_Result event. Message - Dialog message. Title - Dialog title. Positive - Positive button text. Pass an empty string to remove button. Cancel - Cancel button text. Pass an empty string to remove button. Negative - Negative button text. Pass an empty string to remove button. Icon - Dialog icon. Pass Null to remove. Does nothing in B4i. ' 按钮点击事件:触发对话框 ' 蛋出异步对话框(只显示"确定"和"取消"按钮,中性按钮"稍后"可留空) xui.Msgbox2Async("确定要删除此文件吗?", "标题", "确定", "取消", "稍后", Null) ' 等待用户点击按钮(异步等待) Wait For Msgbox_Result (Result As Int) ' 根据用户选择处理逻辑 If Result = xui.DialogResponse_Positive Then Log("用户点击了【确定】") Else If Result = xui.DialogResponse_Cancel Then Log("用户【取消】了操作") ' 用户点击了"取消"或点击外部关闭 else If Result = xui.DialogResponse_Negative Then Log("用户点击了【稍后】") End If 显示非模式Msgbox。 返回可以用作Msgbox\u结果事件的发送方筛选器参数的对象。 消息-对话框消息。 标题-对话框标题。 正极-正极按钮文本。传递一个空字符串以删除按钮。 取消-取消按钮文本。传递一个空字符串以删除按钮。 负-负按钮文本。传递一个空字符串以删除按钮。 图标-对话框图标。传递Null以删除。在B4i中不执行任何操作。 xui.Msgbox2Async("是否执行?","请选择下面的操作","确定","取消","不选",Null) xui.Msgbox2Async( Message As String, ' 对话框内容 Title As String, ' 标题(可空) PositiveText As String, ' 肯定按钮文本(如"确定") NegativeText As String, ' 否定按钮文本(如"取消") NeutralText As String, ' 中性按钮文本(如"忽略") Icon As Object, ' 图标(可设为Null) ) 与同步对话框的区别: ' 使用内置图标(需引用XUI库) Dim icon As Bitmap = xui.LoadBitmapResize(File.DirAssets, "warning.png", 48dip, 48dip, True) xui.Msgbox2Async("确定删除此文件?", "井告", "删除", "取消", "", icon) 【回复/版区/上篇/下篇/发贴/仅文字/HTML】 |
【倒序/最近21条回复】(暂无) |
(查看完整版网页) |
短讯|首页|登录|算法|电脑版 . DK MiniBBS Plus v2.0 mm0759.com 31 毫秒 . |