GraphicCaution is deprecated warning

I’ve got an older app that I’m cleaning up. I want to bring it all up to date. I’m getting this warning in the Project Analysis. It’s the first one in a long list. I can’t find anything about it in the docs or on this forum. If anything recent posts here suggest it’s being done this way. Here’s the warning and the line of code. It’s just the standard code copied out of the docs.

How do I update my code to use IconTypes.Caution? I’d be happy to read about it myself. Just can’t find anything.

App.FileAbout, line 3
GraphicCaution is deprecated. You should use IconTypes.Caution instead
d.Icon = MessageDialog.GraphicCaution // display warning icon

Hi Duane,
From the documentation:

Var d As New MessageDialog                  // declare the MessageDialog object
Var b As MessageDialogButton                // for handling the result
d.IconType = MessageDialog.IconTypes.Caution       // display warning icon
d.ActionButton.Caption = "Save"
d.CancelButton.Visible = True               // show the Cancel button
d.AlternateActionButton.Visible = True      // show the "Don't Save" button
d.AlternateActionButton.Caption = "Don't Save"
d.Message = "Do you want to save changes to this document before closing?"
d.Explanation = "If you don't save, your changes will be lost. "

b = d.ShowModal                             // display the dialog
Select Case b                               // determine which button was pressed.
Case d.ActionButton
  // user pressed Save
Case d.AlternateActionButton
  // user pressed Don't Save
Case d.CancelButton
  // user pressed Cancel
End Select

So:

d.IconType = MessageDialog.IconTypes.Caution       // display warning icon
1 Like

Thank you. I don’t know how I missed that?

Happy to help!

2 Likes
Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.