Just a couple of questions:
1.) I have a DGB bound to a dataset with Columns setup using the designer interface, one of these columns is a Mask Edit Control with a mask of (##?##). When the user clicks into the cell and tries to enter an incorrect value a Msgbox popup appears with "Invalid Input". Where can I set the properties of this msgbox so I can include instructions for the user to follow to enter a correct value. I would also like to get to an event of the MaskEdit control inside the cell to convert and text typed to uppercase format.
2.) Once my user has entered a correct value into the maskedit box I would like to update the same column values of other similar rows to the new value. i.e. I have mutilple rows for product A which when the mask edit column for one is changed I would like to change them all.
I am thinking perhaps creating a intersected grid range selection (on the masked edit column) where the product id matches. Or something like that. Any ideas?
3.) I am still having problems grasping the deal with the grid re-drawing and column sizing. I have added code to auto size one column of my grid to fill the available client with of the grid control. I have added two custom event handlers one to handle QueryColWidth and one for SizeChanged. In QueryColWidth I manually calc the size for my autoSize column and set e.handled to true and in SizeChanged I grid.refresh(). However when I drag one of the columns to size it manually the grid drawing goes all messed up with columns appearing over each other. So I added another Handler to Grid.Model.ColWidthsChanged and am doing a Grid.Refresh() there also. What puzzles me is I have another form with a grid control on and I dont need the extra ColWidthsChanged handler?
Do I really need all these grid.refresh handlers?
It does slow down usability of the grid somewhat.
Thanks for any help. Mark
ADAdministrator Syncfusion Team June 28, 2004 07:22 AM
1.) To set your own message, handle the grid.ValidateFailed event. In your handler, set this.grid.CurrentCell.ErrorMessage = "MyMessage";
To force a string to be upper case, insert a greater than symbol (>) in the mask. So, if the mask is ">CCCC", you would get 4 uppercase letters.
2.) You could try handling CurretnCellConfirmChnages. At that point, you can call grid.CurrentCell.EndEdit and grid.Binder.EndEdit. Then you would have to visit each one of the cells you want to set using an something like this.grid[row, col].CellValue = ????. Then before changing the next one, you would want to call grid.Binder.EndEdit to make sure the change gets saved.
3) In your ColWidthsChanging handler, you should only be setting e.Size (and not explicitly setting grid.ColWidths[someCol] = something).
If you do this, this normally you do not have to handle any other events provided you set this.grid.SmoothControlResize = false. Setting this property will make the grid redraw itself entirely when a sizing is done. This generally avoids teh redraw problems you described.
ADAdministrator Syncfusion Team June 28, 2004 07:45 AM
Thanks for the comments. Questions 1 and 2 now on the way to being solved.
I have set SmoothResize to False and an not setting Colwidths.Size only e.size in the QueryColWidths handler and the grid still messes up when dragging columns only. Not on a re-size of the grid itself. Do you want an example or screenshots?
ADAdministrator Syncfusion Team June 28, 2004 07:51 AM
If you have a sample project, we can try to spot the problem here.