Hi,
Windows 10 x64
TMS Component pack v8.9.2.1
Berlin 10.1 update 2
When using the mouse wheel to scroll the ColumnComboBox, the OnChange event gets spammed when:
- scrolling upward and the list is already on the first element
- scrolling downward and the list is already on the last element
Also, when scrolling downward with the mosue wheel and the list is already on the last element, it will trigger the OnChange twice. Once for the second to last element and once more for the last element.
Is this something that can be fixed?
Also, when using a normal ComboBox, when the list is dropped down and you use the mouse wheel to scroll, the OnChange event doesn't get triggered at all. It will be triggered only if/when you make a selection (enter, click). This feels "normal".
With a ColumnComboBox, the OnChange event gets triggered every time you scroll with the mouse wheel. This feels somewhat awkward especially when the list has a scrollbar. Is this a bug? If not is there a way to avoid this behaviour (an option maybe)?
Thanks
We traced & solved this issue and can confirm the next update will address this.
Hi,
most issues are not solved by the new version. Can you revalidate please?
The optimal fix would be to not trigger the OnChange event at all when you are using the MouseWheel to scroll the list content. Also, since the mouse cursor position on the dropdown makes the selected item change while scrolling, you can actually end up at the end of the list while you are scrolling up and at the beginning of the list when you are scrolling down!
To reproduce fill the combo with about 100 items, position yourself on item 50 and open the dropdown. Have an on change event to monitor what happens. Now try scrolling upward to reach item 1 and at the same time you are scrolling move the mouse cursor just a little bit downward. The ending position will be very far from the first element you will actually end up past the 50th element! Now try the same thing in reserve (try to go from the 50th element to the last by scrolling and while moving the cursor a bit upward at the same time, you will slowly end up near the beginning of the list.)
I think fixing it this way would solve these issues that were not fixed by the new version and make the ColumnCombo more in line with the Vcl ComboBox:
- Scrolling downward when you are already on the last element still triggers the OnChange event twice. Once for the second to last element and once more for the last element. (there would still be the annoying flicker from going from the last element to the second last and to the last element again but at least the OnChange would not be spammed).
- The OnChange event gets triggered every time you scroll with the mouse wheel. This feels somewhat awkward especially when the list has a scrollbar.
If you need an example to better understand the issues I could provide a gif. Just let me know.
Thanks!
Was retested here with a default TColumnComboBox on the form and the code:
procedure TForm1.ColumnComboBox1Change(Sender: TObject);
begin
listbox1.Items.Add('change');
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i: integer;
begin
ColumnComboBox1.Columns.Add;
for i := 0 to 100 do
begin
ColumnComboBox1.ComboItems.Add.Strings.Add('item '+inttostr(i));
end;
end;
but the behavior your describe cannot be seen here. Are you effectively compiling and linking with v1.5.1.2?
Hi,
I can confirm I am using v1.5.1.2
Here are 3 gifs to show what I am talking about.
This one is simply mouse wheel scroll. Notice the OnChange event gets spammed.
This one is mouse wheel scroll downward while being already on the last element.
This one is mouse wheel scroll upward. Notice what happens when I start moving the mouse cursor down while still scrolling upward.
Thanks
I cannot see this behavior with the latest version. It is as if you still compile with an old version.
Can you do a runtime version check on the component?
I am using the new version.
Here is a runtime check:
Maybe it could be something about my environment then?
Windows 7 x64
Berlin 10.1 Update 2
Is this a TColumnComboBox with default settings and just the code
procedure TForm1.ColumnComboBox1Change(Sender: TObject);
begin
listbox1.Items.Add('change');
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i: integer;
begin
ColumnComboBox1.Columns.Add;
for i := 0 to 100 do
begin
ColumnComboBox1.ComboItems.Add.Strings.Add('item '+inttostr(i));
end;
end;
Maybe it is Windows 7 related then? On Windows 10 I cannot see the behavior you show.
Yes I am using the default settings with very simple code:
procedure TForm3.FormCreate(Sender: TObject);
var
i: integer;
begin
ColumnComboBox1.Columns.Add;
for i := 0 to 100 do
begin
ColumnComboBox1.ComboItems.Add.Strings.Add('item '+inttostr(i));
end;
end;
procedure TForm3.ColumnComboBox1Change(Sender: TObject);
begin
Memo1.Lines.Add(ColumnComboBox1.Text + ' | ' + ColumnComboBox1.ItemIndex.ToString);
end;
Here is the component info from the dfm if it can help:
object ColumnComboBox1: TColumnComboBox
Left = 8
Top = 16
Width = 289
Height = 21
Color = clWindow
Version = '1.5.1.2'
Visible = True
Columns = <>
ComboItems = <>
EditColumn = -1
EditHeight = 15
EmptyText = ''
EmptyTextStyle = []
DropWidth = 0
DropHeight = 200
Enabled = True
GridLines = False
ItemIndex = -1
LookupColumn = 0
LabelCaption = ''
LabelFont.Charset = DEFAULT_CHARSET
LabelFont.Color = clWindowText
LabelFont.Height = -11
LabelFont.Name = 'Tahoma'
LabelFont.Style = []
SortColumn = 0
TabOrder = 0
OnChange = ColumnComboBox1Change
end
I still cannot see any problem.
Test project with EXE
Using your already compiled exe, I still see all the issues.
Did you try on a Windows 7 x64 computer?
It appears to be Windows 7 specific.
So, we'll need to investigate why this behaves different on Windows 7.
Indeed, just had someone test on a Windows 10 computer and apparently he doesn't have any issues either.
I hope this is something you will be able to fix.
Thanks for your time!
Hi,
any news on this weird issue?
Thanks
We applied a workaround for Windows 7 and older.