[Lazarus] Patch for simple docking.

Michael Van Canneyt michael at freepascal.org
Sun Apr 4 18:42:29 CEST 2010



On Sun, 4 Apr 2010, Mattias Gaertner wrote:

> On Sun, 4 Apr 2010 13:31:10 +0200 (CEST)
> Michael Van Canneyt <michael at freepascal.org> wrote:
>
>>
>> Hello,
>>
>> I'm writing an article about docking in Lazarus.
>>
>> The first - and most simple - example I tried, failed:
>> - Drop a panel on a form
>> - Set dragkind to dkDock
>> - Set dragmode to dkAutomatic.
>> - Run application
>> - Drag panel outside form, and let go.
>>
>> expected behaviour: a small form should appear, and the panel should be on it.
>>
>> Actual behaviour: 4 Access violations (fix one to get to the next ;) ).
>>
>> Attached small patch fixes the 4 access violations, after which the expected behaviour
>> occurs. They are all checks to see if a object pointer is not-nil.
>
> Thanks. Applied.

Great, thank you.

Maybe you can also have a look at the following bug:
- Create main form as above.
- Additionally Set docksite=true for the main form.
Run program.
- Drop panel outside main form. DockForm appears, panel is on it :-)
- Now drop the panel back on the main form.

-> The panel disappears.

All properties I thought of check out OK: visible, parent (it is main form), it's size.
(size of the form).

The same problem happens when you manually dock the panel back on the main form:
I do this with the following code in a button on the main form:

   Panel1.ManualDock(Self,Self,alTop,true);

I tried debugging it, but the error escapes me. All seems to be working as it should,
except that the control is not drawn on it's new location :/

It's not a panel problem, I tried with some other controls as well.
(tested on GTK2, latest Lazarus and FPC)

Michael.




More information about the Lazarus mailing list