Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Apr 26, 2017 4:52 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Custom MessageDialog
PostPosted: Sat Sep 22, 2012 11:16 am 
Offline
User avatar

Joined: Sat May 27, 2006 3:27 pm
Posts: 480
Hello
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

d.Message=Message
d.Explanation=Explanation
b=d.ShowModal

'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)


Top
 Profile  
 
 Post subject: Re: Custom MessageDialog
PostPosted: Tue Sep 25, 2012 4:52 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
We use something similar but just make it a global function so there's no need to put the 'app' in front of it.

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group