B4J Programming Press on the image to return to the main documentation page.

jMsgboxes

Written by Andrew Graham

This library contains a Msgboxes object that provides various flavours of modal Msgbox.

This library uses the jfxtras-labs-2.2-r5.jar library from
JFXtras Labs.
This is the direct link to jfxtras-labs-2.2-r5.jar

JFXtras and JFXtras Labs are licensed under the New BSD License.
Copyright (c) 2013, JFXtras
All rights reserved.

This library is therefore also licensed under the New BSD License.

List of types:

DialogResponses
Msgboxes

DialogResponses

The same dialog response values as Basic4android are implmemented. POSITIVE, CANCEL and NEGATIVE
You will need to Dim a single Global of this type then you use it just like it was a keyword

Dim DialogResponse As DialogResponses

There are six additional button types/response values available for use with the Show3 method.
ABORT, IGNORE, RETRY, CUSTOM1, CUSTOM2, and CUSTOM3

Events:

None

Members:


  ABORT As Int

  AsString (dialogresponse As Int) As String

  CANCEL As Int

  CUSTOM1 As Int

  CUSTOM2 As Int

  CUSTOM3 As Int

  IGNORE As Int

  NEGATIVE As Int

  POSITIVE As Int

  RETRY As Int

Members description:

ABORT As Int
AsString (dialogresponse As Int) As String
Return a string corresponding to the dialog response value provided or "UNKNOWN" if not one of the three allowed values.
CANCEL As Int
CUSTOM1 As Int
CUSTOM2 As Int
CUSTOM3 As Int
IGNORE As Int
NEGATIVE As Int
POSITIVE As Int
RETRY As Int

Msgboxes

This object provides various flavours of modal Msgbox.
A message box almost syntax compatible with the B4A Msgbox keyword may be shown by

Dim Msgbox As Msgboxes
...
Msgbox.Show("Message", "Title")
*

A message box almost syntax compatible with the B4A Msgbox2 keyword may be shown by

Dim Msgbox As Msgboxes
...
Msgbox.Show2("Message", "Title", "Positive", "Cancel", "Negative")
*

Note that the Basic4android Show2 Icon parameter is not present here

A Msgbox with a customised set of buttons can be shown using Show3.

Events:

None

Members:


  ButtonAlignment As String

  DefaultButton As Int

  DialogType As String

  SetXY (X As Int, Y As Int)

  Show (message As String, title As String)

  Show2 (message As String, title As String, positive As String, cancel As String, negative As String) As Int

  Show3 (message As String, title As String, btnlabels() As String, btntypes() As Int) As Int

  Version As Double [read only]

Members description:

ButtonAlignment As String
Gets or sets the alignment of the buttons in the Msgbox
Permissible values are "LEFT", "RIGHT", or "CENTER"
The library default is "CENTER"
DefaultButton As Int
Gets or set a DialogResponses value that determines the type of the default button in the Msgbox.
The library default is DialogResponses.NEGATIVE.
DialogType As String
Gets or sets the type of the Msgbox to be shown
Permissible values are "ACCEPT", "ERROR", "INFO" or "QUESTION".
The library default is "INFO"
SetXY (X As Int, Y As Int)
By default the Msgbox is shown centred on the screen.
If the values of both X and Y are >= 0 then the Msgbox will be positioned at that X, Y position.
The positioning does seem to be off by about -3 pixels in both X and Y but that may depend on system settings for the windows border.
Show (message As String, title As String)
Show2 (message As String, title As String, positive As String, cancel As String, negative As String) As Int
Shows a modal message box with the specified message and title.
Message - The dialog message.
Title - The dialog title.
Positive - The text to show for the "positive" button. Pass "" if you don't want to show the button.
Cancel - The text to show for the "cancel" button. Pass "" if you don't want to show the button.
Negative - The text to show for the "negative" button. Pass "" if you don't want to show the button.

Returns one of the DialogResponse values corresponding to the type of the button pressed.
Show3 (message As String, title As String, btnlabels() As String, btntypes() As Int) As Int
Shows a modal message box with the specified message and title and an arbitrary number and type of buttons.
Message - The dialog message.
Title - The dialog title.
btnlabels - The text to show for each button in the array
btntypes - The type for each button in the array as a dialog response value. This determines the DialogResponse returned for that button.

Returns one of the DialogResponse values corresponding to the type of the button pressed.
Version As Double [read only]
Returns the version number of the library.
Top