Sometimes you just need to show a quick Msgbox or a single-field Inputbox to the user. In ABMaterial for B4J you have probably, just like me, already made a couple of modal sheets to do this.
But in 2.51 I’ve integrated the possibility for such cases just to do it in one line of code (like a normal msgbox/inputbox).
It replaces the default looking ‘alert’ box from JavaScript to a more modern looking box. The SweetAlert2 library, which is build on the orginal SweetAlert one, has been extended for ABMaterial so you can ‘Theme’ about anything you want.
For example, to show the msgbox you see on top of this article, this is the code you need to write:
page.Msgbox("MSGBOX1", "This is a very simple msgbox", "Msgbox()", "OK", "")
Some more examples:
theme.AddMsgBoxTheme("image") theme.MsgBox("image").ConfirmButtonColor = ABM.COLOR_GREEN theme.MsgBox("image").CancelButtonColor = ABM.COLOR_RED theme.MsgBox("image").SetImage("https://unsplash.it/400/200", 400, 200) theme.MsgBox("image").BackColor = ABM.COLOR_BLUEGREY theme.MsgBox("image").BackColorIntensity = ABM.INTENSITY_LIGHTEN5 page.Msgbox2("MSGBOX3", "This is an msgbox with an image using a {C:#00AA00}theme{/C}!", "Msgbox2() 2", "OK","CANCEL",True, ABM.MSGBOX_TYPE_WARNING, "image")
page.InputBox("INPUTBOX1", "This is an inputbox for text.","OK", "CANCEL", True, ABM.INPUTBOX_TYPE_QUESTION, ABM.INPUTBOX_QUESTIONTYPE_TEXT,"","Type some text...", "", "Please enter something!", "")
page.InputBox("INPUTBOX3", "This is an inputbox for a password.","OK", "CANCEL", True, ABM.INPUTBOX_TYPE_QUESTION, ABM.INPUTBOX_QUESTIONTYPE_PASSWORD,"","Type your password...", "", "Please enter a password", "")
page.InputBox("INPUTBOX6", "This is an inputbox with a radio selection.","OK", "CANCEL", True, ABM.INPUTBOX_TYPE_QUESTION, ABM.INPUTBOX_QUESTIONTYPE_RADIO,"#00ff00", "","{'#ff0000': 'Red','#00ff00': 'Green','#0000ff': 'Blue'}", "You must select a color", "")
page.InputBox("INPUTBOX7", "This is an inputbox with a checkbox.","OK", "CANCEL", True, ABM.INPUTBOX_TYPE_QUESTION, ABM.INPUTBOX_QUESTIONTYPE_CHECKBOX,"", "I agree with the terms and conditions","", "Please agree with the conditions", "")
Events:
Sub page_MsgboxResult(returnName As String, result As String) myToastId = myToastId + 1 page.ShowToast("toast" & myToastId, "toastgreen", returnName & " " & result, 5000) End Sub Sub page_InputboxResult(returnName As String, result As String) myToastId = myToastId + 1 page.ShowToast("toast" & myToastId, "toastred", returnName & " " & result, 5000) End Sub
ABMaterial Mainenance Release 2.51 will be available for the donators in the following days.
Alwaysbusy