Changeset 607


Ignore:
Timestamp:
Dec 4, 2009 5:09:00 PM (11 years ago)
Author:
toby
Message:

# on 2002/07/03 21:06:49, toby did:
Bug fix: cancel button was broken on Add/Edit? profile constraint
Enable continue button on "Editing New Profile Constraint" menu only if

terms are selected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/profcons.tcl

    • Property rcs:date changed from 2001/09/04 22:03:57 to 2002/07/03 21:06:49
    • Property rcs:lines changed from +3 -5 to +37 -5
    • Property rcs:rev changed from 1.4 to 1.5
    r414 r607  
    357357            ] -column 0 -row 5 -sticky ns
    358358    grid [button $top.quit -text "Cancel\nChanges" \
    359             -command "CancelEditConstraint $top" \
     359            -command "CancelEditProfileConstraint $top $num" \
    360360            ]  -column 1 -row 5
    361361    grid [button $top.help -text Help -bg yellow \
     
    412412    tkwait window $top
    413413    afterputontop
     414}
     415
     416# called when the "Cancel Changes" button is pressed
     417proc CancelEditProfileConstraint {top num} {
     418    global expcons
     419    if {$num == "add"} {destroy $top; return}
     420    set ans [MyMessageBox -type "{Abandon Changes} {Continue Edit}" \
     421            -parent [winfo toplevel $top] -default "abandon changes" \
     422            -helplink "expguierr.html AbandonEditConstraints" \
     423            -icon warning -message  \
     424            {Do you want to lose any changes made to this constraint?}]
     425    if {$ans == "abandon changes"} {destroy $top}
    414426}
    415427
     
    659671                -text $i] -column $i -row 3
    660672    }
    661     grid [button $top.b1 -text Continue \
    662             -command "set expcons(createflag) 1"] -column 0 -row 5
     673    grid [set expcons(ProfileCreateContinueButton) [button $top.b1 \
     674            -text Continue -command "set expcons(createflag) 1"]] \
     675            -column 0 -row 5
    663676    grid [button $top.b2 -text Cancel \
    664677            -command "set expcons(createflag) 0"] -sticky w -column 1 -row 5
     
    720733        }
    721734        grid [checkbutton $top.$i -text "#$i ($lbl)" \
    722                 -variable expcons(newcons$i) \
     735                -variable expcons(newcons$i) -command DisableProfileContinue \
    723736                ] -column $col -row $row -sticky w
    724737    }
    725 }
     738    DisableProfileContinue
     739}
     740
     741proc DisableProfileContinue {} {
     742    global expcons
     743    set p $expcons(ProfilePhase)
     744    set ptype $expcons(ProfileFunction)
     745    set htype $expcons(ProfileHistType)
     746    set termlist {}
     747    set i 0
     748    foreach lbl [GetProfileTerms $p $htype $ptype] {
     749        incr i
     750        if {$expcons(newcons$i)} {lappend termlist $i}
     751    }
     752    if {$termlist == ""} {
     753        $expcons(ProfileCreateContinueButton) config -state disabled
     754    } else {
     755        $expcons(ProfileCreateContinueButton) config -state normal
     756    }
     757}
Note: See TracChangeset for help on using the changeset viewer.