Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi All I have written a code f

Status
Not open for further replies.

mistkhan

Technical User
May 31, 2003
14
0
0
IN
Hi All

I have written a code for window display, the window display format is below, however on executing code the button OK and CANCEL display in some other location and labelentry Major will not be aligned to the selectcommand label frame.

Can anybody tell what changes I have to do in the code to get the below window display

Thanking you in advance

regards
Aman
---------------------------------------------------
|
|
| -SelectCommand- Labelentry Major Button OK
| |Add | Labelentry Minor Button CANCEL|
| |Remove | Labelentry Command
| |-------------
|
|--------------------------------------------------


proc testgui1 {w} {

toplevel $w.top
wm geometry $w.top 543x278+284+358; #update
wm transient $w.top .
wm title $w.top "ADD / REMOVE API"

frame $w.top.mainframe -borderwidth 2 -relief groove -height 350 -width 495
pack $w.top.mainframe -expand true -pady .5c -padx .5c -ipadx 350 -ipady 495

set mainframe $w.top.mainframe

labelframe $mainframe.titframe -pady 2 -text " Select Command " -padx 2
pack $mainframe.titframe -side left -padx .5c -pady .5c -anchor nw -ipadx 5 -ipady 5

radiobutton $mainframe.titframe.rad0 -selectcolor white -text {Add API} -relief flat -variable radio0 -value 0
radiobutton $mainframe.titframe.rad1 -selectcolor white -text {Remove API} -relief flat -variable radio0 -value 1


pack $mainframe.titframe.rad0 -side top -anchor nw
pack $mainframe.titframe.rad1 -side top -anchor nw

LabelEntry $mainframe.lab77 -label { Major ID: } -takefocus 1 -text Edit -textvariable ""
LabelEntry $mainframe.cpd78 -disabledforeground #a3a3a3 -insertbackground black -label { Minor ID: } -takefocus 1 -text Edit -textvariable ""
LabelEntry $mainframe.lab79 -disabledforeground #a3a3a3 -insertbackground black -label {Command: } -takefocus 1 -text Edit -textvariable ""

button $mainframe.but80 -disabledforeground #a3a3a3 -pady 0 -text OK -width 10
button $mainframe.but81 -disabledforeground #a3a3a3 -pady 0 -text Cancel -width 10

pack $mainframe.lab77 -side top -pady 10 -anchor nw
pack $mainframe.cpd78 -side top -pady 10 -anchor nw
pack $mainframe.lab79 -side top -pady 10 -anchor nw

pack $mainframe.but80 -side top -padx 6 -pady 6 -anchor ne
pack $mainframe.but81 -side top -padx 6 -pady 6 -anchor ne
}
 
Try:
Code:
  proc testgui {top}   {

    # create toplevel
    toplevel $top
    wm geometry $top +284+358; #update
    wm transient $top .
    wm title $top "ADD / REMOVE API"

    # create main frame
    set mf $top.mf
    frame $mf -borderwidth 2 -relief groove -height 350 -width 600

    # create columns
    set f1 $mf.f1
    set f2 $mf.f2
    set f3 $mf.f3
    
    labelframe $f1 -pady 2 -text " Select Command " -padx 2
    frame $f2
    frame $f3

    # create column 1
    radiobutton $f1.rad0 -selectcolor white -text {Add API}             -relief flat -variable radio0 -value 0
    radiobutton $f1.rad1 -selectcolor white -text {Remove API}             -relief flat -variable radio0 -value 1
    # create column 2
    LabelEntry $f2.lab77             -label {Major ID:} -labelwidth 10 -labelanchor center             -takefocus 1 -text Edit -textvariable ""
    LabelEntry $f2.cpd78             -disabledforeground #a3a3a3 -insertbackground black             -label {Minor ID:} -labelwidth 10 -labelanchor center             -takefocus 1 -text Edit -textvariable "" 
    LabelEntry $f2.lab79             -disabledforeground #a3a3a3 -insertbackground black             -label {Command:} -labelwidth 10 -labelanchor center             -takefocus 1 -text Edit -textvariable "" 
    # create column 3
    button $f3.but80             -disabledforeground #a3a3a3 -pady 0 -text OK -width 10
    button $f3.but81             -disabledforeground #a3a3a3 -pady 0 -text Cancel -width 10
    # place and show
    pack $mf -expand true -pady 20 -padx 20
    grid $f1 -column 0 -row 0 -sticky nw -pady 20 -padx 20
    grid $f2 -column 1 -row 0 -sticky nw -pady 20 -padx 20
    grid $f3 -column 2 -row 0 -sticky nw -pady 20 -padx 20
    
    grid $f1.rad0 -column 0 -row 0 -sticky w -pady 10
    grid $f1.rad1 -column 0 -row 1 -sticky w -pady 10

    grid $f2.lab77 -column 0 -row 0 -sticky w
    grid $f2.cpd78 -column 0 -row 1 -sticky w -pady 10
    grid $f2.lab79 -column 0 -row 2 -sticky w

    grid $f3.but80 -column 0 -row 0 -sticky n
    grid $f3.but81 -column 0 -row 1 -sticky n -pady 10
  } 

  package require BWidget 
  testgui .top
HTH

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top