Sign in Join

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

Mailing lists / lazarus / 2012-07

Change the default name of an event handler

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Yann Bat

Hello,

I have created a new component TZModule that inherits from TDataModule. I have created a new entry in File > New that permits to create a new TZModule. When I add a new TZmodule to my project and I double click on it, Lazarus creates, as expected, a new event handler for OnCreate called TZModule1.DataModuleCreate.

How can I change the default name from DataModuleCreate to ZModuleCreate ?

When I create a new TZModule it's small. Can I change the default size of newly created TZModule ?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120726/7e2670ee/attachment.html>

Reply by email

Yann Bat
to Yann Bat

Don't no if it's because of my poor english or because of my questions are stupid but I didn't get much answers... :-(

How can I change the default name from DataModuleCreate to ZModuleCreate ?

I suppose that the default name of an event handler is built from the name of the class that introduced the event so may be there is no simple way to change that...

When I create a new TZModule it's small. Can I change the default size of newly created TZModule ?

I found that this can be done overriding Create to set a value to DesignSize.

constructor TZModule.Create(TheOwner: TComponent);
var
  Size : TPoint;
begin
  inherited Create(TheOwner);
  Size.X := 320;
  Size.Y := 200;
  DesignSize := Size;
end;

May this can be done in the default constructor of TDataModule ? Without that the window representing a newly created TDataModule in the IDE is so small that it needs manual resizing before any use. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120730/0b8abe78/attachment.html>

Reply by email

Mattias Gaertner
to Yann Bat
Show quoted text 9 lines
Don't no if it's because of my poor english or because of my questions are stupid but I didn't get much answers... :-( How can I change the default name from DataModuleCreate to ZModuleCreate ? > I suppose that the default name of an event handler is built from the name of the class that introduced the event so may be there is no simple way to change that...

The default component name is fetched from the
TProjectFileDescriptor.DefaultResourceName.

Show quoted text 21 lines
> When I create a new TZModule it's small. Can I change the default size of > newly created TZModule ? I found that this can be done overriding Create to set a value to DesignSize. constructor TZModule.Create(TheOwner: TComponent); var Size : TPoint; begin inherited Create(TheOwner); Size.X := 320; Size.Y := 200; DesignSize := Size; end; May this can be done in the default constructor of TDataModule ? Without that the window representing a newly created TDataModule in the IDE is so small that it needs manual resizing before any use.

Yes. Feel free to propose a change to the FPC bug tracker. I increased the minimum size in the IDE for TDataModule to 150x150.

Mattias

Reply by email

Yann Bat
to Mattias Gaertner
The default component name is fetched from the TProjectFileDescriptor.DefaultResourceName.

Thanks. But it seems that creating a new TDataModule descendant is harder than creating normal components (I have problems with streaming of events). So I change my mind. I will use normal data module with special component on it.

I increased the minimum size in the IDE for TDataModule to 150x150.

Thanks again. This is a very good point because, with my KDE desktop, the window was so small that the window close button and the window menu button are separated by a title bar of 3 or 4 pixels only : unreadable and undragable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120802/64eb864e/attachment.html>

Reply by email