From: Tay R. C. <rc...@us...> - 2005-07-17 00:52:23
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12218/actionstep/org/actionstep/test Modified Files: ASTestSheet.as Log Message: Allows user to control message Index: ASTestSheet.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestSheet.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ASTestSheet.as 16 Jul 2005 02:53:06 -0000 1.4 --- ASTestSheet.as 17 Jul 2005 00:52:14 -0000 1.5 *************** *** 41,45 **** begin:NSButton, end:NSButton, textField:NSTextField, textField2:NSTextField, ! nc:NSNotificationCenter public static function test() { --- 41,47 ---- begin:NSButton, end:NSButton, textField:NSTextField, textField2:NSTextField, ! nc:NSNotificationCenter, ! msg:String, ! alert:NSAlert public static function test() { *************** *** 80,104 **** end.setAction("stop"); ! main.setContentView(view1); ! other.setContentView(view2); app.run(); } - static var alert:NSAlert; - //modified code from: //http://developer.apple.com/documentation/Cocoa/Conceptual/Sheets/Tasks/UsingAlertSheets.html#//apple_ref/doc/uid/20001045 public static function trigger(button) { TRACE("Starting sheet..."); alert = (new NSAlert()).init(); alert.addButtonWithTitle("OK"); alert.addButtonWithTitle("Cancel"); alert.addButtonWithTitle("Don't Save"); ! alert.setMessageText("Delete the record?"); alert.setInformativeText("Deleted records cannot be restored."); alert.setAlertStyle(NSAlertStyle.NSWarning) - main.resignKeyWindow(); - alert.beginSheetModalForWindowModalDelegateDidEndSelectorContextInfo (main, self, "alertDidEndReturnCodeContextInfo", null); --- 82,111 ---- end.setAction("stop"); ! main.setContentView(view1); other.setContentView(view2); ! ! msg = "Delete the record?"; ! textField.setStringValue(msg); ! main.makeMainWindow(); app.run(); } //modified code from: //http://developer.apple.com/documentation/Cocoa/Conceptual/Sheets/Tasks/UsingAlertSheets.html#//apple_ref/doc/uid/20001045 public static function trigger(button) { TRACE("Starting sheet..."); + var str = textField.stringValue(); + if(str==null || str=="") { + str = msg; + textField.setStringValue(msg); + textField.drawCell(textField.cell()); + } alert = (new NSAlert()).init(); alert.addButtonWithTitle("OK"); alert.addButtonWithTitle("Cancel"); alert.addButtonWithTitle("Don't Save"); ! alert.setMessageText(str); alert.setInformativeText("Deleted records cannot be restored."); alert.setAlertStyle(NSAlertStyle.NSWarning) alert.beginSheetModalForWindowModalDelegateDidEndSelectorContextInfo (main, self, "alertDidEndReturnCodeContextInfo", null); |