View Issue Details

IDProjectCategoryView StatusLast Update
0004776JEDI VCL00 JVCL Componentspublic2009-08-05 12:05
ReporterjayAssigned Toobones 
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.38 
Summary0004776: TJvCheckedComboBox DropDownLines is not respected When Columns > 1
DescriptionWhen the property "Columns" > 1, the value of the property "DropDownLines" is not respected and can display more lines than will fit in the screen. In the "Additional Information" seccion, I describe a proposed solution to this problem so that you may consider to include to correct this problem in future versions of the components.
Additional InformationAnalizing the source code of the file JvCombobox.pas, I find the following code in "procedure TJvCustomCheckedComboBox.CreatePopup;"

  if FColumns > 1 then
    FDropDownLines := FListBox.Items.Count div FColumns + 1;

This code apparently changes the value of the property "DropDownLines" when FColumns > 1 without checking the value originally assigned to "DropDownLines".

I can correct the code to:

  if (FColumns > 1) and (FDropDownLines > (FListBox.Items.Count div FColumns + 1)) then
    FDropDownLines := FListBox.Items.Count div FColumns + 1;

which will temporarily correct the value, but it is still changing the value of the property "DropDownLines".

A better way to accomplish the procedures purpose would be to create a variable inside the procedure:

   DisplayDropDownLines: Integer;

and use that variable to determine the height of the DropDown window without changing the value of the original property "DropDownLines"

To avoid any unwanted change to the properties and correctly execute the procedure, the complete code for the procedure should look like:

procedure TJvCustomCheckedComboBox.CreatePopup;
  DisplayDropDownLines: Integer;

  if fColumns > 1 then
    // determine the real lines needed if FColumns > 1
    DisplayDropDownLines := FListBox.Items.Count div FColumns + 1
    // determine the real lines needed if FColumns = 1
    DisplayDropDownLines := FListBox.Items.Count + 1;

  if DisplayDropDownLines > FDropDownLines then
    // If the actual lines > value of property "DropDownLines", revert to property value
    DisplayDropDownLines := FDropDownLines;

  // adjust "DisplayDropDownLines" according to Min and Max values
  if DisplayDropDownLines < MinDropLines then
    DisplayDropDownLines := MinDropLines;
  if DisplayDropDownLines > MaxDropLines then
    DisplayDropDownLines := MaxDropLines;

  FSelectAll.Caption := FCapSelAll;
  FDeselectAll.Caption := FCapDeselAll;
  with TJvPrivForm(FPopup) do
    Font := Self.Font;
    Width := Self.Width;
    // use the current "DisplayDropDownLines" to determine height of window
    Height := (DisplayDropDownLines * FListBox.itemHeight + 4 { FEdit.Height });

TagsNo tags attached.



2009-05-13 07:14

reporter   ~0015521

I also needed the ability to add an option to the popup menu to "Invert selection" besides the "Select all" and "Deselect all".

I am enclosing the source file "JvCombobox.pas" that includes the correction to the mentioned problem AND adding the "Invert selection" option to the popup menu.

I notice that the source code is referencing the resourcestrings "RsCapSelAll" and "RsCapDeselAll" in the jvResources.pas for the popup menu titles. I AM NOT adding a resourcestring for the new menu option. However, it would be a more complete fix if you added it to the project.


2009-05-13 07:15 (12,990 bytes)

2009-05-21 01:37 (13,299 bytes)


2009-05-21 01:39

reporter   ~0015528

I am uploading the file "" with a bug fix to the "Invert selection" opcion.


2009-07-09 10:21

administrator   ~0015796

Could you upload the zipped sources of a sample application showing the problem?

2009-07-13 19:54 (2,189 bytes)


2009-07-13 19:58

reporter   ~0015845

I uploaded the file "" where it should be possible to see the problem.

Since I am using my corrected version of the JVCL, I can not verify it. But this should reproduce the condition that I am talking about.

Thanks in advance for your help.


2009-08-05 12:05

administrator   ~0015925

Thanks, this is now fixed in SVN

Issue History

Date Modified Username Field Change
2009-05-12 19:58 jay New Issue
2009-05-13 07:14 jay Note Added: 0015521
2009-05-13 07:15 jay File Added:
2009-05-21 01:37 jay File Added:
2009-05-21 01:39 jay Note Added: 0015528
2009-07-06 14:11 obones Status new => acknowledged
2009-07-09 10:21 obones Note Added: 0015796
2009-07-09 10:21 obones Status acknowledged => feedback
2009-07-13 19:54 jay File Added:
2009-07-13 19:58 jay Note Added: 0015845
2009-08-05 12:05 obones Note Added: 0015925
2009-08-05 12:05 obones Status feedback => resolved
2009-08-05 12:05 obones Fixed in Version => Daily / SVN
2009-08-05 12:05 obones Resolution open => fixed
2009-08-05 12:05 obones Assigned To => obones