Sign in Join

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

Mailing lists / lazarus / 2014-02

Bug creating a new control?

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Fabio Luis Girardi

Hi all!

I started the TDBCtrlGrid implementation some days ago. At this point, I don't know if I'm doing some mistake or if Lazarus has a bug. The problem is that I can't put any controls on TDBCtrlGrid area, but I can put controls with csReplicatable in ControlStyle inside a "RowPanel" (TDBCtrlGridRow class) that is a control that will be used to draw rows, BUT LAZARUS don't do this!!

TDBCtrlGrid is created with

ControlStyle := [csOpaque, csDoubleClicks];

and TDBCtrlGridRow is created with

ControlStyle := [csAcceptsControls, csCaptureMouse, csClickEvents,
    csDoubleClicks, csOpaque, csReplicatable];

Logically, the row panel must accept controls, but TDBCtrlGrid NOR TDBCtrlGridRow accepts controls.

If this is a bug, tell me and I will open a new bug on Lazarus BugTracker. If not, tell me what I'm doing wrong...

Initially, all tests are done in Lazarus 1.0.8 fpc 2.6.2 Win32 on a Windows 2003 server 32 bits.

The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140221/307e82de/attachment.html>

Reply by email

patspiper
to Fabio Luis Girardi
Fabio Luis Girardi wrote 21 lines
Hi all! I started the TDBCtrlGrid implementation some days ago. At this point, I don't know if I'm doing some mistake or if Lazarus has a bug. The problem is that I can't put any controls on TDBCtrlGrid area, but I can put controls with csReplicatable in ControlStyle inside a "RowPanel" (TDBCtrlGridRow class) that is a control that will be used to draw rows, BUT LAZARUS don't do this!! TDBCtrlGrid is created with ControlStyle := [csOpaque, csDoubleClicks]; and TDBCtrlGridRow is created with ControlStyle := [csAcceptsControls, csCaptureMouse, csClickEvents, csDoubleClicks, csOpaque, csReplicatable]; Logically, the row panel must accept controls, but TDBCtrlGrid NOR TDBCtrlGridRow accepts controls.

Add a (protected) method to your class:

     function ChildClassAllowed(ChildClass: TClass): boolean; override;

and set its result to true if you want to allow the ChildClass to be dropped on your component.

Stephano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140222/a2b79838/attachment.html>

Reply by email

Fabio Luis Girardi
to patspiper

No... this don't work too. Controls still using form1 as parent, not rowpanel. :(

"patspiper" wrote 39 lines
On 22/02/14 02:50, Fabio Luis Girardi wrote: Hi all! I started the TDBCtrlGrid implementation some days ago. At this point, I don't know if I'm doing some mistake or if Lazarus has a bug. The problem is that I can't put any controls on TDBCtrlGrid area, but I can put controls with csReplicatable in ControlStyle inside a "RowPanel" (TDBCtrlGridRow class) that is a control that will be used to draw rows, BUT LAZARUS don't do this!! TDBCtrlGrid is created with ControlStyle := [csOpaque, csDoubleClicks]; and TDBCtrlGridRow is created with ControlStyle := [csAcceptsControls, csCaptureMouse, csClickEvents, csDoubleClicks, csOpaque, csReplicatable]; Logically, the row panel must accept controls, but TDBCtrlGrid NOR TDBCtrlGridRow accepts controls. Add a (protected) method to your class: function ChildClassAllowed(ChildClass: TClass): boolean; override; and set its result to true if you want to allow the ChildClass to be dropped on your component. Stephano -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140222/6e9477c3/attachment.html> -------------- next part --------------
A non-text attachment was scrubbed...
Name: Captura de tela de 2014-02-22 09:42:58.png
Type: image/png
Size: 4279 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140222/6e9477c3/attachment.png>

Reply by email

Fabio Luis Girardi
to Fabio Luis Girardi

A mode detailed explanation....

2014-02-22 9:44 GMT-03:00 Fabio Luis Girardi :

Show quoted text 46 lines
No... this don't work too. Controls still using form1 as parent, not rowpanel. :( Em 22/02/2014 05:52, "patspiper" escreveu: > On 22/02/14 02:50, Fabio Luis Girardi wrote: > > Hi all! > > I started the TDBCtrlGrid implementation some days ago. At this point, > I don't know if I'm doing some mistake or if Lazarus has a bug. The problem > is that I can't put any controls on TDBCtrlGrid area, but I can put > controls with csReplicatable in ControlStyle inside a "RowPanel" > (TDBCtrlGridRow class) that is a control that will be used to draw rows, > BUT LAZARUS don't do this!! > > TDBCtrlGrid is created with > > ControlStyle := [csOpaque, csDoubleClicks]; > > and TDBCtrlGridRow is created with > > ControlStyle := [csAcceptsControls, csCaptureMouse, csClickEvents, > csDoubleClicks, csOpaque, csReplicatable]; > > > Logically, the row panel must accept controls, but TDBCtrlGrid NOR > TDBCtrlGridRow accepts controls. > > > Add a (protected) method to your class: > function ChildClassAllowed(ChildClass: TClass): boolean; override; > and set its result to true if you want to allow the ChildClass to be > dropped on your component. > > Stephano > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > >
The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140222/69d4f08f/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: text5294.png Type: image/png Size: 48142 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140222/69d4f08f/attachment-0001.png>

Reply by email

Fabio Luis Girardi
to patspiper

If I try put a new control in the row panel of my control, lazarus always sets form1 as the parent of this new control instead of my control or the row panel inside of my control.

Fabio Luis Girardi wrote
A mode detailed explanation....

[snip...]

Maybe the detailed explanation is not enough. What is Lazarus not doing?

Stephano

Reply by email

Mattias Gaertner
to patspiper: Add a (protected) method to your class: function ChildClassAllowed(ChildClass: TClass):…
Show quoted text 19 lines
patspiper hat am 22. Februar 2014 um 09:51 geschrieben: On 22/02/14 02:50, Fabio Luis Girardi wrote: [...] I started the TDBCtrlGrid implementation some days ago. At this point, I don't know if I'm doing some mistake or if Lazarus has a bug. The problem is that I can't put any controls on TDBCtrlGrid area, but I can put controls with csReplicatable in ControlStyle inside a "RowPanel" (TDBCtrlGridRow class) that is a control that will be used to draw rows, BUT LAZARUS don't do this!! TDBCtrlGrid is created with? ControlStyle := [csOpaque, csDoubleClicks]; and TDBCtrlGridRow is created with ControlStyle := [csAcceptsControls, csCaptureMouse, csClickEvents, ? ? csDoubleClicks, csOpaque, csReplicatable];

What do you use as ancestor?
You probably you need to use TCustomControl.

Show quoted text 9 lines
Logically, the row panel must accept controls, but TDBCtrlGrid NOR TDBCtrlGridRow accepts controls. Add a (protected) method to your class: ??? function ChildClassAllowed(ChildClass: TClass): boolean; override; and set its result to true if you want to allow the ChildClass to be dropped on your component.

This function is needed to limit the allowed classes. By default any class is allowed.
But only a few classes implements adding child controls. For example TCustomControl.

Mattias

Reply by email