Recent

Author Topic: WindowProc Subclassing  (Read 6697 times)

schu-r

  • Newbie
  • Posts: 3
WindowProc Subclassing
« on: August 08, 2006, 01:55:57 pm »
Hi

I Used to Subclass WindowProc for some Controls in Delphi to Write my own WindowHandler (of course I called the Base Window Handler after it) just to react on some Windowmessages.

But in Lazarus i cannot change the WindowProc Handler.


Is there a different Way to get to the window Messages of an individual Control?

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
RE: WindowProc Subclassing
« Reply #1 on: August 08, 2006, 02:36:56 pm »
You still can subclass the window procedure, using Windows.SetWindowLong.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
RE: WindowProc Subclassing
« Reply #2 on: August 08, 2006, 09:21:25 pm »
You can just override the default WindowProc, like this, on your TForm window:

  TMainWindow = class(TForm)
     ......
  public
{$IFDEF Win32}
    procedure WndProc(var Message : TMessage); override;
{$ENDIF}
  end;

schu-r

  • Newbie
  • Posts: 3
RE: WindowProc Subclassing
« Reply #3 on: August 09, 2006, 02:25:54 pm »
I need to set them at Runtime. Because I look at the Controls of a Form and then I decide which Controls to subclass. The code Searches all the Controls and Subclasses them.
This is a kind of LayoutManager similar to Java. It works so far in Delphi (can change the Look and Feel and even the behaviour of some Fields).

 

TinyPortal © 2005-2018