Changeset 1229

Show
Ignore:
Timestamp:
08/30/05 18:56:56 (3 years ago)
Author:
paul
Message:

Fixed a problem that reared its ugly head when we forced the fillGrid()
last week to avoid that phantom record. Due to a problem I don't fully
understand, the wx SetFocus?() calls were having the effect of the current
value of the selected control propagating to each bizobj record as you
navigated. IOW, open appRecipes, refresh, go to the edit page and then
select the title field, then navigate with Ctrl+. The value in the first
record ends up on all records you scroll to. This fixes the problem by
temporarily unbinding the control from the bizobj during fillGrid.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/ui/uiwx/dGrid.py

    r1171 r1229  
    757757        # Save the focus, if any 
    758758        currFocus = self.FindFocus() 
     759        currDataField = None 
     760     
     761        # if the current focus is data-aware, we must temporarily remove it's binding 
     762        # or the value of the control will flow to other records in the bizobj, but 
     763        # I admit that I'm not entirely sure why.  
     764        if currFocus: 
     765            try: 
     766                currDataField = currFocus.DataField 
     767                currFocus.DataField = "" 
     768            except AttributeError: 
     769                pass 
     770 
    759771        # Get the default row size from dApp's user settings 
    760772        app = self.Application 
     
    819831                    for rr in range(self.RowCount): 
    820832                        self.SetCellEditor(rr, ii, edtClass()) 
    821          
     833                
    822834        if currFocus is not None: 
     835            # put the data binding back and re-set the focus: 
    823836            try: 
    824                 currFocus.SetFocus() 
     837                currFocus.setFocus() 
     838                currFocus.DataField = currDataField 
     839                currFocus.refresh() 
    825840            except: pass 
    826841