Using BDS2006, C++Builder. I want to resume what i see as bugs. I may be wrong or i may have not understood something; in this case pls tell me where i'm wrong.
1. At design time, an added item does not take the DefaultItem Category ID (it should do it, so i may add new buttons at the same Category). It also does not take the Info Text (if i write it, it should be present in the new Item), 2. While the Item CaptionMargin property cares of the left picture width, it does not cares of the left picture margin 3. ItemAppearance->HorizontalSpacing = 0 makes the items go under the Lookup Bar by exactly one pixel, eventually hiding the item right border. 4. The caption, when Justified Right or Center, is not on the Right on at the Center of the item. 5. Clicking on any area of the ListBox generates 2 OnClick events; here's a log:
6e. Clicking on the Caption of any Item: (MouseDown)
AdvSmoothListBox1_MouseDown ITEM EVENT: AdvSmoothListBox1_ItemCaptionClick ItemIndex=3 <== WHY THIS EVENT NOW? I STILL HAVE NOT RELEASED THE MOUSE BUTTON
3) Not able to reproduce this here, the border of the item is visible if HorizontalSpacing = 0.
4) When only the caption is displayed the caption is aligned inside the total item rectangle.
If the Notes Info, graphic left or right are visible the caption rectangle is reduced. Therefore the alignment is based on the rectangle of the caption.
5) Click issue will be fixed in the next version.
6) Different events are triggered when clicking on different parts of the item. For scrolling animation and selection purposes the events are called with the mouse button down event.
Then that events technically should not have been called "Click", as the Click action requires a MouseUp.
I may MouseDown, drag the cursor away and then MouseUp. This is the
standard way to "don't click" on a control after a wrong mouse pressure
in Windows. And all standard VCL controls works this way.
Anyway, I'm so much annoyed by the double-call of the Itemchanged event.
I need to call heavy routines in that event, and right now it is fired 2
times, with the itemindex Selected property switching from 0 to 1, even
if the item was already selected.
This is an issue, as if nothing changes, no Changed event should be fired, and not 2 times.
The same is valid for the ItemSelected event (again, when the item is already selected).
This is when i click on an already selected item
(MouseDown)
AdvSmoothListBox1_MouseDown
(MouseUp)
AdvSmoothListBox1_Click
AdvSmoothListBox1_Click
AdvSmoothListBox1_MouseUp
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=0, Checked=0, Selected=0, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=0, Checked=0, Selected=1, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemClick ItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemSelected ItemIndex=0, Checked=0, Selected=1, expanded=1, SelectedItemIndex=0
What's the reason the item has been deselected?
And in the case that this should be the wanted behaviour (which i don't
think), should the SelectedItemIndex value be -1, as there's no items
selected?
So, the only reliable event about selection changing seems to be the SelectionChanged Event:
(MouseDown)
AdvSmoothListBox1_MouseDown
(MouseUp)
AdvSmoothListBox1_Click
AdvSmoothListBox1_Click
AdvSmoothListBox1_MouseUp
ITEM EVENT: AdvSmoothListBox1_ItemSelectionChanged SelectedItemIndex=0
previousitemindex=0 Checked=0, Selected=1, expanded=1
itemindex........=2 Checked=0, Selected=0, expanded=1
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=0, Checked=0, Selected=0, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=2, Checked=0, Selected=1, expanded=1, SelectedItemIndex=2
ITEM EVENT: AdvSmoothListBox1_ItemClick ItemIndex=2
ITEM EVENT: AdvSmoothListBox1_ItemSelected ItemIndex=2, Checked=0, Selected=1, expanded=1, SelectedItemIndex=2
It tells me that the selection will switch from the PreviousItemIndex to the ItemIndex.
While i may use it, the other change/selection related events are'nt working as expected, in my opinion.
After some reasoning about this all, i think that the "main problem" is
that you need to have two very different behaviour depending on the
value of the MultiSelect property.
Since clicking on the caption does not change selection, and i need it, i've added this line in the ItemCaptionClick event:
AdvSmoothListBox1->Items->operator [](itemindex)->Selected = true;
This is the result, when i click only on captions of all my items(reduced log)
ITEM EVENT: AdvSmoothListBox1_ItemCaptionClick ItemIndex=2
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=2, Checked=0, Selected=1, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemCaptionClick ItemIndex=3
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=3, Checked=0, Selected=1, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemCaptionClick ItemIndex=4
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=4, Checked=0, Selected=1, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemCaptionClick ItemIndex=5
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=5, Checked=0, Selected=1, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemCaptionClick ItemIndex=6
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=6, Checked=0, Selected=1, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemCaptionClick ItemIndex=7
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=7, Checked=0, Selected=1, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemCaptionClick ItemIndex=8
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=8, Checked=0, Selected=1, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemCaptionClick ItemIndex=9
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=9, Checked=0, Selected=1, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemCaptionClick ItemIndex=10
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=10, Checked=0, Selected=1, expanded=1, SelectedItemIndex=0
Other than the issue of having these event fired at the mousedown
gesture, instead of the click, i want to point out that the
SelectedItemIndex property does not follow the Selected property.
This may be the wanted behaviour when the MultiSelect property is true.
When it is false, i think that the SelectedItemIndex should follow the
selected item index.
But now things become weird.
This is what happens when, after having clicked on all the captions, i click on the empty space of the item:
(MouseDown)
AdvSmoothListBox1_MouseDown
(MouseUp)
AdvSmoothListBox1_Click
AdvSmoothListBox1_Click
AdvSmoothListBox1_MouseUp
ITEM EVENT: AdvSmoothListBox1_ItemSelectionChanged SelectedItemIndex=0
previousitemindex=0 Checked=0, Selected=1, expanded=1
itemindex........=2 Checked=0, Selected=1, expanded=1
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=0, Checked=0, Selected=0, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=2, Checked=0, Selected=0, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=3, Checked=0, Selected=0, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=4, Checked=0, Selected=0, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=5, Checked=0, Selected=0, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=6, Checked=0, Selected=0, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=7, Checked=0, Selected=0, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=8, Checked=0, Selected=0, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=9, Checked=0, Selected=0, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=10, Checked=0, Selected=0, expanded=1, SelectedItemIndex=0
ITEM EVENT: AdvSmoothListBox1_ItemChanged ItemIndex=2, Checked=0, Selected=1, expanded=1, SelectedItemIndex=2
ITEM EVENT: AdvSmoothListBox1_ItemClick ItemIndex=2
ITEM EVENT: AdvSmoothListBox1_ItemSelected ItemIndex=2, Checked=0, Selected=1, expanded=1, SelectedItemIndex=2
It deselect all the items, and then select the clicked one.
Again, this may be valid when you can have more than one item selected,
but otherwise it is confusing, as i think to have only one item
selected.
Using
AdvSmoothListBox1->SelectedItemIndex = itemindex;
works as expected.
So, to try to sum it up a bit, this is what i'd expect with the Multiselect = false
- No ItemChanged / ItemSelected chained events when i click on an already selected item
- when Item->Selected is set to true the behaviour should be like
when the selection switch with a click, because if i've not set the
Multiselect to true, i should'nt have more than one item selected.
This is the zipped folder of the C++Builder project, with a compiled executable.
http://dl.dropbox.com/u/2651363/AdvSmoothListBox%20Event%20Logger.zip
so you may check my settings and see where's the problem.
Sorry for the long post, and thanks for your support.
Just installed the latest release. Referring to my initial list:
1) Fixed 2) Fixed 3) Still happens (it is visible in the picture i added in my previous post) 4) Still happens (visible in the same picture) 5) Fixed 6) Still happens: - Mouse Down on selected item empty space TForm1::AdvSmoothListBox1MouseDown - Mouse Up TForm1::AdvSmoothListBox1Click TForm1::AdvSmoothListBox1MouseUp ITEM EVENT: TForm1::AdvSmoothListBox1ItemChanged ItemIndex=3, Checked=0, Selected=0, expanded=1, SelectedItemIndex=3 <==Why it is unselected? ITEM EVENT: TForm1::AdvSmoothListBox1ItemChanged ItemIndex=3, Checked=0, Selected=1, expanded=1, SelectedItemIndex=3 ITEM EVENT: TForm1::AdvSmoothListBox1ItemClick ItemIndex=3 ITEM EVENT: TForm1::AdvSmoothListBox1ItemSelected ItemIndex=3, Checked=0, Selected=1, expanded=1, SelectedItemIndex=3 <==Why another event?
Found a couple of new bug (updated version) 7) Clicking on the caption of a disabled item generates the event, while all other item events are (correctly) not fired 8) Dragging the list to scroll it up or down changes the selected item, even if not dragging over the items.
I have no more to show than the picture i've already linked in my previous posts. Here's a link to a zip file containing the C++Builder project i use to "log" all the events, and the compiled EXE too: http://dl.dropbox.com/u/2651363/TMS_Event_Logger/AdvSmoothListBox_Event_Logger.zip Running the EXE on my PC show the glitch of point 3).
There's any document explaining the event chain of this component? Diggin to find what's the exact sequence of fired events when i click somewhere is really a hard task....