B4J Library jRLDialogsX - Dialogs Library

m4.s

Member
Licensed User
Longtime User
Hello Rob,

Really nice B4J library you've so generously developed, and share/support, for us.

I've downloaded, setup and am using the TextInputDialog3() method.

Before attempting to modify and rebuild the library myself, have you considered adding support to specify a larger width for the displayed input/text field? That would, of course, proportionally increase the width of the parent dialog.

As is, the hard-coded width is too small for my own needs (e.g. for the entering and editing of long URLs and local file path locations).
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20170522 - Post #1 lists all the methods.
NEW:Localisation of strings for Username Label/Prompt, Password Label/Prompt, OK/Cancel Button, YES/NO Button Text, Login Button Text, Select Button Text

Example
B4X:
Private Dlg As Dialogs8
Dlg.Initialize
Dlg.OKButtonText = "Thank You"
Dlg.InformationDialog("About", "jRLDialog8 Information Dialog Example", "Find more at www.rwblinn.de.")
 

m4.s

Member
Licensed User
Longtime User
Hi again Rob.

Thanks for latest update, but wondering if you saw my question submitted last Thursday (the post just preceding yours today)?
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20170525 - Post #1 lists all the methods.
NEW:TimePicker (24h), TimePicker (12h), TextInputDialog4 (with option to set the width of the textfield, no label used); More examples.

Example TextInputDialog4 with width set of 600, header instead of label


Example TimePicker24


Example TimePicker12
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20170528 - Full Documentation here.
NEW:SimpleFormDialog (create n label:field pairs; field=Text or Password or Numeric); MultiInputFieldDialog (create n label:textfield pairs); IntegerInputDialog; Full Example reworked.

Example SimpleFormDialog
Text Field (IP Address), Numeric Field (Port), Text Field (Username), Password Field (Password)

B4X:
Sub SimpleFormDialog
   'Create the list of fieldmaps
   Dim fieldlist As List
   fieldlist.Initialize
   Dim m As Map = CreateMap("id":"ipaddress", "label":"IP Address", "value":"192.168.0.99", "type":"T")
   fieldlist.Add(m)
   Dim m As Map = CreateMap("id":"port", "label":"Port", "value":"8080", "type":"N")
   fieldlist.Add(m)
   Dim m As Map = CreateMap("id":"username", "label":"Username", "value":"username", "type":"T")
   fieldlist.Add(m)
   Dim m As Map = CreateMap("id":"password", "label":"Password", "value":"password", "type":"P")
   fieldlist.Add(m)
   'Open the dialog
   Dim resultmap As Map = Dlg.SimpleFormDialog("jRLDialogs8 SimpleFormDialog", "Header", fieldlist)
   'The resultmap holds for each field the pair id:value
   If resultmap.IsInitialized Then
     Dim sb As StringBuilder
     sb.Initialize
     For i = 0 To resultmap.Size - 1
       sb.Append($"${resultmap.GetKeyAt(i)} = ${resultmap.GetValueAt(i)}"$).Append(CRLF)
     Next
     TextArea1.Text = sb.tostring
   Else
     TextArea1.Text = "User Abort"
   End If
End Sub

MultiInputFieldDialog
 
Last edited:

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20170530 - Full Documentation here.
NEW: ColorNameDialog and ColorPickerDialog to get Color as Paint.
NEW: ToastMessage set font size and border width.
UPD: Toastmessage using default colors.
UPD: Examples.

 
Last edited:

atiaust

Active Member
Licensed User
Longtime User
Hi Rob,

Great work as always.

Is it possible to change the ToastMessage background color?

Thanks
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20170531 - Full Documentation here.
NEW:ToastMessage set background and border line color
UPD: Examples.

ToastMessage Examples (see also in folder Examples > ToastMessage)



And another code example not related to the screenshots
B4X:
Dlg.ToastMessageFontSize = 32
Dlg.ToastMessageBorderWidth = 1
Dlg.ToastMessageBackgroundColor = fx.Colors.Yellow
Dlg.ToastMessageBorderColor = fx.Colors.Red
Dlg.ToastMessage("<html><h1><font color='red'><u>Welcome</u></font></h1>to jRLDialogs8</html>", 3000)
 
Last edited:

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20170601 - Full Documentation here.
NEW: SimpleFormDialog TextArea Field, option to split form fields.
FIX: ConfirmDialog.
UPD: Examples.

SimpleFormDialog (SFD)
Further developed SFD with fieldtypes supported: Text, Password, Numeric, TextArea. Created two more examples Send E-Mail and Database Add/Edit.
With few lines of code, simple dialog can be created. Localization is used to set the dialog button text based on the action required.

Example: Send EMail with fields Receipients, Subject, Body


Code Snippet = define the required fields, open the dialog, send the email using SMTP and wait for (requires B4J 5.51).
B4X:
Sub SimpleFormDialog
   Dim smtpEMail As SMTP   'Requires the jNet Library
   Dlg.OKButtonText = "Send"
   Dim fieldlist As List
   fieldlist.Initialize
   fieldlist.Add(CreateMap("id":"receipients", "label":"Receipients:", "value":"robert@rwblinn.de", "type":"T"))
   fieldlist.Add(CreateMap("id":"subject", "label":"Subject:", "value":"SimpleFormDialog Test", "type":"T"))
   fieldlist.Add(CreateMap("id":"body", "label":"Body:", "value":$"Line1${CRLF}Line2"$, "type":"A"))
   Dim resultMap As Map = Dlg.SimpleFormDialog("E-Mail", "Create E-Mail", fieldlist)
   If resultMap.IsInitialized Then
     smtpEMail.Initialize("Server", 25, "Username", "Password", "smtp")
     smtpEMail.UseSSL = False
     Dim receipients() As String = Regex.Split(";", resultMap.Get("receipients"))
     smtpEMail.To.AddAll(receipients)
     smtpEMail.Subject = resultMap.Get("subject")
     smtpEMail.Body = resultMap.Get("body")
     smtpEMail.Send
     Wait For smtp_MessageSent(Success As Boolean)
     If Success Then
       Log($"Message has been successfully sent to ${resultMap.Get("receipients")}."$)
     Else
       Log("Message has not been sent.")
     End If
   End If
End Sub

Example: SQLite Database with CRUD operations

SFD is used to add or edit/update records.
The database has one table contacts: ID INTEGER PRIMARY KEY, Name TEXT, EMail TEXT, Notes TEXT
Code Snippet showing the Edit Database Record Dialog - Note that the DBUtils module is used.
B4X:
Sub EMailForm(ID As Int)
   ' Define the form field values with default values --- without the ID fields (as automatically updated)
   Dim idvalue As String = ""   'ignore
   Dim namevalue As String = "new name"
   Dim emailvalue As String = "new email"
   Dim notesvalue As String = "new content"
   ' Set the OK button text
   If ID = -1 Then
     Dlg.OKButtonText = "Add"
   Else
     Dlg.OKButtonText = "Update"
   End If
   ' Create the list of fieldmaps
   Dim fieldlist As List
   fieldlist.Initialize
   ' Get the record values if ID <> -1 and assign to the values
   Dim fieldMap As Map = DBUtils.ExecuteMap(sqlObj, $"SELECT * FROM ${TableContacts} where ID=?"$, Array As String(ID))
   If fieldMap.IsInitialized Then
     idvalue = fieldMap.Get("id")
     namevalue = fieldMap.Get("name")
     emailvalue = fieldMap.Get("email")
     notesvalue = fieldMap.Get("notes")
   End If
   ' Create the field list with new or updated values
   fieldlist.Add(CreateMap("id":"name", "label":"Name","value":$"${namevalue}"$, "type":"T"))
   fieldlist.Add(CreateMap("id":"email", "label":"E-Mail","value":$"${emailvalue}"$, "type":"T"))
   fieldlist.Add(CreateMap("id":"notes", "label":"Notes","value":$"${notesvalue}"$, "type":"A"))
   '   fieldlist.Add(CreateMap("id":"id", "label":"ID","value":$"${idvalue}"$, "type":"T"))
   'Open the dialog
   Dlg.SimpleFormSplitFields = cbSimpleFormSplitFields.Checked
   Dim resultMap As Map = Dlg.SimpleFormDialog("Contact Form", "Details", fieldlist)
   If resultMap.IsInitialized Then
     If ID = -1 Then
       Dim l As List
       l.Initialize
       l.Add(resultMap)
       Dim rt As String = DBUtils.InsertMaps(sqlObj, TableContacts, l)
       FillTableView
       LOg($"New record inserted. Result: ${rt}"$)
     Else
       Dim wherefieldequals As Map = CreateMap("ID":ID)
       Dim rt As String = DBUtils.UpdateRecord2(sqlObj, TableContacts, resultMap, wherefieldequals)
       FillTableView
       Log($"Record (ID:${ID} updated. Result: ${rt}"$)
     End If
   End If
End Sub

Sub FillTableView
   tvContacts.Items.Clear
   DBUtils.ExecuteTableView(sqlObj, $"SELECT * FROM ${TableContacts}"$, Null, 0, tvContacts)
End Sub
 
Last edited:

m4.s

Member
Licensed User
Longtime User
Hello Rob,

Thank you very much for the TextInputDialog4 enhancement -- it works just as requested!

I also really like your subsequent additions. Re: the SFD one, are you considering new support for a 'FilePicker' fieldtype? In the case of your email example, it would be preferable to allow a user to optionally attach one or more files as part of a sent email.
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Thanks for feedback - appreciated.

Regarding FilePicker fieldtype need to consider if possible - in the meantime, a workaround could be:
Step 1
In the SFD E-Mail, add a new TextField field, i.e.
B4X:
fieldlist.Add(CreateMap("id":"attachment", "label":"Attachment:", "value":$"${attachment}"$, "type":"T"))
Step 2
Open the standard FileChooser Dialog (f.e. via Button Action) to select a file. Assign the dialog result to a String, i.e. attachment.
When the FileChooser Dialog is closed, open the SFD E-Mail.
B4X:
Sub btnSendEMailWithAttachment_Action
   Dim fc As FileChooser
   fc.Initialize
   fc.Title = "Select E-Mail Attachment"
   fc.InitialDirectory = File.DirApp
   Dim attachment As String = fc.ShowOpen(MainForm)
   ...SFD E-Mail Dialog with additional field...
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20170612 - Full Documentation here.
NEW: SliderDialog
NEW: SimpleFormDialog CheckBox Field
NEW: Extended Dialog option show content expanded
NEW: DoNotAskAgainDialog
UPD: Fields padding removed
UPD: Examples.

Screenshots

 

Art

Member
Licensed User
Longtime User
Not (yet) possible. Work in progress to include in the next version which will use B4J v5.50.
Meanwhile, you have done great improvements in your library and my string localisation request was generously fulfilled (thank you again!). However, in 'Message HTML', the 'Show/Hide Details' text link is hardcoded. Can it be excluded ou translated? Thank you, Rob!
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20170620 - Full Documentation here.
NEW: Localization Show Details Hyperlink Button for Dialogs Extended, Message, MessageHTML
NEW: Extended Dialog option Message & MessageHTML Dialogs
UPD: Examples

Example MessageHTMLDialog Localize OK & Show Details Hyperlink Button
B4X:
'Localize
Dlg.OKButtonText = "Close"
Dlg.MessageHTMLDialogShowLessDetailsText = "Show Less..."
Dlg.MessageHTMLDialogShowMoreDetailsText = "Show More..."

'Open HTML message dialog by loading the content from file.
Dlg.MessageHTMLDialogDialogExpanded = True
Dim msg As String = File.ReadString(File.DirApp, "messagehtmldialog.htm")
Dlg.MessageHTMLDialog("jRLDialogs8 Libary MessageHTMLDialog example", msg)
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20170626 - Full Documentation here.
NEW: MessageDialog set wrap
NEW: SimpleFormDialog set inputfield width
NEW: MessageHTMLDialog2
NEW: Overview file created with my B4XLibViewer
UPD: Examples

B4XLibViewer
Reworked my B4XLibViewer ( originally created back 2014 in the B4J early days whilst learning B4J - amaizing how B4J has evolved since = great ) using the latest version of B4J and jRLDialogs8.
Example jRLDialogs8 usage; manage settings: SimpleFormDialog, view library reference details, help: MessageHTMLDialog2, find name: TextInput.
The library reference can be exported to HTML or copied to the clipboard.
Note: parsing XML is not the easiest task - so there might be some hickups in the output.


Example Export HTML Library Overview
 

micro

Well-Known Member
Licensed User
Longtime User
Hi to all and many thanks for your library rwblinn.
Can you extend or how can I have a return of the buttons pressed in a MessageHtmlDialog?
Another small request:
The Toastmessage pane can have round edges?

Best regards
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Can you extend or how can I have a return of the buttons pressed in a MessageHtmlDialog?
Will add a new dialog or an option to add both OK and Cancel Button returning True and False.

Hi to all and many thanks for your library rwblinn.
Another small request: The Toastmessage pane can have round edges?
Not so easy as thought after exploring several ways. Will put on the ToDo list but can not promise if possible .

Thanks a lot for using this library.
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20170703 - Full Documentation here.
NEW: ToastMessageAlert Information,Warning,Error.
NEW: MessageHTMLDialog3 with OK/Cancel buttons.
NEW: MessageHTMLDialog property to show/hide details button.
UPD: Examples.

Example ToastMessageAlert Information, Warning, Error
B4X:
Private Const Duration as Int = 5000 'in ms

Sub btnToastMessageAlertInformation_Action
    'Style the border color, border width, border radius and font size.
    Dlg.ToastMessageAlertStyle(CSSUtils.ColorToHex(fx.Colors.LightGray), 2,2,16)
    Dlg.ToastMessageAlert("information", "ToastMessageAlert Information", "Thank You for using jRLDialogs8", Duration)
End Sub

Sub btnToastMessageAlertWarning_Action
    Dlg.ToastMessageAlertStyle(CSSUtils.ColorToHex(fx.Colors.Yellow), 4,2,20)
    Dlg.ToastMessageAlert("warning", "ToastMessageAlert Warning", "Thank You for using jRLDialogs8", Duration)
End Sub

Sub btnToastMessageAlertError_Action
    Dlg.ToastMessageAlertStyle(CSSUtils.ColorToHex(fx.Colors.Red), 6,2,24)
    Dlg.ToastMessageAlert("error", "ToastMessageAlert Error", "Thank You for using jRLDialogs8", Duration)
End Sub
 

LWGShane

Well-Known Member
Licensed User
Longtime User
@rwblinn - Is it possible to add a ComboBox to the SimpleFormDialog?
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20170711 - Full Documentation here.
NEW: SimpleFormDialog ComboBox Field with field value comma separated string, i.e. "Item 1,Item 2,Item 3".
NEW: SimpleFormDialog Property ComboBox editable.
UPD: Examples.

Example SimpleFormDialog with editable ComboBox

B4X:
'Create the list of fieldmaps
Dim fieldlist As List
fieldlist.Initialize
fieldlist.Add(CreateMap("id":"textfield", "label":"Textfield", "value":"textfield", "type":"T"))
fieldlist.Add(CreateMap("id":"numeric", "label":"Numeric", "value":"1958", "type":"N"))
fieldlist.Add(CreateMap("id":"password", "label":"Password", "value":"password", "type":"P"))
fieldlist.Add(CreateMap("id":"checkbox", "label":"Checkbox", "value":"1", "type":"C"))
fieldlist.Add(CreateMap("id":"combobox", "label":"Combobox", "value":"Item 1,Item 2,Item 3", "type":"B"))
'Open the dialog
Dlg.SimpleFormSplitFields = True
Dlg.SimpleFormComboBoxEditable = True
Dim resultmap As Map = Dlg.SimpleFormDialog("SimpleFormDialog", "Header", fieldlist)
'The resultmap holds for each field the pair id:value
If resultmap.IsInitialized Then
      Dim sb As StringBuilder
      sb.Initialize
      For i = 0 To resultmap.Size - 1
          sb.Append($"${resultmap.GetKeyAt(i)} = ${resultmap.GetValueAt(i)}"$).Append(CRLF)
      Next
      Log(sb.tostring)
Else
      Log("User Abort")
End If
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…