ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing for iOS (iPhone / iPad)
  • 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
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
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:
  1. Create a project for iOS (for more details, see Developing an application for iPhone/iPad).
  2. Open the description window of the current configuration: on the "Project" tab, in the "Project configuration" group, click "Current configuration".
  3. In the "General" tab, check "Allow the application to run on macOS Catalina or later (Mac Catalyst)".
  4. 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:
ConfirmAsynchronousDisplays 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.
DialogAsynchronousDisplays a non-blocking message box and calls a WLanguage procedure with the value of the button clicked by the user.
ErrorAsynchronousDisplays a custom error message in a non-blocking system error window.
ErrorWithTimeoutAsynchronousDisplays a custom error message in a non-blocking system error window for a given amount of time.
InfoAsynchronousDisplays a non-blocking custom message in a system information window.
InfoWithTimeoutAsynchronousDisplays a custom message in a non-blocking system information window for a given amount of time.
OKCancelAsynchronousDisplays 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.
WarningAsynchronousDisplays a custom message in a non-blocking system warning window.
YesNoAsynchronousDisplays 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.
For example, ErrorAsynchronous and InfoAsynchronous expect two parameters:
  • 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:
  1. Go to the "Details" tab in the control description window.
  2. For "Row swipe", select "Automatic deletion".
  3. 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:
  1. Click in the quick access buttons.
  2. Choose (if necessary) the first window displayed on the different platforms (iPhone, iPad and Apple Watch.
  3. The generation wizard starts. For more details on Xcode project generation, see Generating the application.
Minimum version required
  • Version 25
Comments
Click [Add] to post a comment

Last update: 06/08/2023

Send a report | Local help