From: Steve Majewski
Subject: Re: XLISP-STAT: Can I change standard font?
Date:
Message-ID: <AF45F14B-D3E1E@128.143.7.127>
Dominic Early wrote on news:comp.lang.lisp, news:comp.lang.lisp.x :
( This reply CCed to <··············@umnstat.stat.umn.edu> -- you
might have better luck with questions there! )
>I am using XLISP-STAT and am building a system which uses an embedded
>high level language, as part of my PhD research. I would like to be able
to
>use non-standard characters and am wondering if it is possible to easily
>change the default font used by the system? I am using a PowerMac with
>XLISP STAT 3.48b, and had thought about hacking the system file to modify
>the font at a system level but would much rather something less hacky.
>If you can think of a cross platform solution all the better!
If you create or edit a "XLS Preferences" file in the same directory as the
XLISP-STAT application, you can put in lines like:
ListenerFontSize 12
ListenerFontName Monaco
EditFontName Courier
EditFontSize 12
GraphFontName Helvetica
GraphFontSize 10
Color yes
to change some of the defaults. However, this does *not* change the System
font (Chicago) that is used to draw the window title bars, menus, etc.
For that, you either need to either hack the system resourecs to do it
globally, or modify XlispStat to do it locally.
[ "XLS Preferences" is documented in the doc/changes.* file ]
>I am also trying to construct some complex dialog boxes under XLISP-STAT,
>if
>anyone has any examples I would be very greatful for some sample code. A
>particular problem I am having at the moment is with list-item-proto's. I
>override their :do-action method to do something but this method is not
>called when I single click on the list-item-proto, only when I double
click
>on it. Is this (dare I say it!) a bug or a deliberate feature? I just
>think it strange when the parameter list for the standard :do-action
>method
>is as follows do action(&optional dbl-click) which has a boolean parameter
>indicating whether it is a double-click or not, yet the method is only
>called on a double click, making the parameter redundant!
>
>What can I say about XLISP-STAT, its a great system, cheers Luke T. & co!
>
------
Example 1: non-modal-dialog -- the :action methods for each item
modify the target when clicked. This makes a non-modal dialog window
that allows setting of the graphs x & y max and turns on full view or
partial scrolling. ( I note that my list-item also requires a double
click --
I guessing this is a feature. ) This is one of my earliest attempts. I'ld
probably do it differently now:
------
( defmeth scatterplot-proto :make-range-widget ()
( let* ((xmax ( cadr (send self :range 0)))
(ymax ( cadr (send self :range 1)))
(hmax-label ( send text-item-proto :new "Horiz. max:" ))
(hmax-value ( send text-item-proto :new "" :text-length 4 ))
(hmax-scroll ( send interval-scroll-item-proto :new ( list 1
xmax )
:text-item hmax-value
:action #'(lambda (x) ( send self :range 0 0
x ))))
(vmax-label ( send text-item-proto :new "Vert. max:" ))
(vmax-value ( send text-item-proto :new "" :text-length 6 ))
(vmax-values (nice-dseq ymax))
(vmax-scroll ( send sequence-scroll-item-proto :new vmax-values
:text-item vmax-value
:action #'(lambda (y) (send self :range 1 0 y
))))
(hs-top ( send text-item-proto :new "Horiz. Scroll range:" ))
(hscroll ( send list-item-proto :new
( list "None" "1/2" "1/3" "1/4" "1/5" )
:selection 0
:action
#'(lambda (n)
( when n
( let (( n ( send hscroll :selection
)))
(send self :has-h-scroll
( if (zerop n) nil
(* (car (send self
:size)) (1+ n)))))))))
(vscroll (send toggle-item-proto :new "use vertical scroll" )))
------
example 2: modal dialog. For a modal dialog, you usually don't need an
:action for
the dialog items except for the final OK that dismisses the dialog. That
needs
to gather up all of the :text or :value values from the items.
When called with something like:
( setf dlg ( many-strings-dialog
"Experimenter:" "Specimen-ID:" "Structure:" "Treatment" ))
( send dlg :modal-dialog )
It will return something like:
(("Experimenter:" "Steve") ("Specimen-ID:" "10111") ("Structure:" "Cyto")
("Treatment" "control") ("Comments:" ""))
[ i.e. a list of labels and their edit-text entries. ]
and when you call :modal-dialog again, it will appear with those values as
the
new defaults.
------
( defun ledit ( label &optional ( def "" ) ( tlen 40 ))
( list
( send text-item-proto :new label :size '( 100 16 ))
( send edit-text-item-proto :new def
:size '( 200 16 ))))
( defun many-strings-dialog ( &rest labels )
( let* (( items ( mapcar #'ledit labels ))
( items ( append items ( list ( list
(send text-item-proto
:new "Comments:"
:size '( 100 16) )
(send edit-text-item-proto
:new ""
:size '( 200 100 ))))))
( d ( send ok-or-cancel-dialog-proto :new items :show nil
:ok-action
#'(lambda ()
( split-list
( sendtoall (combine items) :text ) 2 )))))
d ))
----
Steve Majewski <·····@Virginia.EDU>