Real Software Forums

Custom MessageDialog
Page 1 of 1

Author:  sinner [ Sat Sep 22, 2012 11:16 am ]
Post subject:  Custom MessageDialog

I wanted to share a simple method to save space in your project by adding a custom message dialog then having to rewrite the whole messagedialog Function for each time u want to use it your application!

Hope you enjoy :P

1. make a global method called MessageDialog in your APP class

Sub MessageDialog(Title As String, Message As String , Explanation As String , GraphicIcon As Integer , ActionCaption As String ="OK" , CancelCaption As String ="Cancel", CancelButton As Boolean)

'0 - GraphicNote (The application icon on Mac OS X)
'1 - GraphicCaution triangle (On Mac OS X, the application icon superimposed on the caution triangle)
'2 - GraphicStop (On Mac OS X 10.3 and above, the application icon)
'3 - GraphicQuestion icon (On Mac OS X 10.3 and above, it is the same as 0)

Dim d as New MessageDialog
Dim b as MessageDialogButton

d.icon= GraphicIcon
d.Title = Title
d.ActionButton.Caption = ActionCaption
d.CancelButton.Caption= CancelCaption
d.CancelButton.Visible = CancelButton


'You can use the return type as a boolean or a string to see what the user pressed
Select Case b
Case d.ActionButton
Speak "You Pressed OK"

Case d.CancelButton
Speak "You Pressed Cancel"
End Select
End Sub

2. Call it anywhere you like in your app
App.MessageDialog(App.ExecutableFile.Name,"Error: Testing Msg....","Msg Tested",1,"","", False)

Author:  Bob Keeney [ Tue Sep 25, 2012 4:52 pm ]
Post subject:  Re: Custom MessageDialog

We use something similar but just make it a global function so there's no need to put the 'app' in front of it.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group