Press on the image to return to the main documentation page.
Dialogs
Written by Andrew Graham
This library contains several modal, that is blocking, dialogs by which the user can enter data. Presently they are an InputDialog for text, a TimeDialog for times, a DateDialog for dates, both a ColorDialog and a ColorPickerDialog for colors, a NumberDialog for numbers,a FileDialog for folders and file names and a CustomDialog.
Android does not provide modal dialogs but a special mechanism to permit this exists in Basic4android. The Android Activity lifetime system makes this support complicated because Activities can be created and destroyed at will by the OS. To avoid stack runaway on the GUI thread when an Activity is destroyed the stack must be unwound to the lowest level. The Basic4android modal mechanism does this by closing any modal dialog being shown and exiting the Sub that called the dialog, and any Sub that called that Sub and so on, in order to return the main thread to the message loop. This means that the application does not necessarily receive a return value from the dialog and has its expected flow of execution interrupted. This will probably most often happen if the device is rotated while a modal dialog is displayed so the Activity is destroyed and rebuilt with a new layout.
Because this may happen unexpectedly applications, depending upon their logical structure, may need code in the Pause and Resume Subs to deal with the fact that modal dialog closure may not always be detected. Setting a process global when a modal dialog is shown and clearing it when it returns with some checking code in the Resume Sub is one way of dealing with this possibility.
The above discussion also applies the Basic4android modal dialogs InputList, InputMultiList, Msgbox and Msgbox2.
This modal dialog allows the user to define a colour by its Red, Green and Blue components. This is an 'Activity Object', it cannot be declared under Sub Process_Globals.
This modal dialog allows the user to define a colour by its Hue, Saturation and Value components. This is an 'Activity Object', it cannot be declared under Sub Process_Globals.
This modal dialog allows the user to select a colour from a palette of colours. The color may be from a standard palette in the dialog or a custom programmed palette. This is an 'Activity Object', it cannot be declared under Sub Process_Globals.
This modal dialog displays a custom set of controls laid out on a Basic4android Panel. The Panel is displayed at an abolute position and size within the dialog. It is recommended to use CustomLayoutDialog instead. This is an 'Activity Object', it cannot be declared under Sub Process_Globals.
This modal dialog displays a custom set of controls laid out on a Basic4android Panel. The Panel will be automatically centred in the displayed dialog. It is recommended to use CustomLayoutDialog instead. This is an 'Activity Object', it cannot be declared under Sub Process_Globals.
A customizable dialog. Note that it is supported by Android 4+ (API 14+). This is an 'Activity Object', it cannot be declared under Sub Process_Globals.
Events:
Ready (DialogPanel As Panel) Result (Result As Int)
This modal dialog allows the collection of user entered data in the form of a date. This is an 'Activity Object', it cannot be declared under Sub Process_Globals.
This modal dialog allows the user to choose a folder and choose or enter a filename. This is an 'Activity Object', it cannot be declared under Sub Process_Globals.
This modal dialog allows the collection of user entered data in the form of text. The default is free text but the input can be restricted to numeric characters only or to signed numbers including a decimal point. This is an 'Activity Object', it cannot be declared under Sub Process_Globals.
This configurable modal dialog allows the user to enter a number. The dialog is configurable to show any number of digits between a minimum of one and a maximum of eight. The display of a decimal point is optional and the character displayed as the decimal indicator is configurable. Note that the number accepted and returned by the dialog is an integer value and so may need scaling appropriately. This is an 'Activity Object', it cannot be declared under Sub Process_Globals.
This modal dialog allows the collection of user entered data in the form of a time. The time may be entered in 12 or 24 hour format as determined by the programmer. This is an 'Activity Object', it cannot be declared under Sub Process_Globals.