Skip to content

Cross platform alert dialog for Xojo using NSAlert from Einhugur macOS Bridge on macOS systems.

License

Notifications You must be signed in to change notification settings

einhugur/X-Platform-Alert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

X-Platform-Alert

Cross platform alert dialog for Xojo using NSAlert from Einhugur macOS Bridge Plugin on macOS systems.

On Windows built in Xojo MessageDialog is used whenever the used features allow, and when more complex features are used then more advanced custom dialog is used.

Linux systems use GtkMessageDialog from Einhugur Linux Bridge Plugin.

The Einhugur MacOS Bridge Plugin and Einhugur Linux Bridge Plugin can be obtained from: https://www.einhugur.com

For Windows then Xojo MessageDialog is used when feature set does not require more, else custom Alert is used.

GitHub Logo

For macOS native NSAlert is used.

GitHub Logo

For Linux native GtkMessageDialog is used

GitHub Logo

Example usage:

var alert as XPlatformAlert.Alert = new XPlatformAlert.Alert()

alert.Message = "Do you want to save changes to this document before closing?"
alert.Explanation = "If you don't save, your changes will be lost. "

alert.IconType = MessageDialog.IconTypes.Caution 

alert.ShowsSuppressionButton = true

alert.ActionButtonTitle = "Save"
alert.CancelButtonTitle = "Cancel"
alert.AlternateButton1Title = "Do not save"
alert.AlternateButton1IsDestructive = true // This will make macOS Big Sur system flag the button with red.

var dialogResult as XPlatformAlert.AlertResult = alert.ShowModal()

select case dialogResult
  
case XPlatformAlert.AlertResult.Cancel
  // Cancel
  return
  
case XPlatformAlert.AlertResult.Action
  // Action - Save in this case
  
  
case XPlatformAlert.AlertResult.AlternateAction1
  // Alternate action
  
end select

// Check result of the suppression button
var suppress as Boolean = alert.SuppressionButtonValue

About

Cross platform alert dialog for Xojo using NSAlert from Einhugur macOS Bridge on macOS systems.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages