I would like to have a numeric-only text-field. I want it to return numbers with gadget-value, and to be able to setf it with numbers (and not strings). Is subclassing text-field (and text-field-pane?) and defining gadget-value and (setf gadget-value) the solution? If so, it seems to be more complicated than I thought.
Any idea/help/example?
Thanks, Yoel
I have just posted this reply to your comp.lang.lisp thread.
Paolo
------------------------------------------------------------------------ "Yoel Jacobsen" yoel.jacobsen@gmail.com writes:
I would like to have a numeric-only text-field. I want it to return numbers with gadget-value, and to be able to setf it with numbers (and not strings). Is subclassing text-field (and text-field-pane?) and defining gadget-value and (setf gadget-value) the solution? If so, it seems to be more complicated than I thought.
Off the top of my head, this should work. A possibly more idiomatic way would be to put something like this into an accepting-values form:
(let (my-number) (setf my-number (accept 'number :stream stream :prompt "Insert a number " :default 0)))
But, if I understand correctly, McCLIM currently has a couple of limitations:
- accepting-values is not fully implemented, and it does not use gadget views (this mostly mean that the look may not be pretty) - restrictions on the type of accepted value are not enforced, and only a warning message is printed
As has been suggested, you may get additional feedback from the McCLIM mailing list.
Paolo ------------------------------------------------------------------------