Project JEDI - Issue Tracker - JEDI VCL
Viewing Issue Advanced Details
4873 00 JVCL Components feature always 2009-07-23 04:11 2009-08-05 14:17
mazjac  
obones  
normal  
resolved 3.37  
fixed  
none    
none 3.38  
0004873: TJVCheckedComboBox - Items in TextBox should be in same order as the items in the Popup List
When Items are selected in the TJVCheckedComboBox Popup Windows ListBox, then they are added to the Textbox in the chronological order that they are selected. If an item is deselected and selected it moves to the end of the Textbox string. Again if "Select All" is used from Listbox popup then the Textbox string is reordered. Mildly annoying. See JVTest-NoListOrder.exe

I think that a better solution would be to always order the items in the TextBox in the same order as the items in the ListBox List. See JV-ListOrder.exe. A property could be added to select this (or the old) behaviour.


The following code changes in (in JVCombobox.pas) orders the items in the TextBox according to the list.
  
procedure TJvCustomCheckedComboBox.ToggleOnOff(Sender: TObject);
var
  I : integer;
  S: string;

begin
  if FListBox.ItemIndex = -1 then
    Exit;
// Orginal Code - moved to else if checked statements
// S:= Text;
  if FListBox.Checked[FListBox.ItemIndex] then
  begin
// Original Code
// if Add(FListBox.Items[FListBox.ItemIndex], S, Delimiter) then
// Replaced by Mark Davis 23/07/2009
      S:= '';
      for I := 0 to FListBox.Count - 1 do
        begin
          if FListBox.Checked[i] then
            begin
              if S <> '' then
                S:= S + FDelimiter;
              S:= S + FListBox.Items[I];
            end;
        end;
      FCheckedCount := FCheckedCount + 1;
// End of Added Code by Mark Davis 23/07/2009
  end
  else
    begin
// Added from above only needs to occur if false
      S:= Text;
  if Remove(FListBox.Items[FListBox.ItemIndex], S, Delimiter) then
    FCheckedCount := FCheckedCount - 1;
    end;
  ChangeText(S);
  Change;
end;
zip file icon JVTestProject2.zip [^] (921,064 bytes) 2009-07-23 04:11
zip file icon jvtest.zip [^] (4,898 bytes) 2009-07-24 08:12
Issue History
2009-07-23 04:11 mazjac New Issue
2009-07-23 04:11 mazjac File Added: JVTestProject2.zip
2009-07-23 09:04 obones Note Added: 0015879
2009-07-23 09:04 obones Status new => feedback
2009-07-24 08:12 mazjac File Added: jvtest.zip
2009-07-24 08:12 mazjac Note Added: 0015889
2009-08-05 14:17 obones Note Added: 0015934
2009-08-05 14:17 obones Status feedback => resolved
2009-08-05 14:17 obones Fixed in Version => Daily / SVN
2009-08-05 14:17 obones Resolution open => fixed
2009-08-05 14:17 obones Assigned To => obones

Notes
(0015879)
obones   
2009-07-23 09:04   
Please provide the zipped sources of both projects
(0015889)
mazjac   
2009-07-24 08:12   
I have just upload the source code.

Delphi 2007 Project.
JVCL : 3.37 (3.34 exhibited same problem)

Same source for both projects, one compiled with existing JVCL code, the other with code as noted above.
(0015934)
obones   
2009-08-05 14:17   
This is now in SVN, new property OrderedText, defaults to False, that you have to set to True to get your desired behavior.