annoying flicker on grid's cell

The editor is not being shown in the code above, so doing a freeze there will not help anything. The flicker is happening because the widget is being created at (0,0) and then later when the editor is activated it is moved to the position of the cell being edited, and so you can momentarily see it at the old position before it is shown at the new one.

Another part of the problem is that it appears you are making a new instance of the cell editor every time that the cell is selected, so it is going to have the same trouble when it shows the new editor each time. You'll get rid of most of the problem if you allow the grid to reuse the same editor objects instead of creating new ones all the time.

I don't think anything can be done with the stock cell editors (other than patching the C++ code) but for your own custom cell editors you can probably get rid of the initial post-creation-first-showing flicker by creating the widget at a position that is not visible, such as (-200,-200).

···

On 6/25/10 4:42 AM, Fabio Spadaro wrote:

In my grid I have a column that has the type editor
combo box, if you position it on a first column
and active editor you get an annoying flicker that
I would like to delete.
I tried to put a Freeze () and Thawn () method but not
work:
     ...
     def createGridCellChoiseEditor(self,row):
         #Create the GridCellChoiceEditor with a blank list. Items will
         #be added later at runtime. "allowOthers" allows the user to
         #create new selection items on the fly.
         self.tChoiceEditor = wx.grid.GridCellChoiceEditor(,
allowOthers=False)

         self.grid.GetGridWindow().Freeze()
         self.grid.SetCellEditor(row, 1, self.tChoiceEditor)
         self.grid.GetGridWindow().Thaw()
    ...

--
Robin Dunn
Software Craftsman

Hi Robin,

···

2010/6/25 Robin Dunn robin@alldunn.com

On 6/25/10 4:42 AM, Fabio Spadaro wrote:

In my grid I have a column that has the type editor

combo box, if you position it on a first column

and active editor you get an annoying flicker that

I would like to delete.

I tried to put a Freeze () and Thawn () method but not

work:

 ...

 def createGridCellChoiseEditor(self,row):

     #Create the GridCellChoiceEditor with a blank list. Items will

     #be added later at runtime. "allowOthers" allows the user to

     #create new selection items on the fly.

     self.tChoiceEditor = wx.grid.GridCellChoiceEditor([],

allowOthers=False)

     self.grid.GetGridWindow().Freeze()

     self.grid.SetCellEditor(row, 1, self.tChoiceEditor)

     self.grid.GetGridWindow().Thaw()

...

The editor is not being shown in the code above, so doing a freeze there will not help anything. The flicker is happening because the widget is being created at (0,0) and then later when the editor is activated it is moved to the position of the cell being edited, and so you can momentarily see it at the old position before it is shown at the new one.
Another part of the problem is that it appears you are making a new instance of the cell editor every time that the cell is selected, so it is going to have the same trouble when it shows the new editor each time. You’ll get rid of most of the problem if you allow the grid to reuse the same editor objects instead of creating new ones all the time.
**
I don’t think anything can be done with the stock cell editors (other than patching the C++ code) but for your own custom cell editors you can probably get rid of the initial post-creation-first-showing flicker by creating the widget at a position that is not visible, such as (-200,-200).**

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Forgive me Robin but I did not understand what you explained in the point that I stressed, you make me a little example.

Thank you.


Fabio Spadaro
www.fabiospadaro.com

When your custom cell editor creates the widget it will use for editing the value give it a position of (-200,-200) by passing "pos=(-200,-200)" to the constructor.

···

On 6/28/10 12:37 AM, Fabio Spadaro wrote:

    *_ I don't think anything can be done with the stock cell editors
    (other than patching the C++ code) but for your own custom cell
    editors you can probably get rid of the initial
    post-creation-first-showing flicker by creating the widget at a
    position that is not visible, such as (-200,-200)._
    *

Forgive me Robin but I did not understand what you explained in the
point that I stressed, you make me a little example.

--
Robin Dunn
Software Craftsman