Grids and dialogs problem

Hi all!

I have a question regarding the grid:

I am making a simple package ie, a product finder. In this package, I have a frame with a grid, one of whose columns is used to select suppliers, for a particular product. I have to make a custom gridEditor class that pops up a dialog in which i can select the supplier from existing ones. I tried making a custom control, passing it to the grid in the custom editor class, and in the Show method of the control, i show-ed the dialog, but that doesnt work. I also tried show-ing the dialog in the beginedit method of the grideditor class. That also doesnt work.

Does anyone have any hints about how i can continue ?

I think the only solution is to recode the dialog as a control and create an addtional dialog class which has only this control. Am I correct ?

Rajeev J Sebastian

Rajeev J Sebastian wrote:

Hi all!

I have a question regarding the grid:

I am making a simple package ie, a product finder. In this package, I have a frame with a grid, one of whose columns is used to select suppliers, for a particular product. I have to make a custom gridEditor class that pops up a dialog in which i can select the supplier from existing ones. I tried making a custom control, passing it to the grid in the custom editor class, and in the Show method of the control, i show-ed the dialog, but that doesnt work. I also tried show-ing the dialog in the beginedit method of the grideditor class. That also doesnt work.

Does anyone have any hints about how i can continue ?

The GridCellEditor classes can only contain a wx.Control, there is probably too much in the Grid that depends on this. I think there are a couple approaches I would try:

* Instead of using a custom celleditor you could probably launch the dialog from the EVT_GRID_EDITOR_SHOWN handler if the current cell is one that should have this functionality. Then when ShowModal returns you can call grid.DisableCellEditControl and then grid.SetCellValue (if the dialog wasn't cancelled.)

* Alternativly you could try to make the celleditor idea work, but instead of invoking the dialog immediately from one of the celleditor methods call the base_ version of it so the editor will still work like normal, and then use wx.CallAfter to invoke a function after the pending events are handled that will launch the dialog.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!