Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004776 [JEDI VCL] 00 JVCL Components minor always 2009-05-12 19:58 2009-08-05 12:05
Reporter jay View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version Daily / GIT
Summary 0004776: TJvCheckedComboBox DropDownLines is not respected When Columns > 1
Description When 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 Information Analizing 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:

Var
   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;
var
  DisplayDropDownLines: Integer;
begin
  //Click;

  if fColumns > 1 then
    // determine the real lines needed if FColumns > 1
    DisplayDropDownLines := FListBox.Items.Count div FColumns + 1
  else
    // 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
  begin
    Font := Self.Font;
    Width := Self.Width;
    // use the current "DisplayDropDownLines" to determine height of window
    Height := (DisplayDropDownLines * FListBox.itemHeight + 4 { FEdit.Height });
  end;
end;




Tags No tags attached.
Attached Files zip file icon JvCombobox.zip [^] (12,990 bytes) 2009-05-13 07:15
zip file icon JvCombobox_New.zip [^] (13,299 bytes) 2009-05-21 01:37
zip file icon TestProject.zip [^] (2,189 bytes) 2009-07-13 19:54

- Relationships

-  Notes
(0015521)
jay (reporter)
2009-05-13 07:14

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.

Regards,
Jay
(0015528)
jay (reporter)
2009-05-21 01:39

I am uploading the file "JvCombobox_New.zip" with a bug fix to the "Invert selection" opcion.
(0015796)
obones (administrator)
2009-07-09 10:21

Could you upload the zipped sources of a sample application showing the problem?
(0015845)
jay (reporter)
2009-07-13 19:58

I uploaded the file "TestProject.zip" 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.
(0015925)
obones (administrator)
2009-08-05 12:05

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: JvCombobox.zip
2009-05-21 01:37 jay File Added: JvCombobox_New.zip
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: TestProject.zip
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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker