<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>We have a need to show some NSAlerts at the start of running a CCL-based app on Mac/PC using Cocoa/Cocotron. So far we have not found any permutation that works of *restore-lisp-functions* and  :toplevel-function (initarg to build-application) on PCs or Macs.</div><div><br></div><div>The code below will not run the login function but not bring up the modal NSAlert on a Mac and crash on a PC. A variation using (ccl::build-application  :name "Crasher" :toplevel-function 'login)</div><div> does even worse. I am not completely surprised and assume that its just too early in the game of the Cocoa app launch. The main thread may not be running or just not be ready. We did try to call our function from #/applicationDidFinishLaunching which is called but that does not work either.</div><div><br></div><div>Is there or how would one create a *Cocoa-Startup-Functions* capable to run modal NSAlerts on CCL Mac and PC?</div><div><br></div><div>Any suggestions would be appreciated. </div><div><br></div><div>Alex</div><div><br></div><div><br></div><div>_____________</div><div><br></div><div><div>(in-package :ccl)</div><div><br></div><div><br></div><div>(defun NATIVE-STRING (String) "</div><div>  Return a native string"</div><div>  (#/autorelease (ccl::%make-nsstring String)))</div><div><br></div><div><br></div><div>(defmethod STANDARD-ALERT-DIALOG ((Message string) &key </div><div>                                  (Yes-Text "OK")</div><div>                                  (No-Text nil)</div><div>                                  (Cancel-Text nil)</div><div>                                  (Explanation-Text)</div><div>                                  (Is-Critical nil))</div><div>  (let ((Alert (#/init (#/alloc ns:ns-alert))))</div><div>    (#/setMessageText: Alert (native-string Message))</div><div>    (when Yes-Text (#/addButtonWithTitle: Alert (native-string Yes-Text)))</div><div>    (when No-Text (#/addButtonWithTitle: Alert (native-string No-Text)))</div><div>    (when Cancel-Text (#/addButtonWithTitle: Alert (native-string Cancel-Text)))</div><div>    (when Explanation-Text (#/setInformativeText: Alert (native-string Explanation-Text)))</div><div>    (#/setAlertStyle: Alert (if Is-Critical #$NSCriticalAlertStyle #$NSWarningAlertStyle))</div><div>    (case (#/runModal Alert)</div><div>      (#.#$NSAlertFirstButtonReturn t)</div><div>      (#.#$NSAlertSecondButtonReturn nil)</div><div>      (#.#$NSAlertThirdButtonReturn (throw :cancel nil)))))</div><div><br></div><div><br></div><div>(defvar *Evidence-of-Login-Execution* nil)</div><div><br></div><div>(defun LOGIN ()</div><div>  (setq *Evidence-of-Login-Execution* t)</div><div>  (standard-alert-dialog "Too good to be true?"))</div><div><br></div><div><br></div><div>(pushnew 'login ccl::*restore-lisp-functions*)</div><div><br></div><div>(require :build-application)</div><div><br></div><div>(ccl::build-application  :name "Crasher")</div><div><br></div></div><div>______________________</div><div><br></div><div><br></div><br><div>
<span class="Apple-style-span" style="font-size: 12px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Prof. Alexander Repenning</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><br class="khtml-block-placeholder"></p><p style="margin: 0.0px 0.0px 0.0px 0.0px">University of Colorado</p><p style="margin: 0.0px 0.0px 0.0px 0.0px">Computer Science Department</p><p style="margin: 0.0px 0.0px 0.0px 0.0px">Boulder, CO 80309-430</p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><br class="khtml-block-placeholder"></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">vCard: <a href="http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf">http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf</a></font></p><br class="Apple-interchange-newline"></span></span></span>
</div>
<br></body></html>