[Openmcl-devel] Creating a simple text input dialog

Ron Garret ron at flownet.com
Wed Apr 14 10:37:45 PDT 2021

I’m trying to create a password input dialog.  Tried this:

(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))

but it doesn’t work.  For some reason the ns-text-field is not showing up.  AFAICT this is because I am not initializing it properly.  If I try to just display it in a regular (non-alert) window, it doesn’t show up either.  What am I doing wrong?

I’ve scoured the web looking for some simple example code in ObjC that does this and come up empty.  I would not have thought that this would be that complicated.  For the record, what I’m really trying to do is to create a password input dialog.  Surely I’m not the first person to try to do this.


More information about the Openmcl-devel mailing list