This class will allow you to create customized non-modal message boxes, you can change colors, fonts, add bitmaps to the background, use RichStrings, etc.
Requirements:
- B4A 2.xx
- RichString Lib
- StringUtils Lib
- Add the Class module "CustomMsgBox.bas" to your project
How to use:
Initialize the class like this for example:
Then, create your custom message box:
That's it!!.
All the available methods are self explanatory.
UPDATE: Added parameter to align the message
ShowMessage(BoxMessage As String, Alignment As String)
Updated to Version 1.0.4 on Feb 15, 2013.
The attached sample shows one of the many ways it can be used.
Screen shots:
Requirements:
- B4A 2.xx
- RichString Lib
- StringUtils Lib
- Add the Class module "CustomMsgBox.bas" to your project
How to use:
Initialize the class like this for example:
B4X:
Sub Globals
Dim MyMsgBox As CustomMsgBox
End Sub
Then, create your custom message box:
B4X:
'With Icon
myMsgBox.Initialize(Activity, Me, "Default", "H", 1, 95%x, 200dip, LoadBitmap(File.DirAssets, "WarningIcon.png"))
'Without Icon
myMsgBox.Initialize(Activity, Me, "Default", "H", 1, 95%x, 200dip, Null)
'Then add text to the Title and Body of the custom msgbox
MyMsgBox.Title.Text = "Custom MsgBox v1.0"
MyMsgBox.ShowMessage("Simple box with 1 button, horizontal")
...
'This routine will get the button tapped, in this case "Default"
'is the name of the message box, you can name yours with whatever name you like
Sub Default_Click
Msgbox(myMsgBox.ButtonSelected, "Button Pressed")
End Sub
That's it!!.
All the available methods are self explanatory.
UPDATE: Added parameter to align the message
ShowMessage(BoxMessage As String, Alignment As String)
Updated to Version 1.0.4 on Feb 15, 2013.
The attached sample shows one of the many ways it can be used.
Screen shots:
Attachments
Last edited: