[Openmcl-devel] Creating a simple text input dialog
Laughing Water
lw at mt.net
Wed Apr 14 13:11:19 PDT 2021
Thanks for the offer, Ron, and I’ll post this to the list.
I’m an old MCL owner, if never a serious user, and I made some good use of a LispWorks Professional license for years until I couldn’t see renewing at $750 per year just to keep up with Mac’s shift to 64-bit.
So at the moment I’m considering Racket or the SBCL Portacle package (both M1-compatible), among others, although most of what I do for my natural food store business is in FileMaker. But I think of CCL as a sentimental favorite and a tool especially amenable to Mac OS.
Best wishes,
LW
> On Apr 14, 2021, at 1:54 PM, Ron Garret <ron at flownet.com> wrote:
>
>
> I appreciate the feedback. I actually have a lot of gui demo code that I’m happy to share if you’re interested.
>
> But unfortunately, it does not look as if CCL will be running on Apple silicon any time soon AFAIK.
>
> Also, I think you should re-post this to the list. openmcl-devel is very low volume and any feedback from a potential user is valuable.
>
> On Apr 14, 2021, at 12:31 PM, Laughing Water <lw at mt.net> wrote:
>
>> Hi, Ron,
>>
>> Off-list to avoid clutter, I want you to know that, as a lurker considering different Lisps on Mac, I appreciate seeing what it’s like to use CCL for anything GUI-related on Mac OS, especially if CCL will soon run on Apple silicon.
>>
>> So keep up the good work, and I look forward to anything you share!
>>
>> LW
>>
>>> On Apr 14, 2021, at 11:51 AM, Ron Garret <ron at flownet.com> wrote:
>>>
>>> Turns out the problem was a missing call to #/initWithFrame: on the input ns-text-field.
>>>
>>> Figures that after literally an hour of beating on this I would figure it out five minutes after asking for help.
>>>
>>> Sorry to clutter up your inboxes.
>>>
>>> On Apr 14, 2021, at 10:45 AM, Ron Garret <ron at flownet.com> wrote:
>>>
>>>> Never mind, I figured it out. (Well, actually I found some old code that does what I need.)
>>>>
>>>> (defun passwd-dialog (&optional (prompt "Enter password:"))
>>>> (let ((alert (make-instance 'ns:ns-alert)))
>>>> (#/setMessageText: alert (ccl::%make-nsstring prompt))
>>>> (#/addButtonWithTitle: alert (ccl::%make-nsstring "OK"))
>>>> (#/addButtonWithTitle: alert (ccl::%make-nsstring "Cancel"))
>>>> (bb input (make-instance 'ns:ns-secure-text-field)
>>>> (#/initWithFrame: input (ns:make-ns-rect 0 0 200 24))
>>>> (#/setAccessoryView: alert input)
>>>> (#/autorelease input)
>>>> (if (eql (#/runModal alert) #$NSAlertFirstButtonReturn)
>>>> (ccl::lisp-string-from-nsstring (#/stringValue input))))))
>>>>
>>>> I still have no idea why this works when the other one doesn’t, so it would still be great to get that figured out.
>>>>
>>>> On Apr 14, 2021, at 10:37 AM, Ron Garret <ron at flownet.com> wrote:
>>>>
>>>>> 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.
>>>>>
>>>>> Thanks,
>>>>> rg
>>>>>
>>>>> _______________________________________________
>>>>> Openmcl-devel mailing list
>>>>> Openmcl-devel at clozure.com
>>>>> https://lists.clozure.com/mailman/listinfo/openmcl-devel
>>>>
>>>> _______________________________________________
>>>> Openmcl-devel mailing list
>>>> Openmcl-devel at clozure.com
>>>> https://lists.clozure.com/mailman/listinfo/openmcl-devel
>>>
>>> _______________________________________________
>>> Openmcl-devel mailing list
>>> Openmcl-devel at clozure.com
>>> https://lists.clozure.com/mailman/listinfo/openmcl-devel
>>
>
More information about the Openmcl-devel
mailing list