2007-07-05

Can you confirm this bug?

Well, 3 months ago, when watching one of the CodeRage Encore presentations, I witnessed a bug in action (more on that sooner!); even though I tried (as you can see in the replay), I couldn't get the presenter to replicate the bug. Now that the replays are finally available and now that I know how to skip so as to quickly find out which presentation and at what point it was (3 months make you forget a lot of stuff, especially when you were thinking the replays would be on after a week or so!), I've finally confirmed that I did indeed saw a bug.

Can you please go here, wait for the video to fully stream (progress bar fully light gray) and then position a few seconds before 06:38 where the bug happens and confirm that it is indeed a bug? I'll report it in QC as soon as I get some 3rd party confirmation on that.

Here's the bug: if you notice in that presentation, there are 3 buttons selected; the middle button has darker corners meaning that it's the button that is used to "control" the action, that is, whatever you choose it relates to that button. Notice that, when selecting the "Align top" the 3 buttons are (incorrectly!) aligned to the first button's top and not to the one with the darker corners. (Watch the video from the start for the explanation on the dark corners). [Edit: the dark corners are either explained elsewhere or later in the video, not before!]

If you can confirm what I saw, then please leave a comment here.

(CodeGear should probably hire me for finding bugs for them, but since I do it for free anyway, I don't think they want to! :))

[EDIT:]

Actually, at first, after making this blog post, I thought it could be some Camtasia bug as I could not reproduce it (as I right-clicked the top-left button it was selected); I have however been able to replicate it afterwards!

Here are the full steps:

1) File->New Form
2) Double click 3 times on TButton
3) Grab button 3 to top left
4) Grab button 2 to mid right
5) Drag a selection box from upper-left to lower-right

At this point, Button 1 is selected;

6) Right-click Button 3
7) Choose Position->Align from the menu and Cancel

At this point, Button 1 still appears to be selected.

8) Click on Align Tops in the Align toolbar and get the wrong behavior doing the align with Button 3 instead.

It appears that Button 3 was in fact selected by right-clicking and that the designer didn't redraw to show that.

BTW: Using Delphi 2007 SP1 on Windows XP with theming active.

7 comments:

efortier said...

I watched the video again, and it indeed was a bug. When the buttons were multi-selected, the second one from the left had the dark corners, meaning it should have been the anchor for the align operation.

Instead the buttons got aligned as if the first button to the left was the anchor. When I try this in my version of Delphi and place the buttons exactly like in the video and multi-select, the left-most button is always the one with the dark corners and the align operation performs as it should.

I suspect that the problem we see in the video was probably fixed between his version of Delphi 2007 and the one I use. I'm using the very latest version.

Bruce McGee said...

This definitely looks like a bug, but I can't duplicate it here. Even when I add and select the buttons exactly the same way shown.

Right or wwong, when you multi-select by dragging, the first control in the create order is selected as the anchor by default. You can demonstrate this by viewing the form as text, changing the order of the controls and selecting them again.

Bruce McGee said...
This comment has been removed by the author.
Bruce McGee said...

I saw the update to the post.

When I follow your steps, button3 changes to the anchor control (darker squares) when the alignment dialog is shown.

Also, the speaker used the alignment toolbar rather than the context menu, so no right clicking.

I still can't duplicate what I saw in the video (also running XP with themes).

Did I miss something?

Fernando Madruga said...

Bruce, if you notice carefully, the speaker *also* used the context menu after right-clicking Button 3: he simply Canceled the dialog and *then* used the Align toolbar.

That, I believe, is the whole thing...

In all fairness, the first time I tried I also got Button 3 with the darker corners but now, following my own steps *to the letter* I seem to be able to replicate it consistently...

(Another try: yep! Managed to replicate the bug here again...)

Bruce McGee said...

Yup, I missed him using the context menu.

I'm still seeing different behaviour, though. If I right click Button3 and bring up the context menu, Button3 has the darker squares (not the case in the video).

I think the bug here is that right-clicking a control when more than one is selected shouldn't change the anchor.

I'll try it again on another system later today.

Bruce McGee said...

Using the same steps on another system (Vista-64 Ultimate), I see the same thing you do. Button3 is not drawn as the anchor.