Graphical calendar display

28 views
Skip to first unread message

Willi Riha

unread,
Sep 25, 2016, 11:27:19 AM9/25/16
to Shen

I’m working with Mark on displaying a monthly calendar using the SP graphical interface.  Basically the technique is to first create a widget and then to dictate how it is placed.  The function analog-grid allows us to display objects in a matrix form.  This matrix is determined by the input to analog-grid which is itself a list matrix (i.e a list of lists of widgets).  I tried this but I could only display the calendar without a heading.  Mark explained to me that I had to use frames.  A frame is a special widget which is spatial ordering  of widgets within a window.   So for the benefit of people here; this is a short example.


(widget .mywin window)     \\ create a window

(widget .mywin.f1 frame)   \\ create a frame in the window

(widget .mywin.f2 frame)   \\ create another frame in the window

 

Now create a widget which is the title and pack it in the first frame.

 

(pack [(widget .mywin.f1.title label -text "September 2016")])

 

Create a function for making labels.


(define mylabels

   N N -> [(labeln N)]

   M N -> [(labeln M) | (mylabels (+ M 1) N)])

  

(define labeln

  N -> (widget (concat .mywin.f2.l N) label -text (str N)))

 

Arrange them as a matrix in the frame using analog-grid.

 

(analog-grid [(mylabels 0 6) (mylabels 7 13)])

 

Finally pack the frames themselves; by default pack packs vertically from top to bottom.

 

(pack [.mywin.f1 .mywin.f2])



This is not an actual calendar of course; just shows the method.


Willi

Reply all
Reply to author
Forward
0 new messages