PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | French EN
New WINDEV Mobile 25 feature!
  • 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/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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 (see Developing an application for iPhone/iPad for more details).
  2. Open the description window of the current configuration: on the "Project" pane, 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:
Versions 25 and later
ConfirmAsynchronous
New in version 25
ConfirmAsynchronous
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.
Versions 25 and later
DialogAsynchronous
New in version 25
DialogAsynchronous
DialogAsynchronous
Displays a non-blocking message box and calls a WLanguage procedure with the value of the button clicked by the user.
Versions 25 and later
ErrorAsynchronous
New in version 25
ErrorAsynchronous
ErrorAsynchronous
Displays a custom error message in a non-blocking system error window.
Versions 25 and later
ErrorWithTimeoutAsynchronous
ErrorWithTimeoutAsynchronous
Displays a custom error message in a non-blocking system error window for a given amount of time.
Versions 25 and later
InfoAsynchronous
New in version 25
InfoAsynchronous
InfoAsynchronous
Displays a non-blocking custom message in a system information window.
Versions 25 and later
InfoWithTimeoutAsynchronous
InfoWithTimeoutAsynchronous
Displays a custom message in a non-blocking system information window for a given amount of time.
Versions 25 and later
OKCancelAsynchronous
New in version 25
OKCancelAsynchronous
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.
Versions 25 and later
WarningAsynchronous
New in version 25
WarningAsynchronous
WarningAsynchronous
Displays a custom message in a non-blocking system warning window.
Versions 25 and later
YesNoAsynchronous
New in version 25
YesNoAsynchronous
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.
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 event "Before automatic deletion", 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 event "Before automatic deletion":
// Asks confirmation to the user
IF YesNo("Delete contact?") = Yes THEN
// Delete row
RESULT 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 among 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. See Generating the application for more details on Xcode project generation.
Minimum version required
  • Version 25
Comments
Click [Add] to post a comment