Set ColumnComboBox column visibility

I'm using TColumnComboBox in a situation where I want one column to act as the sortColumn, but do NOT want to display that column.

Setting TColumnComboItem.Width to 0 in original code is ignored in drop-down display and in ShowItemHint.

As a quick-and-dirty fix, I modified ColCombo.pas to support "width:=0" hiding of text.


Changes to  TColumnComboBox.DrawItem

From:


  for col := 1 to FColumns.Count do
  begin
    ct := FColumns.Items[col-1].ColumnType;

    if (ct = ctText) then
      su := GetColumnString(s)
    else
      su := '';



To:


  for col := 1 to FColumns.Count do
  begin
    ct := FColumns.Items[col-1].ColumnType;

    if (ct = ctText) then begin
      su := GetColumnString(s);
      if (FColumns.Items[col-1].Width=0) then
        su := ''; // clear string if user sets width to 0
    end
    else
      su := '';




Changes to  procedure TColumnComboBox.CMHintShow

From :


    for i := 1 to Columns.Count do
    begin
        s := s + ' ' + GetColumn(i, hi^.HintStr);
    end;



To:


    for i := 1 to Columns.Count do
    begin
      if (Columns[i-1].Width>0) then // only include in hint if width>0
        s := s + ' ' + GetColumn(i, hi^.HintStr);
    end;



EdB

Thanks for the feedback. We have applied improvements to handle columns with zero width.