Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Interface a second DataColumn drop down
Thu, Apr 28 2016 7:37 AMPermanent Link

Trinione

Hi:
I am creating a new component and need a second column like the DataColumn drop down that is tied to the currently selected DataSet. Let's call it DataColumnNextField.

How can this be accomplished?
Thu, Apr 28 2016 9:07 AMPermanent Link

Trinione

Attached is a demo with the interface file included.

NOTE, 'New York' does not appear in the drop down, but the value is stored in the StringList.

Is this the result of a bug, or an error in my code?



Attachments: TL27ButtonComboBox.zip
Thu, Apr 28 2016 9:48 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< Is this the result of a bug, or an error in my code? >>

It's an error in your code.  Your BuildDropDown should look like this:

procedure TL27ButtonComboBox.BuildDropDown;
begin
 DataSet.DisableControls;
 try
    Items.Add('');
    sl.Add('0');
  
    with DataSet do
    begin
      First;
      while not EOF do
      begin
        Items.Add(Columns[DataColumn].AsString);
        sl.Add(Columns[DataColumnID].AsString);
        Next;
      end;
    end;
  
    ItemIndex := 0;
  finally
     DataSet.EnableControls;
  end;
end;

You're essentially binding a column to the same dataset that you're navigating in this method.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Apr 28 2016 10:37 AMPermanent Link

Trinione

Tim:
Yep! That worked. Thanks.


<<  ... a second column like the DataColumn drop down that is tied to the currently selected DataSet >>

In my demo, how can the DataColumnID property drop-down appear like the DataColumn property drop-down?

I have spent quite a bit of time trying to get this to do so, but to no avail.
Image