[cells-devel] tile slot

Frank Goenninger frgo at mac.com
Sun Mar 23 10:33:56 UTC 2008


Am 22.03.2008 um 20:38 schrieb Ken Tilton:
> Andy Chambers wrote:
>> Hi,
>> Are you supposed to be able to use the tile? slot to determine  
>> whether
>> a tile widget is used?
>
> Ugh, I honestly do not recall. I think setting that to t /tells/  
> celtk to use tile.


Yes, that's how it is used. Some widgets do have slots and/or behavior  
that are only avaliable when Tile is used/loaded.

> I know I tested tile on win32, seemed OK.

Mac OS X had problems with it a while back (Tile wasn't working with  
Tk 8.5 on OSX back then). I don't know what the status is today,  
though, as I still don't use  Tile.

>> I've been trying to convert some of the demos distributed with tk
>> itself to celtk but because
>> the tile widgets are used by default, you can't set any style  
>> properties.
>> I tried the code below but cells thinks the relief slot needs a
>> parent.  I get the error....
>> "New as of Cells3: parent must be supplied to make-instance of  
>> KEYWORD
>> kid RELIEF"
>
> That is different, you just have to check all the macrology to make  
> sure the :parent slot is picked up from *parent* or self or something,

Yep. So all those mk- macros have to be enhanced to include ":fm- 
parent *parent*" in their definitions.

>> (defmodel tk-labels (window)
>>  ()
>>  (:default-initargs
>>      :title$ "Label Demonstration"
>>    :kids (c? (the-kids
>> 	       (mk-stack (:packing (c?pack-self "-side top"))
>> 		 (mk-label :wraplength "4i"
>> 			   :tk-justify 'left
>> 			   :text (concatenate 'string
>> "Five labels are displayed below: three textual ones on the left  
>> and a bitmap"
>> "label and a text label on the right.  Labels are pretty boring "
>> "because you can't do anything with them."))
>> 		 (mk-row ()
>> 		   (mk-stack (:pady 2
>>                              :layout-anchor 'w)
>> 		     (mk-label :text "First Label")
>> 		     (mk-label :tile? nil)
>> 		               :relief (c? 'raised)
>> 		               :text "Second Label, raised"
>> 		     (mk-label :tile? nil
>> 		               :text "Third Label, sunken"
>> 			       :relief (c? 'sunken)))))))))
>> Am I going about this the wrong way?
>> Another problem I'm having is to do with packing.  Are you really
>> supposed to be able to
>> express the layout of a whole app with just one pack statement?
>
> I think rows and stacks supply useful packing by default which one  
> overrirdes at will.

Yep. They do.

(defmodel tk-labels (window)
  ()
  (:default-initargs
      :title$ "Label Demonstration"
    :kids (c? (the-kids
               (mk-stack (:packing (c?pack-self "-side top"))
                         (mk-label :wraplength "4i"
                                   :tk-justify 'left
                                   :text (concatenate 'string
"Five labels are displayed below: three textual ones on the left and a  
bitmap"
"label and a text label on the right.  Labels are pretty boring "
"because you can't do anything with them."))
                         (mk-row ()
                                 (mk-stack (:pady 2             ;; Not  
sure about this
                                            :layout-anchor 'w)  ;; I  
always use explicit placing
                                           (mk-label
                                             :text "First Label")
                                           (mk-label
                                            :relief 'raised
                                            :text "Second Label,  
raised")
                                            (mk-label
                                             :text "Third Label, sunken"
                                             :relief 'sunken))))))))

... this should do it (warning: untested).

Cheers!

Frank




More information about the cells-devel mailing list