Changeset 63 for trunk


Ignore:
Timestamp:
Dec 4, 2009 4:59:47 PM (14 years ago)
Author:
toby
Message:

# on 1999/02/22 20:03:00, toby did:
save the selected atom list and move the scroll restore so it is done correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    • Property rcs:date changed from 1999/02/19 18:17:14 to 1999/02/22 20:03:00
    • Property rcs:lines changed from +7 -6 to +17 -12
    • Property rcs:rev changed from 1.10 to 1.11
    r61 r63  
    135135# you've been warned this .EXP does not exist!
    136136if ![file exists $expgui(expfile)] {
    137     puts "creating $expgui(expfile)"
    138137    # create an "empty" exp file
    139138    createexp $expgui(expfile) \
     
    620619    set expgui(noreenterDisplayAllAtoms) 1
    621620    if {$mode != "reset"} {
    622         set selectlist [$expgui(atomlistbox) curselection]
     621        # save the scrolled position
    623622        set pos [lindex [$expgui(atomlistbox) yview] 0]
     623    } else {
     624        # this is a reset -- clear the selected atoms list
     625        set expgui(selectedatomlist) {}
    624626    }
    625627    $expgui(atomlistbox) delete 0 end
     
    714716    }
    715717    if {$mode != "reset"} {
    716         foreach i $selectlist {
     718        # restore the selected items
     719        foreach i $expgui(selectedatomlist) {
    717720            $expgui(atomlistbox) selection set $i
    718             $expgui(atomlistbox) yview moveto $pos
    719         }
     721        }
     722        # restore the last scrolled position
     723        $expgui(atomlistbox) yview moveto $pos
    720724    }
    721725    set expgui(noreenterDisplayAllAtoms) 0
     
    726730    global expgui
    727731    $expgui(atomlistbox) selection set 0 end
    728     # just in case this was called at the wrong time:
     732    # call editRecord in case trace was called before the selection was made
    729733    editRecord
    730734}
     
    733737proc editRecord { args } {
    734738    global entrycmd expgui
    735     set selectIndex [$expgui(atomlistbox) curselection]
     739    set expgui(selectedatomlist) [$expgui(atomlistbox) curselection]
    736740    # disable traces on entryvar for right now
    737741    set entrycmd(trace) 0
    738742
    739     if {[llength $selectIndex] == 0} {
     743    if {[llength $expgui(selectedatomlist)] == 0} {
    740744        puts  "How did this happen: [$expgui(atomlistbox) curselection]"
    741     } elseif {[llength $selectIndex] == 1} {
    742         editOneRecord $selectIndex
     745    } elseif {[llength $expgui(selectedatomlist)] == 1} {
     746        editOneRecord $expgui(selectedatomlist)
    743747    } else {
    744         editMultipleRecords $selectIndex
     748        editMultipleRecords $expgui(selectedatomlist)
    745749    }
    746750    # reenable traces on entryvar
    747751    set entrycmd(trace) 1
    748752    # repaint the atoms box in case anything was changed
    749 #    DisplayAllAtoms noreset
     753    #    DisplayAllAtoms noreset
    750754}
    751755
     
    29882992set expgui(pagenow) ""
    29892993set expgui(curhist) {}
     2994set expgui(selectedatomlist) {}
    29902995
    29912996loadexp $expgui(expfile)
Note: See TracChangeset for help on using the changeset viewer.