Artifact Content

Artifact 927ab106b749aa5e291497cb0388a1218608268c:

macsheet - Custom, Mac-native "sheet" windows


package require macsheet

macsheet::sheet parent? sheet?

macsheet::closesheet sheet?


This package implements Mac-native "sheet" windows for Tk. "Sheet" windows are dialogs or toplevel windows that slide down from the top of a Mac toplevel window, and then slide back up when they are dismissed. Tk on the Mac has long supported the "sheet" effect for system dialogs, such as tk_messageBox, when a "-parent" option is passed to the call. The macsheet package adds the ability to create customized dialogs or windows with a similar effect. 


Some experimenting with window layout may be necessary to achieve a visually pleasing appearance with a sheet. Also, because of some differences in how the Mac/Cocoa frameworks implement the sheet animation and how Tk manages window geometry, the "sliding down" effect is not perfectly achieved; the "sliding up" effect works fine. 


  package require macsheet
  button .b -text "Run Sheet" -command sheetf
  pack .b

  proc sheetf {} {

   toplevel .f 

    label .f.l -bg red -text "Sheet"
    pack .f.l -fill both -expand yes
    button .f.b -text "Close Sheet" -command [list macsheet::closesheet .f]
    pack .f.b -fill both -expand yes

    macsheet::sheet . .f


sheet, Mac, Cocoa