If you are in a hurry, or if you don't want to design your own form, you can use the standard PreferencDialog
in combination with FormsBuilder to create a pretty nice form, one form per B4XPage.
https://www.b4x.com/android/forum/t...der-designer-for-b4xpreferencesdialog.104670/
This work was inspired by the recent wish expressed by @José J. Aguilar
https://www.b4x.com/android/forum/t...-into-a-b4xpage-instead-into-a-dialog.145685/
The principle behind this technique is to find ways of hiding the dialog foundation of the preferences CLV,
as well as to have more control over verification of answers.
This tutorial will show you how.
Here is my sample form. The B4XPage class is called ExampleForm, titled "Sample Form". I created example.json with FormsBuilder.
It doesn't look like a standard PreferenceDialog, but it is.
The title and buttons are empty strings. The colors are all set to the color of the form.
How can you Press OK when it isn't shown? How does the PreferenceDialog know it is finished?
When the B4XPage_CloseRequest is fired, I call prefdialog.Dialog.Close.
Before leaving the page, verification of answers takes place and if not valid the PreferenceDialog is shown again.
All of this is seemless. The user is informed of invalid answers, when OK to that message is pressed, a nifty wiggling
of the prompt draws attention to the item. I copied the wiggling sub from the PreferenceDialog source.
If all answers are present and valid, the form closes and the Example_Closed sub is called in the calling program.
This Sub can access the data and decide on further actions.
In the sample form I choose to leave the navigation to B4XPages, but you can remove the title panel and add your own buttons.
Search the Forum for information how to do that.
There are some bells and whistles that show how to make specific validity tests.
These tests are done inside the form module, keeping most of the logic in one module.
I have implemented a Maximum Tries parameter. Otherwise the user could not leave an invalid form (at least in B4J without using Task Manager).
You can unzip the B4XPages project and run it. It works in B4J and B4A (set for landscape or set for portrait).
Take a close look at the ExampleForm module. It has some features you may like to use in other situations.
in combination with FormsBuilder to create a pretty nice form, one form per B4XPage.
https://www.b4x.com/android/forum/t...der-designer-for-b4xpreferencesdialog.104670/
This work was inspired by the recent wish expressed by @José J. Aguilar
https://www.b4x.com/android/forum/t...-into-a-b4xpage-instead-into-a-dialog.145685/
The principle behind this technique is to find ways of hiding the dialog foundation of the preferences CLV,
as well as to have more control over verification of answers.
This tutorial will show you how.
Here is my sample form. The B4XPage class is called ExampleForm, titled "Sample Form". I created example.json with FormsBuilder.
It doesn't look like a standard PreferenceDialog, but it is.
The title and buttons are empty strings. The colors are all set to the color of the form.
How can you Press OK when it isn't shown? How does the PreferenceDialog know it is finished?
When the B4XPage_CloseRequest is fired, I call prefdialog.Dialog.Close.
Before leaving the page, verification of answers takes place and if not valid the PreferenceDialog is shown again.
All of this is seemless. The user is informed of invalid answers, when OK to that message is pressed, a nifty wiggling
of the prompt draws attention to the item. I copied the wiggling sub from the PreferenceDialog source.
If all answers are present and valid, the form closes and the Example_Closed sub is called in the calling program.
This Sub can access the data and decide on further actions.
In the sample form I choose to leave the navigation to B4XPages, but you can remove the title panel and add your own buttons.
Search the Forum for information how to do that.
There are some bells and whistles that show how to make specific validity tests.
These tests are done inside the form module, keeping most of the logic in one module.
I have implemented a Maximum Tries parameter. Otherwise the user could not leave an invalid form (at least in B4J without using Task Manager).
You can unzip the B4XPages project and run it. It works in B4J and B4A (set for landscape or set for portrait).
Take a close look at the ExampleForm module. It has some features you may like to use in other situations.
Attachments
Last edited: