B4J Library jRLDialogsX - Dialogs Library

jRLDialogsX is an open source B4J Dialogs Library providing a comprehensive set of Dialogs.
The library is coded as a B4J Class with Inline Java, no additional libraries or wrappers required.
Note: Requirements minimum B4J v5.80 and Java JDK v8 (8u40+).

Version: 1.88 - Attached the B4J library, source code, full example.

How to Use
  • Copy jrldialogsx.jar, jrldialogsxfiles.jar and xml to the B4J additional library folder.
  • In the B4J project, select jrldialogsx from the B4J IDE Libs tab.
  • See folder Examples - the fullexample is a must read, get started with the InformationDialog.
Version Control
20221122 (v1.88) NEW: Set button CSS style; AlertSelectionDialog (buttons selection); CustomAlert (hightly configurable dialog) (See Post #91)
20190407 (v1.87) NEW: SimpleFormDialog - DatePicker via option "D"; YesNoCancel dialog - if Cancel text is empty, the cancel button is not created;NEW: ListDialog, ListDialog2 - if DefaultItem = -1 then no item selected;UPD: Documentation & Examples; Published on GitHub
20180326 (v1.86) NEW: ListFindDialog Set or get content of textfield FindItem
20180312 (v1.85) NEW: DidYouKnow2 dialog with prev / next tip buttons; ExtendedDialog Show or hide the less details hyperlink button; UPD: ListFindDialog search field across dialog window, moved buttons OK & cancel down; UPD: Documentation & Examples. See Post #73
20171025 (v1.80) NEW: jRLDialogsXFiles.jar holding additional files from the library Files folder. This file must be located in the B4J Additional Libraries folder.; NEW: ListFindDialog with a find item option - first non Inline Java Dialog (requires jRLDialogsXFiles.jar); UPD: Icons (for dialogs DidYouKnow and LoginDialog2) are included in jRLDialogsXFiles.jar; UPD: LoginDialog and Login2Dialog2 with textfield horizontal grow option; UPD: Documentation & Examples. See Post #60
20170906 (v1.77) UPD: SimpleformDialog set request focus on first field; UPD: Minor changes
20170822 (v1.76) NEW: Library renamed from jRLDialogs8 to jRLDialogsX; UPD: Minor changes
20170802 (v1.75) NEW: PDF Documentation
20170711 (v1.74) NEW: SimpleFormDialog ComboBox Field with field value comma separated string, SimpleFormDialog Property ComboBox editable; UPD: Examples. See Post #60
20170703 (v1.72) NEW:ToastMessageAlert Information,Warning,Error; MessageHTMLDialog3 with OK/Cancel, MessageHTML show/hide details button; UPD: Examples. See Post #58
20170626 (v1.68) NEW:MessageDialog set wrap;SimpleFormDialog set inputfield width;MessageHTMLDialog2;Overview;UPD:Examples. See Post #56
20170620 (v1.65) NEW:Localization Show Details Hyperlink Button for Dialogs Extended, Message, MessageHTML; NEW: Extended Dialog option Message & MessageHTML Dialogs;UPD: Examples. See Post #55
20170612 (v1.62) NEW:SliderDialog; NEW:SimpleFormDialog CheckBox Field; NEW: Extended Dialog option show content expanded; NEW: DoNotAskAgainDialog; UPD: Fields padding removed; UPD: Examples. See Post #53.
20170601 (v1.59) NEW:SimpleFormDialog TextArea Field, option to split form fields; FIX: ConfirmDialog; UPD: Examples. See Post #50.
20170531 (v1.58) NEW:ToastMessage set background and border line color; UPD: Examples. See Post #49.
20170530 (v1.57) NEW:ColorNameDialog and ColorPickerDialog to get Color as Paint; NEW:ToastMessage set font size and border width; UPD:Toastmessage using default colors; UPD:Examples. See Post #47.
20170528 (v1.56) NEW:SimpleFormDialog (create n label:field pairs; field=Text or Password or Numeric); MultiInputFieldDialog (create n label:textfield pairs); IntegerInputDialog; Full Example reworked. See Post #46.
20170525 (v1.53) NEW:TimePicker (24h), TimePicker (12h), TextInputDialog4 (with option to set the width of the textfield, no label used); More examples. See Post #44.
20170522 (v1.50) NEW:String localisation Username Label/Prompt, Password Label/Prompt, OK/Cancel Button, YES/NO Button, Login Button, Select Button. See Post #42.
20160801 (v1.47) UPD:Set default selected item for ChoiceDialog, SelectDialog, ListDialog, and ListDialog2; Example 1 converted to B4J Visual Designer.
20160411 (v1.46) UPD:MessageHTMLDialog handles anchors if defined like href="#myanchor" ... name="myanchor" ...
20151011 (v1.45) UPD:Textfield gets initial focus when openeing dialog TextInputDialog, TextInputDialog2, TextInputDialog3, LoginDialog, LoginDialog2, TextAreaDialog
20150910 (v1.40) NEW:SetParentWindow; FIX: ToastMessage center screen
20150828 (v1.30) NEW:ToastMessage
20150604 (v1.20 )NEW:TextAreaDialog
20150617 (v1.11) UPD:TextInputDialog3 added hint for checking null
20150512 (v1.10) NEW:TextInputDialog3
20150406 (v1.00) NEW:SpinnerIntegerDialog, SpinnerDoubleDialog, SpinnerListDialog
20150405 (v0.90) NEW:TextInputDialog2, DatePickerDialog
20150404 (v0.80) NEW:SelectDialog; FIX: ListDialog, ListDialog2 removed expand option
20150403 (v0.70) NEW:ListDialog, ListDialog2
20150402 (v0.60) NEW:LoginDialog2, DidYouKnowDialog, ExceptionDialog, Message, MessageHTMLDialog
20150401 (v0.50) NEW:ExtendedDialog, LoginDialog
20150331 (v0.40) NEW:YesNoCancelDialog
20150330 (v0.10) NEW:First Version

Simple Example Information Dialog with localized OK Button Text
B4X:
Sub Process_Globals
  ..
  'Define the dialog using jrldialogsX
  Private Dlg As DialogsX
End Sub
Sub AppStart (Form1 As Form, Args() As String)
  ...
  'Init the dialog
  Dlg.Initialize
  'Localize (optional)
  Dlg.OKButtonText = "Thank You"
  'Use the dialog to show Information Dialog
  Dlg.InformationDialog("About", "jRLDialogX Information Dialog Example", "Hello World")
End Sub
 

Attachments

  • jRLDialogsX-188.zip
    137.2 KB · Views: 387
Last edited:

Douglas Farias

Expert
Licensed User
Longtime User
only to report too, the ToastMessage is not on the center on the screen, this show on the botton right on my pc
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20150910 - Post #1 lists all the methods.
NEW:Set the Parent Form
B4X:
'Set the parent form for a dialog. This must be called prior calling the dialog.
'Parameter: The form to be used as parent window.
'Example: SetParentWindow(MainForm)
'Notes:
'To reset the parentwindow, call SetParentWindow(Null)
'The parent window can not be set for ToastMessageShow
SetParentWindow(ParentForm As Form)
Example
B4X:
Sub btnInformationDialog_Action
    Dlg.SetParentWindow(MainForm)
    Dlg.InformationDialog("Information Title", "My Header", "My Content")
End Sub

FIX:ToastMessage centered on Screen

Example b4jexample enhanced.

@Suntzu, @Douglas: thanks for feedback and ideas :cool:
 
Last edited:

Suntzu

Member
Licensed User
Longtime User
Hi Robert,

I confirm that the new version works perfectly in a multiple monitor setup. In fact, it works whichever monitor I use.

Thanks a bunch!
 

specci48

Well-Known Member
Licensed User
Longtime User
Hi rwblinn,

here a small addition from my side, perhaps it should find it's way into the great(!) library on the next update.
Opening a TextInputDialog3 without a preset text, the textfield didn't get the initial focus, which I found very annoying.

So I made the following code changes:

B4X:
import javafx.application.Platform;
...
final TextField field1 = new TextField();
Platform.runLater(new Runnable() {
         @Override
         public void run() {
            field1.requestFocus();
        }
});

Maybe this could also work for other dialogs, setting the focus to the preferred view.

specci48
 

TorontoJim

Member
Licensed User
Longtime User
Rob, I'm getting a LOT of use from this library. Two things to add to the wish list:

MessageHTMLDialog:

1.) Include the ability to link to anchors, i.e. <a href="#niftystuff">Jump to nifty stuff</a> and then further down <a name="niftystuff"></a>

2.) The ability to link to an external browser, rather than calling the external link into the dialogue.

I'm not complaining, I love this library!
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20160411 - Post #1 lists all the methods.
UPD:MessageHTMLDialog handles anchors if defined like href="#myanchor" ... name="myanchor" ...
@TorontoJim : Thanks for the enhancement suggestions. Number 1 is implemented, number 2 is on the ToDo list (not found proper way to do so).
 

LWGShane

Well-Known Member
Licensed User
Longtime User
@rwblinn - This is a really amazing library! Thanks for this!
 

Suntzu

Member
Licensed User
Longtime User
Hi Robert,

Is it possible to add the following functionalities:

1. Set a default selected item in the list for ChoiceDialog, SelectDialog, ListDialog, and ListDialog2.
2. Support enter key to select an item from the list (ChoiceDialog, SelectDialog, ListDialog, and ListDialog2). This is to support keyboard keys.
3. Support escape key to exit while the focus is in the list (ChoiceDialog, SelectDialog, ListDialog, and ListDialog2). This is to support keyboard keys.

I hope this is not asking for too much.

Thank you in advance.
 
Last edited:

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20160801 - Post #1 lists all the methods.
UPD:Set default selected item for ChoiceDialog, SelectDialog, ListDialog, and ListDialog2.
@Suntzu: For your post #30 requests 2&3 have not found a solution yet (need to explore). Recommend to use tab and enter keys in the meantime.
 

Philip Prins

Active Member
Licensed User
Longtime User
Hello ,

Sometimes the toastmessage does not appear on the screen, i can see a icon coming in the taskbar and disappearing but not a toast message on the screen.
B4X:
Dlg.Initialize  
Dlg.ToastMessage("Text",5000)

Am i doing something wrong?
Regards
Philip
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

have tested few scenarios using jRLDialogs 1.47, B4J 4.70, Java 1.8.0_112, to verify the issue mentioned in post #33. See below.
Could it be, that the toastmessage is hidden by a form (see Test 3 below)?
Could you share more code info when calling toastmessage, so I can verify further.

B4X:
' Test1 ToastMessage: OK
  MainForm = Form1
  MainForm.RootPane.LoadLayout("Main")
  Dlg.Initialize
  MainForm.Show
  Dlg.ToastMessage("TEST ToastMessage", 5000)

' Test2 ToastMessage: OK
  MainForm = Form1
  MainForm.RootPane.LoadLayout("Main")
  MainForm.Show
  Dlg.Initialize
  Dlg.ToastMessage("TEST ToastMessage", 5000)

' Test3 ToastMessage: The message appears first, but then hidden by the mainform showed in the foreground. To show the toastmessage in the foreground, the mainform layout must be shown prior calling toastmessage.
  Dlg.Initialize
  Dlg.ToastMessage("TEST ToastMessage", 5000)
  MainForm = Form1
  MainForm.RootPane.LoadLayout("Main")
  MainForm.Show
 

Art

Member
Licensed User
Longtime User
Hi and thank you for the library. Is it possible to use TextInputDialog2 to input 3 fields (smtpserver, user name, passw)? Thanks in advance.
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

thanks for your request.
The library does not support a dialog for two text fields and a password field. See below reference what is supported.
Two possible options to solve your request using the library:
a) Create two dialogs: one for the smtpserver using TextInputDialog and the next for username/password using LoginDialog
b) Enhance the library with a method LoginDialog3 which has two text fields and a password field (no icon) - I can do that after B4J v5.50 is released.

Reference
For login, current versions has two methods which return a map holding username and password. Each dialog has two fields from type text and password.
'Show a Login Dialog.
B4X:
LoginDialog(Title As String , Header As String) As Map

'Show a Login Dialog with Icon and default UserName.
B4X:
LoginDialog2(Title As String , Header As String, UserName As String) As Map

B4X:
TextInputDialog2
has two text fields. Not suitable for your request.
 
  • Like
Reactions: Art

Art

Member
Licensed User
Longtime User
Hi,
Thank you for the quick reply. The two dialogs solution (TextInputDialog3 and LoginDialog) worked like a charme. Now I only need to localize 'Username' and 'Password' (translate into Portuguese). Can it be done? Thanks again, Rob.
 
Top