[Openmcl-devel] Creating a simple text input dialog

Shannon Spires svs at bearlanding.com
Wed Apr 14 10:56:27 PDT 2021


This works for me.
-SS

(gui::execute-in-gui
  (lambda ()
    (let ((alert (make-instance 'ns:ns-alert))
          #+IGNORE (input (make-instance 'ns:ns-text-field
                   :frame (ns:make-ns-rect 0 0 300 24)
                   :string (ccl::%make-nsstring "foo")))
          (input (cg:with-rects ((text-field-frame 0 0 300 24))
                   (#/initWithFrame: (#/alloc ns:ns-secure-text-field)
                                          text-field-frame)))
          )
      (#/setMessageText: alert (ccl::%make-nsstring "Alert!"))
      (#/setInformativeText: alert (ccl::%make-nsstring "info"))
      (#/addButtonWithTitle: alert (ccl::%make-nsstring "OK"))
      (#/addButtonWithTitle: alert (ccl::%make-nsstring "Cancel"))
      (#/setAccessoryView: alert input)
      (#/runModal alert))))

On 4/14/21 11:37 AM, Ron Garret wrote:
> (let ((alert (make-instance 'ns:ns-alert))
>        (input (make-instance 'ns:ns-text-field
>                 :frame (ns:make-ns-rect 0 0 300 24)
>                 :string (ccl::%make-nsstring  "foo"))))
>    (#/setMessageText: alert (ccl::%make-nsstring  "Alert!"))
>    (#/setInformativeText: alert (ccl::%make-nsstring  "info"))
>    (#/addButtonWithTitle: alert (ccl::%make-nsstring  "OK"))
>    (#/addButtonWithTitle: alert (ccl::%make-nsstring  "Cancel"))
>    (#/setAccessoryView: alert input)
>    (#/runModal alert))




More information about the Openmcl-devel mailing list