Re: EuGrid: How to use onGotFocus for a "cell"?
- Posted by Phil Russell <pg_russell at lineone.net> Feb 22, 2007
- 502 views
Rad wrote: > > Thanks Jonas. I will try out the code and get back. > > Jonas Temple wrote: > > > > > Like EGW_SaveCellData(), can there be EGW_LoadCellData() in future verion > > > of > > > EuGrid > > > for loading individual cell data instead of entire grid? > > > > You can do this via the EuGrid routine: > > > > boolean = EGW_SetDataCellValue ( integer id, atom row, atom datacol, object > > value ) > > > > What I meant was updating the Grid Cell, not the underlying Dataset cell. > > At present, to update the a single Grid Cell (after using amount handler > function), > I am using EGW_SetDataCellValue() and then reloading entire grid to reflect > the change. > > Regards > Rad. Rad, There isn't really a 'current cell' to update - a bit of trickery occurs to make it look like each cell contains a window. The way it works is that an image of the grid is generated and painted onto the screen. When you click on a grid cell then the appropriate edit control is sized to the cell, made visible, placed on top of the cell area, text set to the underlying data cell value, and given the input focus. There are only a few actual child windows which are continually reused e.g. three text edit fields (one for each text justification type), one combo box, and one list box. Buttons and checkboxes are emulated. This makes it a bit tricky to handle stuff like focus events as e.g. what appears to be tabbing from cell to cell is really just the same window being moved around. Anyway, Jonas's suggestion is correct. It may seem like overkill to repaint the grid just to update a particular value, but only the *visible* part of the grid is ever generated i.e. the overhead is the same for a grid containing 10 rows as it is for one containing 10,000. Given that a typical grid will only display 40-50 cells, the drawing effort is minimal. HTH, Phil