|
|
|
|
|
- Overview
- Creating a project for Catalyst with WINDEV Mobile
- Developing an application for Catalyst with WINDEV Mobile
- Specific functions for asynchronous mode
- Example of simple code adaptation in asynchronous mode
- Example of complex code adaptation in asynchronous mode
MacOS - Developing an application in Catalyst mode
Apple has recently released an SDK to natively compile iOS applications for MacOS. Naturally, WINDEV Mobile has evolved to let you take advantage of these new features. A Catalyst application is developed in several steps: This help page only presents the creation of a MacOS project and its development. It is generated and compiled in the same way as a standard iOS application. Creating a project for Catalyst with WINDEV Mobile To create a project that can be compiled for MacOS with WINDEV Mobile: - Create a project for iOS (for more details, see Developing an application for iPhone/iPad).
- Open the description window of the current configuration: on the "Project" tab, in the "Project configuration" group, click "Current configuration".
- In the "General" tab, check "Allow the application to run on macOS Catalina or later (Mac Catalyst)".
- Validate.
Developing an application for Catalyst with WINDEV Mobile The development of an application that can be compiled for MacOs is similar to the development of a classic application. However, new constraints appear. The main added constraint is the absence of the synchronous mode. Indeed, the application does not have permissions to block the user interface: - no long processes in the main thread,
- no information or error boxes,
- ...
Specific functions for asynchronous mode WLanguage offers specific functions to show information to the user:
| | ConfirmAsynchronous | Displays a non-blocking message in a standard dialog box with the answers "Yes", "No", "Cancel" and calls a WLanguage procedure with the user's response. | DialogAsynchronous | Displays a non-blocking message box and calls a WLanguage procedure with the value of the button clicked by the user. | ErrorAsynchronous | Displays a custom error message in a non-blocking system error window. | ErrorWithTimeoutAsynchronous | Displays a custom error message in a non-blocking system error window for a given amount of time. | InfoAsynchronous | Displays a non-blocking custom message in a system information window. | InfoWithTimeoutAsynchronous | Displays a custom message in a non-blocking system information window for a given amount of time. | OKCancelAsynchronous | Displays a message in a standard non-blocking dialog box with the answers "OK" and "Cancel" and calls a WLanguage procedure with the user's response. | WarningAsynchronous | Displays a custom message in a non-blocking system warning window. | YesNoAsynchronous | Displays a message in a standard non-blocking dialog box with the answers "Yes" and "No" and calls a WLanguage procedure with the user's response. |
As their name implies, these functions are asynchronous: they do not block the code. The code after these functions is therefore run directly, even if the user has not validated the information box. This means it is necessary to adapt the code to get a consistent behavior. - the text to display (unlike with Error and Info, this text must be one single string),
- a procedure that will be called when the user validates the message.
Example of simple code adaptation in asynchronous mode To understand how to adapt the code in asynchronous mode, let's look at a simple input verification: // Checks the name IF EDT_Name ~= "" THEN // Displays a message to the user Error("You must enter a name") // Force input in the control SetFocus(EDT_Name) // Stop the code RETURN END
In asynchronous mode, this code will have to be adapted as follows: // Checks the name IF EDT_Name ~= "" THEN // Displays a message to the user // The cbErrorName procedure will be run when the error is validated ErrorAsynchronous("You must enter a name", cbErrorName) // Stop the code RETURN END Â INTERNAL PROCEDURE cbErrorName() // Set focus on the control SetFocus(sControlName) END
Remark: for a more concise code, you can use lambda procedures instead of internal procedures. // Checks the name IF EDT_Name ~= "" THEN // Displays a message to the user // SetFocus will be run when the error is validated ErrorAsynchronous("You must enter a name.", () => { SetFocus(EDT_Name) } ) // Stop the code RETURN END
Example of complex code adaptation in asynchronous mode In an Looper control, you can set the deletion gesture to be automatically managed: - Go to the "Details" tab in the control description window.
- For "Row swipe", select "Automatic deletion".
- Validate. The following events are automatically associated with the control: "Before automatic deletion", "After automatic deletion", "Swipe a row".
In the "Before automatic deletion" event, you can cancel the deletion of the row, for example after requesting confirmation. Simply use the "RETURN False" statement to cancel the event. The following is an example of code in the "Before automatic deletion" event: // Asks confirmation to the user IF YesNo("Delete contact?") = Yes THEN // Deletes the row RETURN True END Â // Cancel deletion RESULT False
In asynchronous mode, this code will of course have to be adapted, using the corresponding asynchronous WLanguage function. Since the confirmation is non-blocking, the trick here consists of cancelling the deletion by default. The deletion is actually done when the user responds to the proposed dialog. // Asks confirmation to the user YesNoAsynchronous ("Delete contact?", _cbDeletion) // Cancel deletion: // the deletion will only be done if the user selects "Yes" RESULT False  INTERNAL PROCEDURE _cbDeletion(nResponse) // If the user selects "Yes" IF nResponse = Yes THEN // Delete the desired row LooperDelete(LOOP_Contacts)  END END When the application for MacOS is developed, simply generate the application for iOS and, as for iOS applications, switch to a Mac to compile the Xcode project: - Click
in the quick access buttons. - Choose (if necessary) the first window displayed on the different platforms (iPhone, iPad and Apple Watch.
- The generation wizard starts. For more details on Xcode project generation, see Generating the application.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|