Lisp HUG Maillist Archive

Fixed size switchable layout

I have a switchable layout in the middle of the a dialog.  I would 
like the layout size to be determined by the largest child, not by 
the child that's currently selected.  Is this possible?

To be more specific, my dialog is similar to the one below.  When you 
click the Switch button, the Do Nothing button jumps up and down.  I 
would like the Do Nothing button to stay in place, and for extra 
space to appear above it when using the smaller child.  How can I get 
that to happen?

(capi:contain
  (let* ((this (make-instance 'capi:column-layout
                   :description (list
                                 (make-instance 'capi:text-input-pane
                                     :title "#1")
                                 (make-instance 'capi:text-input-pane
                                     :title "#2")
                                 (make-instance 'capi:text-input-pane
                                     :title "#3"))))
         (other (make-instance 'capi:column-layout
                    :description (list
                                  (make-instance 'capi:text-input-pane
                                      :title "Something else"))))
         (switch (make-instance 'capi:switchable-layout
                     :description (list this other))))
    (make-instance 'capi:column-layout
        :description (list (make-instance 'capi:push-button
                               :text "Switch"
                               :selection-callback
                               #'(lambda (item interface)
                                   item
                                   (rotatef this other)
                                   (setf 
(capi:switchable-layout-visible-child switch) this)))
                           switch
                           (make-instance 'capi:output-pane
                               :visible-min-height 1 :visible-max-height t)
                           (make-instance 'capi:push-button
                               :text "Do Nothing")))))


Re: Fixed size switchable layout

Hi Gail,

FWIW... I found that I could control the panning size of Pinboard  
layouts by planting a non-displaying dummy object at the far corner of  
my desired display size. I don't know for sure about switchable  
dialogs, but my impression is that these are all based on the same  
underlying design of pinboards.

David McClain
Chief Technical Officer
Refined Audiometrics Laboratory
4391 N. Camino Ferreo
Tucson, AZ  85750


Re: Fixed size switchable layout

I think you can fix the height of your two switchable panes to the  
same value, for example using :visible-min-height (or :internal-min- 
height, etc.) so as to achieve what you want :


(capi:contain
  (let* ((this (make-instance 'capi:column-layout
                           :description (list
                                 (make-instance 'capi:text-input-pane
                                     :title "#1")
                                 (make-instance 'capi:text-input-pane
                                     :title "#2")
                                 (make-instance 'capi:text-input-pane
                                     :title "#3"))
                   :visible-min-height 300))
         (other (make-instance 'capi:column-layout
                    :description (list
                                  (make-instance 'capi:text-input-pane
                                      :title "Something else"))
                    :visible-min-height 300))
         (switch (make-instance 'capi:switchable-layout
                     :description (list this other))))
    (make-instance 'capi:column-layout
        :description (list (make-instance 'capi:push-button
                               :text "Switch"
                               :selection-callback
                               #'(lambda (item interface)
                                   item
                                   (rotatef this other)
                                   (setf (capi:switchable-layout- 
visible-child switch) this)))
                           switch
                           (make-instance 'capi:output-pane
                               :visible-min-height 1 :visible-max- 
height t)
                           (make-instance 'capi:push-button
                               :text "Do Nothing")))))


Jean



Le 18 févr. 08 à 22:41, Gail Zacharias a écrit :

>
> I have a switchable layout in the middle of the a dialog.  I would  
> like the layout size to be determined by the largest child, not by  
> the child that's currently selected.  Is this possible?
>
> To be more specific, my dialog is similar to the one below.  When  
> you click the Switch button, the Do Nothing button jumps up and  
> down.  I would like the Do Nothing button to stay in place, and for  
> extra space to appear above it when using the smaller child.  How  
> can I get that to happen?
>
> (capi:contain
>  (let* ((this (make-instance 'capi:column-layout
>                   :description (list
>                                 (make-instance 'capi:text-input-pane
>                                     :title "#1")
>                                 (make-instance 'capi:text-input-pane
>                                     :title "#2")
>                                 (make-instance 'capi:text-input-pane
>                                     :title "#3"))))
>         (other (make-instance 'capi:column-layout
>                    :description (list
>                                  (make-instance 'capi:text-input-pane
>                                      :title "Something else"))))
>         (switch (make-instance 'capi:switchable-layout
>                     :description (list this other))))
>    (make-instance 'capi:column-layout
>        :description (list (make-instance 'capi:push-button
>                               :text "Switch"
>                               :selection-callback
>                               #'(lambda (item interface)
>                                   item
>                                   (rotatef this other)
>                                   (setf (capi:switchable-layout- 
> visible-child switch) this)))
>                           switch
>                           (make-instance 'capi:output-pane
>                               :visible-min-height 1 :visible-max- 
> height t)
>                           (make-instance 'capi:push-button
>                               :text "Do Nothing")))))
>
>


Re: Fixed size switchable layout

Hi David,

Wouldn't I need to know the size (in pixels) to do this?  I am trying 
to avoid that.  I want CAPI to do the layout and figure out the 
sizes, I just want this one added constraint.

Gail

At 2/18/2008 04:59 PM, David McClain wrote:
>Hi Gail,
>
>FWIW... I found that I could control the panning size of Pinboard
>layouts by planting a non-displaying dummy object at the far corner of
>my desired display size. I don't know for sure about switchable
>dialogs, but my impression is that these are all based on the same
>underlying design of pinboards.
>
>David McClain
>Chief Technical Officer
>Refined Audiometrics Laboratory
>4391 N. Camino Ferreo
>Tucson, AZ  85750


Re: Fixed size switchable layout

At 2/19/2008 06:42 AM, Jean Bresson wrote:

>I think you can fix the height of your two switchable panes to the
>same value, for example using :visible-min-height (or :internal-min- 
>height, etc.) so as to achieve what you want :

Yes, but this requires me to know the pixel size of the largest 
child, which I don't know (it's different on Mac and Windows).

>(capi:contain
>  (let* ((this (make-instance 'capi:column-layout
>                           :description (list
>                                 (make-instance 'capi:text-input-pane
>                                     :title "#1")
>                                 (make-instance 'capi:text-input-pane
>                                     :title "#2")
>                                 (make-instance 'capi:text-input-pane
>                                     :title "#3"))
>                   :visible-min-height 300))
>         (other (make-instance 'capi:column-layout
>                    :description (list
>                                  (make-instance 'capi:text-input-pane
>                                      :title "Something else"))
>                    :visible-min-height 300))
>         (switch (make-instance 'capi:switchable-layout
>                     :description (list this other))))
>    (make-instance 'capi:column-layout
>        :description (list (make-instance 'capi:push-button
>                               :text "Switch"
>                               :selection-callback
>                               #'(lambda (item interface)
>                                   item
>                                   (rotatef this other)
>                                   (setf (capi:switchable-layout- 
> visible-child switch) this)))
>                           switch
>                           (make-instance 'capi:output-pane
>                               :visible-min-height 1 :visible-max- height t)
>                           (make-instance 'capi:push-button
>                               :text "Do Nothing")))))
>
>
>Jean
>
>
>
>Le 18 févr. 08 à 22:41, Gail Zacharias a écrit :
>
>>
>>I have a switchable layout in the middle of the a dialog.  I would
>>like the layout size to be determined by the largest child, not by
>>the child that's currently selected.  Is this possible?
>>
>>To be more specific, my dialog is similar to the one below.  When
>>you click the Switch button, the Do Nothing button jumps up and
>>down.  I would like the Do Nothing button to stay in place, and for
>>extra space to appear above it when using the smaller child.  How
>>can I get that to happen?
>>
>>(capi:contain
>>  (let* ((this (make-instance 'capi:column-layout
>>                   :description (list
>>                                 (make-instance 'capi:text-input-pane
>>                                     :title "#1")
>>                                 (make-instance 'capi:text-input-pane
>>                                     :title "#2")
>>                                 (make-instance 'capi:text-input-pane
>>                                     :title "#3"))))
>>         (other (make-instance 'capi:column-layout
>>                    :description (list
>>                                  (make-instance 'capi:text-input-pane
>>                                      :title "Something else"))))
>>         (switch (make-instance 'capi:switchable-layout
>>                     :description (list this other))))
>>    (make-instance 'capi:column-layout
>>        :description (list (make-instance 'capi:push-button
>>                               :text "Switch"
>>                               :selection-callback
>>                               #'(lambda (item interface)
>>                                   item
>>                                   (rotatef this other)
>>                                   (setf (capi:switchable-layout- 
>> visible-child switch) this)))
>>                           switch
>>                           (make-instance 'capi:output-pane
>>                               :visible-min-height 1 :visible-max- height t)
>>                           (make-instance 'capi:push-button
>>                               :text "Do Nothing")))))
>>


Re: Fixed size switchable layout


On Feb 18, 2008, at 4:41 PM, Gail Zacharias wrote:

> To be more specific, my dialog is similar to the one below.  When  
> you click the Switch button, the Do Nothing button jumps up and  
> down.  I would like the Do Nothing button to stay in place, and for  
> extra space to appear above it when using the smaller child.  How  
> can I get that to happen?

You can do it by adding a "spacer" object to the column layout that  
takes up the unused space. I just use a row or column layout for this.  
Modified example below.


John DeSoi, Ph.D.



(capi:contain
  (let* ((this (make-instance 'capi:column-layout
                              :description (list
                                            (make-instance 'capi:text- 
input-pane
                                                           :title "#1")
                                            (make-instance 'capi:text- 
input-pane
                                                           :title "#2")
                                            (make-instance 'capi:text- 
input-pane
                                                           :title  
"#3"))))
         (other (make-instance 'capi:column-layout
                               :description (list
                                             (make-instance 'capi:text- 
input-pane
                                                            :title  
"Something else")
                                             (make-instance 'capi:row- 
layout :description nil
                                                            :visible- 
min-width nil :visible-max-width nil
                                                            :visible- 
min-height nil :visible-max-height nil)
                                             )))
         (switch (make-instance 'capi:switchable-layout
                                :description (list this other))))
    (make-instance 'capi:column-layout
                   :description (list (make-instance 'capi:push-button
                                                     :text "Switch"
                                                     :selection-callback
                                                     #'(lambda (item  
interface)
                                                         item
                                                         (rotatef this  
other)
                                                         (setf  
(capi:switchable-layout-visible-child switch) this)))
                                      switch
                                      (make-instance 'capi:output-pane
                                                     :visible-min- 
height 1 :visible-max-height t)
                                      (make-instance 'capi:push-button
                                                     :text "Do  
Nothing")))))


Updated at: 2020-12-10 08:44 UTC