I have a fowm with a TAdvStringGrid component. Column 0 of the grid contains a nonsequential group of integers and column 1 contains a string, which may be empty or one word. Column 1 has an edComboList inplace editor that includes the allowable values. I'm trying to set the values in column 1 in a routine.
The code below works, except on the currently selected cell. The text value in that cell remains unchanged. I suspect it has to do with the fact that there is an editor for that column, but I can't figure out how to either disable the editor before doing the update, or even determine which is the currently selected cell in code.
These are the properties of sgFlights from the dfm file:int MyForm::SetAC(String & Flt, String & AC) {TFindParams fp = TFindParams();fp << fnFindInPresetCol << fnMatchFull;// sgFlights is the name of the TAdvStringGridTPoint p = sgFlights->Find(TPoint(0, 0), Flt, fp);if (p.y > 0) {sgFlights->Cells[1][p.y] = AC;}return p.y;}void MyForm::LoadFACfromGDB() {std::map<int, String>FlightMatcher;// .. code to populate flight matcher...map<int, String>::const_iterator itr;for (itr = FlightMatcher.begin(); itr != FlightMatcher.end(); ++itr) {String Flt = IntToStr(itr->first);String AC = itr->second;SetAC(Flt, AC);}
object sgFlights: TAdvStringGrid
Left = 22
Top = 128
Width = 225
Height = 192
Cursor = crDefault
Hint = 'Flights on the left, aircraft on the right'
Anchors = [akLeft, akTop, akRight, akBottom]
ColCount = 2
DrawingStyle = gdsClassic
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing]
ParentFont = False
ScrollBars = ssBoth
TabOrder = 0
OnExit = sgFlightsExit
OnMouseLeave = sgFlightsMouseLeave
HoverRowCells = [hcNormal, hcSelected]
OnGetEditorType = sgFlightsGetEditorType
OnGetEditorProp = sgFlightsGetEditorProp
ActiveCellFont.Charset = DEFAULT_CHARSET
ActiveCellFont.Color = clWindowText
ActiveCellFont.Height = -11
ActiveCellFont.Name = 'Tahoma'
ActiveCellFont.Style = [fsBold]
ColumnHeaders.Strings = (
'Flight'
'Aircraft')
ControlLook.FixedGradientHoverFrom = 15000287
ControlLook.FixedGradientHoverTo = 14406605
ControlLook.FixedGradientHoverMirrorFrom = 14406605
ControlLook.FixedGradientHoverMirrorTo = 13813180
ControlLook.FixedGradientHoverBorder = 12033927
ControlLook.FixedGradientDownFrom = 14991773
ControlLook.FixedGradientDownTo = 14991773
ControlLook.FixedGradientDownMirrorFrom = 14991773
ControlLook.FixedGradientDownMirrorTo = 14991773
ControlLook.FixedGradientDownBorder = 14991773
ControlLook.DropDownHeader.Font.Charset = DEFAULT_CHARSET
ControlLook.DropDownHeader.Font.Color = clWindowText
ControlLook.DropDownHeader.Font.Height = -11
ControlLook.DropDownHeader.Font.Name = 'Tahoma'
ControlLook.DropDownHeader.Font.Style = []
ControlLook.DropDownHeader.Visible = True
ControlLook.DropDownHeader.Buttons = <>
ControlLook.DropDownFooter.Font.Charset = DEFAULT_CHARSET
ControlLook.DropDownFooter.Font.Color = clWindowText
ControlLook.DropDownFooter.Font.Height = -11
ControlLook.DropDownFooter.Font.Name = 'Tahoma'
ControlLook.DropDownFooter.Font.Style = []
ControlLook.DropDownFooter.Visible = True
ControlLook.DropDownFooter.Buttons = <>
EnhRowColMove = False
Filter = <>
FilterDropDown.Font.Charset = DEFAULT_CHARSET
FilterDropDown.Font.Color = clWindowText
FilterDropDown.Font.Height = -11
FilterDropDown.Font.Name = 'Tahoma'
FilterDropDown.Font.Style = []
FilterDropDown.TextChecked = 'Checked'
FilterDropDown.TextUnChecked = 'Unchecked'
FilterDropDownClear = '(All)'
FilterEdit.TypeNames.Strings = (
'Starts with'
'Ends with'
'Contains'
'Not contains'
'Equal'
'Not equal'
'Clear')
FixedRowHeight = 22
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = clWindowText
FixedFont.Height = -11
FixedFont.Name = 'Tahoma'
FixedFont.Style = [fsBold]
FloatFormat = '%.2f'
Look = glStandard
Lookup = True
LookupHistory = True
MouseActions.DirectComboClose = True
MouseActions.DirectComboDrop = True
MouseActions.DirectEdit = True
Navigation.AdvanceOnEnter = True
Navigation.AdvanceOnEnterLoop = False
Navigation.AdvanceDirection = adTopBottom
Navigation.AllowCtrlEnter = False
Navigation.AdvanceAuto = True
Navigation.CursorWalkEditor = True
PrintSettings.DateFormat = 'dd/mm/yyyy'
PrintSettings.Font.Charset = DEFAULT_CHARSET
PrintSettings.Font.Color = clWindowText
PrintSettings.Font.Height = -11
PrintSettings.Font.Name = 'Tahoma'
PrintSettings.Font.Style = []
PrintSettings.FixedFont.Charset = DEFAULT_CHARSET
PrintSettings.FixedFont.Color = clWindowText
PrintSettings.FixedFont.Height = -11
PrintSettings.FixedFont.Name = 'Tahoma'
PrintSettings.FixedFont.Style = []
PrintSettings.HeaderFont.Charset = DEFAULT_CHARSET
PrintSettings.HeaderFont.Color = clWindowText
PrintSettings.HeaderFont.Height = -11
PrintSettings.HeaderFont.Name = 'Tahoma'
PrintSettings.HeaderFont.Style = []
PrintSettings.FooterFont.Charset = DEFAULT_CHARSET
PrintSettings.FooterFont.Color = clWindowText
PrintSettings.FooterFont.Height = -11
PrintSettings.FooterFont.Name = 'Tahoma'
PrintSettings.FooterFont.Style = []
PrintSettings.PageNumSep = '/'
SearchFooter.Color = clBtnFace
SearchFooter.FindNextCaption = 'Find &next'
SearchFooter.FindPrevCaption = 'Find &previous'
SearchFooter.Font.Charset = DEFAULT_CHARSET
SearchFooter.Font.Color = clWindowText
SearchFooter.Font.Height = -11
SearchFooter.Font.Name = 'Tahoma'
SearchFooter.Font.Style = []
SearchFooter.HighLightCaption = 'Highlight'
SearchFooter.HintClose = 'Close'
SearchFooter.HintFindNext = 'Find next occurrence'
SearchFooter.HintFindPrev = 'Find previous occurrence'
SearchFooter.HintHighlight = 'Highlight occurrences'
SearchFooter.MatchCaseCaption = 'Match case'
SelectionColor = clHighlight
SelectionTextColor = clHighlightText
Version = '7.0.4.0'
WordWrap = False
ColWidths = (
64
204)
RowHeights = (
22
22
22
22
22
22
22
22
22
22)
end
cheers,
Marc