Changeset 3187

Show
Ignore:
Timestamp:
06/20/07 10:34:24 (2 years ago)
Author:
paul
Message:

With this commit, checkboxes in editable grid columns behave much more similarly to
regular checkboxes. The moment the user toggles it, the underlying bizobj will get
updated with the new value.

In addition, a new event is raised when the checkbox is toggled: GridCellEditorHit?.
In the future, we'll expand this to be raised for any type of editor, but for now it
only works for checkboxes.

Completes ticket #1068

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/dEvents.py

    r3100 r3187  
    710710 
    711711 
     712class GridCellEditorHit(GridEvent): 
     713    """Occurs when the user changes the value in the grid cell editor. 
     714 
     715    For a checkbox, this occurs when the user toggles the checkmark. 
     716    This event is not implemented for other grid cell editors, yet. 
     717    """ 
     718 
     719 
    712720class GridColSize(GridEvent): 
    713721    """Occurs when the grid's columns are resized.""" 
  • trunk/dabo/ui/uiwx/dGrid.py

    r3184 r3187  
    33003300        if ed: 
    33013301            ed.SetValue(not ed.GetValue()) 
    3302          
     3302            self._checkBoxToggled(ed) 
     3303         
     3304    def _checkBoxToggled(self, obj): 
     3305        # Force the flushing of the value immediately, instead of waiting for the 
     3306        # editor to lose focus (where the flush will happen a second time). 
     3307        self._Table.SetValue(self.CurrentRow, self.CurrentColumn, obj.GetValue()) 
     3308        self.raiseEvent(dabo.dEvents.GridCellEditorHit) 
     3309 
    33033310    def __onGridCellLeftClick_toggleCB(self, evt): 
    33043311        col = self.Columns[evt.GetCol()] 
     
    33343341                    evt.Skip() 
    33353342 
     3343            def onHit(evt): 
     3344                self._checkBoxToggled(editor) 
     3345 
    33363346            ed = self._activeEditorControl = evt.Control 
    33373347            ed.WindowStyle |= wx.WANTS_CHARS 
    33383348            ed.Bind(wx.EVT_KEY_DOWN, onKeyDown) 
     3349            ed.Bind(wx.EVT_CHECKBOX, onHit) 
    33393350        evt.Skip() 
    33403351