Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-04

Patch for simple docking.

12 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

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.

Better would be to fix the root of the problem:
I think the automatic creation of a dockhost form probably uses createnew(), which maybe doesn't correctly allocate all structures (scrollbars/icons). But that is just a wild guess, which I currently don't have time to investigate.

Michael.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lcl-docking.diff
Type: text/x-diff
Size: 1461 bytes
Desc:
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100404/8438638b/attachment.bin>

Reply by email

Mattias Gaertner
to Michael Van Canneyt
Show quoted text 18 lines
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.

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote 23 lines
On Sun, 4 Apr 2010 13:31:10 +0200 (CEST) Michael Van Canneyt 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.

Reply by email

Hans-Peter Diettrich
to Michael Van Canneyt: I'm writing an article about docking in Lazarus. The first - and most simple - example I…
I'm writing an article about docking in Lazarus.

First question: which DockManager do you use?

Did you see:
http://wiki.lazarus.freepascal.org/LCL_Drag_Drop#Common_Principles

Show quoted text 11 lines
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 ;) ).

Sounds like new autosize bugs. Did you use -dOldAutoSize when building the LCL?

DoDi

Reply by email

Michael Van Canneyt
to Hans-Peter Diettrich: First question: which DockManager do you use? Did you see:…
Hans-Peter Diettrich wrote 5 lines
Michael Van Canneyt schrieb: > I'm writing an article about docking in Lazarus. First question: which DockManager do you use?

The standard LCL dockmanager.

And, yes, I know about EasyDockingManager.

I didn't see, but there is nothing in there which is new to me.

Show quoted text 15 lines
> 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 ;) ). Sounds like new autosize bugs. Did you use -dOldAutoSize when building the LCL?

No.

But now I did, and in that case there is some noticeable improvement.

Michael.

Reply by email

Michael Van Canneyt
to Michael Van Canneyt: Great, thank you. Maybe you can also have a look at the following bug: - Create main form…
Michael Van Canneyt wrote 27 lines
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)

Follow-up, after tip from Hans-Peter Diettrich:

When building the LCL with -dOldAutoSize, the panel is shown.

Michael.

Reply by email

Mattias Gaertner
to Hans-Peter Diettrich: First question: which DockManager do you use? Did you see:…
Show quoted text 23 lines
Michael Van Canneyt schrieb: > I'm writing an article about docking in Lazarus. First question: which DockManager do you use? Did you see: http://wiki.lazarus.freepascal.org/LCL_Drag_Drop#Common_Principles > 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 ;) ). Sounds like new autosize bugs. Did you use -dOldAutoSize when building the LCL?

The patch checks Iconnil, which is a good thing in an event.

The new autosize algorithm unhid many bugs, that worked by luck not by design.

Mattias

Reply by email

Mattias Gaertner
to Michael Van Canneyt: Follow-up, after tip from Hans-Peter Diettrich: When building the LCL with -dOldAutoSize,…
Show quoted text 35 lines
On Sun, 4 Apr 2010, Michael Van Canneyt wrote: > 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) Follow-up, after tip from Hans-Peter Diettrich: When building the LCL with -dOldAutoSize, the panel is shown.

This has been fixed.

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gaertner: On Sun, 4 Apr 2010 20:02:51 +0200 (CEST) What improvement? Mattias
Mattias Gaertner wrote 12 lines
On Sun, 4 Apr 2010 20:02:51 +0200 (CEST) Michael Van Canneyt wrote: > [...] >> Sounds like new autosize bugs. Did you use -dOldAutoSize when building the >> LCL? > > No. > > But now I did, and in that case there is some noticeable improvement. What improvement?

When the panel is dropped back on the form, it is shown again. (but with weird alignments)

Michael.

Reply by email

Michael Van Canneyt
to Mattias Gaertner: On Sun, 4 Apr 2010 20:04:38 +0200 (CEST) This has been fixed. Mattias
Mattias Gaertner wrote 40 lines
On Sun, 4 Apr 2010 20:04:38 +0200 (CEST) Michael Van Canneyt wrote: > > > On Sun, 4 Apr 2010, Michael Van Canneyt wrote: > >> 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) > > Follow-up, after tip from Hans-Peter Diettrich: > > When building the LCL with -dOldAutoSize, the panel is shown. This has been fixed.

Great, thank you very much.

Michael.

Reply by email