0
votes

I want to put a separator between two frames in my window. I want to use ttk::separator for that.

My code is:

proc create_layout_changing_frame {} {
    set ch_frm ".prop_menu.main_frame.changing_frame"
    global _PROP
    global _DB
    global _prop_attr
    set _frame_row 0

    set _size_text_lbl      20
    set _size_full_entry    85
    set _size_brw_button    3

    # The layout file frame
    set frm [frame  $ch_frm.layout_file]
    set lbl [label  $ch_frm.layout_file.label   -text "Layout file:"    -width $_size_text_lbl]
    set entr    [entry  $ch_frm.layout_file.entry   -textvariable _prop_attr(layout_file) -width [expr $_size_full_entry-$_size_brw_button]]
    set browse  [button $ch_frm.layout_file.browse  -image icon_browse  -command {get_layout_file}]
    set sep     [label  $ch_frm.layout_file.blank   -text ""]

    grid $lbl       -row 1 -column 1 -sticky nsw
    grid $entr      -row 1 -column 2 -sticky nse
    grid $browse    -row 1 -column 3 -sticky nsw
    grid $sep       -row 2 -column 1 -sticky nsw -columnspan 3
    grid $frm       -row [incr _frame_row] -column 1 -sticky nsew

    # The input instance frame
    # if not root - root isn't driven
    if {$_DB(blocks,$_prop_attr(block),father) != -1} {
        set frm     [frame  $ch_frm.input_instance]
        set lbl     [label  $ch_frm.input_instance.label    -text "Input Instance:" -width $_size_text_lbl]
        set warn    [label  $ch_frm.input_instance.warn     -text "" -fg "red"]
        set entr    [entry  $ch_frm.input_instance.entry    -textvariable _prop_attr(input_instance) -width $_size_full_entry -validate focusout -vcmd {check_input_instance}]

        grid $lbl   -row 1 -column 1 -sticky nsw
        grid $entr  -row 1 -column 2 -sticky nse
        grid $warn  -row 2 -column 1 -sticky nsew -columnspan 2

        grid $frm   -row [incr _frame_row] -column 1 -sticky nsew
    }

    # The output instance frame
    set frm [frame  $ch_frm.output_instance]
    set lbl [label  $ch_frm.output_instance.label   -text "Output Instances:"   -width $_size_text_lbl]
    set warn    [label  $ch_frm.output_instance.warn    -text "" -fg "red"]
    set entr    [entry  $ch_frm.output_instance.entry   -textvariable _prop_attr(output_instance) -width $_size_full_entry -validate focusout -vcmd {check_output_instance}]

    grid $lbl   -row 1 -column 1 -sticky nswe
    grid $entr  -row 1 -column 2 -sticky nse
    grid $warn  -row 2 -column 1 -sticky nsew -columnspan 2

    grid $frm   -row [incr _frame_row] -column 1 -sticky nsew


    # The driving instance frame
    ... There is a full definition of a frame here, it's a little complicated so I don't put it, But it works fine...


    # The power and ground pattern frame
    set sep     [ttk::separator $ch_frm.separator1  -orient horizontal]
    set frm [frame  $ch_frm.pwd_gnd_pattern]
    set lblpow  [label  $ch_frm.pwd_gnd_pattern.powlbl  -text "Power Pattern:"  -width $_size_text_lbl]
    set entrpow [entry  $ch_frm.pwd_gnd_pattern.powentr -textvariable _prop_attr(power_pattern) -width $_size_full_entry]
    set sep [label  $ch_frm.pwd_gnd_pattern.blank   -text ""]
    set lblgnd  [label  $ch_frm.pwd_gnd_pattern.gndlbl  -text "Ground Pattern:" -width $_size_text_lbl]
    set entrgnd [entry  $ch_frm.pwd_gnd_pattern.gndentr -textvariable _prop_attr(ground_pattern) -width $_size_full_entry]

    grid $lblpow    -row 1 -column 1 -sticky nsw
    grid $entrpow   -row 1 -column 2 -sticky nse
    grid $sep       -row 2 -column 1 -sticky nswe -columnspan 2
    grid $lblgnd    -row 3 -column 1 -sticky nsw
    grid $entrgnd   -row 3 -column 2 -sticky nse

    grid $sep       -row [incr _frame_row] -column 1 -sticky ew     -pady 4
    grid $frm       -row [incr _frame_row] -column 1 -sticky nsew

    make_all_layout_checks
}

The Separator doesn't show at all on the window, here is a picture. On top is how it looks now, and on the bottom, a red circle indicates the place where I would like to put the separator.

Also, the given code only deals with the frame that is inside a grooved border, all other elements, are dealt with elsewhere. red circle marks the spot

Where is the problem?

1

1 Answers

1
votes

You store the name of another widget (label $ch_frm.pwd_gnd_pattern.blank) in the sep variable a few lines below. This stops the separator from ever being shown.