image ResEx Logo
ResExcellence www : Powered by Google
Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets

Articles
   3D
   Audio
   Custom Controls
   General RB
   Graphics
   Hacks
   Mac OS X
   Menus
   Novelty
   Printing
   REALbasic 2005
   REALbasic 2006
   Registration
   Resources
   Reviews
   Serial
   Speech
   Sockets
   XML
   Video
Resource Links
News
   Current News
   February 2006
   January 2006
   December 2005
   November 2005
   October 2005
   September 2005
   August 2005
   July 2005
   June 2005
   May 2005
   April 2005
   March 2005









REALbasic for Dummies
by Erick Tejkowski


Learning REALbasic through Applications
by Clayton E., Crooks II


REALbasic for Macintosh
by Michael Swaine


REALbasic Cross-Platform Application Development
by Mark S. Choate





Older files are in Stuffit 5 or greater format. Newer files are ".Zip". Download StuffIt Expander
Tell us about a bad link. Thank You!

MessageDialog Sheets by Seth Willits
June 25, 2005

Printer Version




Using a New Feature From REALbasic 2005!
In this tutorial, we're going to use a new feature of the MessageDialog class, the ShowModalWithin method, to show the dialog as a sheet within a parent window. This is something that was sorely lacking in REALbasic 5.5. Without this feature, developers (such as myself) had to resort to using declares to implement a standard message alert that could be shown as a sheet.

The MessageDialog class is an important user interface element that if not done correctly, sticks out like a sore thumb on Mac OS X. Users expect a consistent message interface between applications, so it is critical that developers adopt and embrace the MessageDialog class as a part of becoming a good Mac OS X citizen. See the tutorial "Using MessageDialogs" to learn about the other features of this class.



It's a Sheet!
This tutorial isn't exactly the most indepth of them all. In the code below, you simply have a chunk which sets up a MessageDialog in the CancelClose event of a Window and displays it using ShowModalWithin.

Function CancelClose(appQuitting as Boolean) As Boolean
  dim dlog as MessageDialog
  
  // Create Dialog
  dlog = New MessageDialog
  dlog.Message = "Do you want to save the changes you made in the document """ + self.Title + """?"
  dlog.Explanation = "Your changes will be lost if you don't save them."
  dlog.ActionButton.Caption = "&Save..."
  dlog.CancelButton.Caption = "Cancel"
  dlog.AlternateActionButton.Caption = "&Don't Save"
  dlog.ActionButton.Visible = true
  dlog.CancelButton.Visible = true
  dlog.AlternateActionButton.Visible = true
  
  // Show Dialog
  Select Case dlog.ShowModalWithin(self).Caption
  Case "&Save..."
     MsgBox "Pretend this is a save dialog..."
     return false
  Case "&Don't Save"
     return false
  Case "Cancel"
     return true
  end Select
End Function


Finished
The important thing here isn't so much of how to do it, but rather that you now can! Over the next several weeks we'll be exploring features new to REALbasic 2005 like this, some more indepth than others. As always, you can download the project here.




Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets

Maintained by the Staff of ResExcellence. This entire site ©1997-2006 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement. [an error occurred while processing this directive]