Using capi:tab-layout in a dialog
I'm trying to figure out the correct way to display a capi:tab-layout within a dialog box, but my lack of understanding of how to properly work with layouts is resulting in a mess. Here's what I intended: create a dialog box of fixed dimensions that contains several controls spread across 3 tabs. The tabs would "fill" the available space in the dialog so that they would have a constant size.Sounds simple enough, but when I navigate from one tab to the next, the minimize/maximize buttons turn off/on, and/or the dialog box re-sizes. I attempted to force each tab to be the same size using a combination of :visible-min-height and :visible-min-width, but like I said, the result is kind of a mess.
Any hints (or criticisms) are appreciated. A sample dialog box that shows this behavior (on Win32 + LW 4.4.6) is listed below.
Thanks,
Jon
-----------------------------------------------
(in-package :capi)
(define-interface sample-dialog ()
()
(:panes
;; tab 1 controls
(t1-radio-buttons
radio-button-panel
:items '("option 1" "option 2")
:layout-args '(:y-gap 10)
:layout-class 'column-layout
:max-height t
:max-width t)
(t1-input1
text-input-pane)
(t1-input2
text-input-pane
:visible-max-width '(:character 6))
;; tab 2 controls
(t2-range
text-input-range
:start 1
:end 500)
(t2-radio
radio-button-panel
:items '("A" "B" "C")
:max-height t
:max-width t)
;; tab 3 controls
(t3-list
list-panel
:title "List Items:"
:visible-max-height '(:character 3))
(t3-radio1
radio-button-panel
:items '("option A" "option B")
:layout-args '(:y-gap 10)
:layout-class 'column-layout
:max-height t
:max-width t)
(t3-range
text-input-range
:start 1
:end 500)
(t3-radio2
radio-button-panel
:items '("one" "two" "three")
:max-height t
:max-width t)
(t3-button
push-button
:text "Test Button")
;; dialog controls
(ok-cancel-buttons
push-button-panel
:cancel-button "Cancel"
:default-button "OK"
:items '("OK" "Cancel")
:callbacks '(abort-dialog abort-dialog)
:callback-type :interface
:layout-args '(:x-uniform-size-p t)
:max-height t
:max-width t))
(:layouts
;; main dialog layout
(top-layout
column-layout
'(settings-tabs ok-cancel-buttons)
:x-adjust :right
:internal-border 5)
(settings-tabs
tab-layout
()
:items '(("Tab 1" tab1)
("Tab 2" tab2)
("Tab 3" tab3))
:print-function 'car
:visible-child-function 'second
:visible-min-height 375)
;;tab 1 layout
(tab1
column-layout
'(tab1-group1)
:internal-border 10)
(tab1-group1
column-layout
'(t1-radio-buttons tab1-group1-section1)
:border t
:y-gap 10
:title "Tab 1 Group 1"
:title-position :frame
:internal-border 7)
(tab1-group1-section1
grid-layout
'("Value A:" t1-input1 "Value b:" t1-input2)
:columns 2)
;; tab 2 layout
(tab2
column-layout
'(tab2-group1)
:gap 10
:internal-border 10)
(tab2-group1
column-layout
'(tab2-group2-section1)
:y-gap 10
:title "Tab 2 Group 1"
:title-position :frame
:visible-min-width 338
:internal-border 7)
(tab2-group2-section1
row-layout
'(t2-range t2-radio)
:gap 10
:y-adjust :center)
;; tab 3 layout
(tab3
column-layout
'(tab3-group1 tab3-group2 tab3-group3)
:gap 10
:internal-border 10)
(tab3-group1
column-layout
'(tab3-group1-section1)
:y-gap 10
:title "Tab 3 Group 1"
:title-position :frame
:internal-border 7)
(tab3-group1-section1
row-layout
'(t3-list))
(tab3-group2
column-layout
'(t3-radio1 tab3-group2-section1)
:y-gap 10
:title "Tab 3 Group 2"
:title-position :frame
:visible-min-width 338
:internal-border 7)
(tab3-group2-section1
row-layout
'(t3-range t3-radio2)
:gap 10
:y-adjust :center)
(tab3-group3
column-layout
'(tab3-group3-section1)
:y-gap 10
:title "Tab 3 Group 3"
:title-position :frame
:visible-min-width 338
:internal-border 7)
(tab3-group3-section1
row-layout
'(t3-button "Warning: this could take a long time.")
:y-adjust :center))
(:default-initargs
:best-height 450
:best-width 410
:layout 'top-layout
:title "Sample"
:auto-menus nil))
(defun show-sample ()
(display-dialog (make-instance 'sample-dialog)))