Solved

MouseWhell Event in Class TFrame

Posted on 2008-10-08
39
1,045 Views
Last Modified: 2012-05-05
My class is a decendant of TFrame, I want to use the Mouse wheel event,
actually this code does not work ... I found it on EE.

do I have to assign the MouseWhell event to my functions ?
function TClientFrame.DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean;
begin
    inherited DoMouseWheelDown(Shift, MousePos);
    Result := False;
    // My code here for own action...
    DisplayText(7, 'WheelDown');
end;
 
function TClientFrame.DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean;
begin
    inherited DoMouseWheelUp(Shift, MousePos);
    Result := False;
    // My code here for own action...
    DisplayText(7, 'WheelUp');
end ;

Open in new window

0
Comment
Question by:BdLm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 16
  • 14
  • 9
39 Comments
 
LVL 27

Assisted Solution

by:BigRat
BigRat earned 150 total points
ID: 22667868
You need to assign the properties OnMouseWheelDown and OnMouseWheelUp with your two procedures, possibly in the constructor. These properties are called when the events occur (see also Delphi help on TFrame's events)
0
 
LVL 8

Author Comment

by:BdLm
ID: 22668125
what line of code i should add to the constructor ?


constructor TClientFrame.create;
begin
     inherited create;

     OnMouseWheelDown :=

end;
0
 
LVL 37

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 350 total points
ID: 22668664
funny thing is that mousewheelup or down doesn't get called in the Frames on the Form

I attached an event to the Form for up and down.
Then tried to find if a frame is at the mouse cursor pos.
If so, call the event of frame
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Unit2, StdCtrls;
 
type
  TForm1 = class(TForm)
    TFrame21: TFrame2;
    Frame21: TFrame2;
    Button1: TButton;
    procedure FormMouseWheelDown(Sender: TObject; Shift: TShiftState;
      MousePos: TPoint; var Handled: Boolean);
    procedure FormMouseWheelUp(Sender: TObject; Shift: TShiftState;
      MousePos: TPoint; var Handled: Boolean);
  private
    function FrameFrom(APos: TPoint): TFrame;
  public
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
{ TForm1 }
 
function TForm1.FrameFrom(APos: TPoint): TFrame;
var aControl: TWinControl;
begin
  Result := nil;
  aControl := FindVCLWindow(APos);
  while (aControl <> nil) and not (aControl is TFrame) do
    aControl := aControl.Parent;
  if aControl <> nil then
    Result := TFrame(aControl);
end;
 
procedure TForm1.FormMouseWheelDown(Sender: TObject; Shift: TShiftState;
  MousePos: TPoint; var Handled: Boolean);
var fra: TFrame;
begin
  fra := FrameFrom(MousePos);
  if Assigned(fra) then
    TFrame2(fra).FrameOnMouseWheelDown(Sender, Shift, MousePos, Handled);
end;
 
procedure TForm1.FormMouseWheelUp(Sender: TObject; Shift: TShiftState;
  MousePos: TPoint; var Handled: Boolean);
var fra: TFrame;
begin
  fra := FrameFrom(MousePos);
  if Assigned(fra) then
    TFrame2(fra).FrameOnMouseWheelUp(Sender, Shift, MousePos, Handled);
end;
 
end.
 
--- unit2 ---
unit Unit2;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, ExtCtrls;
 
type
  TFrame2 = class(TFrame)
    Panel1: TPanel;
  private
  protected
  public
    procedure FrameOnMouseWheelUp(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
    procedure FrameOnMouseWheelDown(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
  end;
 
implementation
 
{$R *.dfm}
 
{ TFrame2 }
 
procedure TFrame2.FrameOnMouseWheelUp(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
begin
  Panel1.Caption := 'MouseWheelUp';
end;
 
procedure TFrame2.FrameOnMouseWheelDown(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
begin
  Panel1.Caption := 'MouseWheelDown';
end;
 
end.

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

Expert Comment

by:BigRat
ID: 22669196
constructor TClientFrame.create;
begin
     inherited create;

     OnMouseWheelDown :=DoMouseWheelDown;

end;
0
 
LVL 27

Assisted Solution

by:BigRat
BigRat earned 150 total points
ID: 22669218
>>funny thing is that mousewheelup or down doesn't get called in the Frames on the Form

Geert_Gruwez, I don't see anywhere in your code where you assign anthing to the properties. Please note that the properties are NOT procedures which one overrides, but variables which must be assigned to. You should be aboe to assign then in the object inspector just like other events.
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22669248
ok, but they don't get called ... even if you assign them
neither does the MouseWheelHandler procedure
0
 
LVL 27

Expert Comment

by:BigRat
ID: 22669329
What version of Delphi are you using?

I have just put a handler in my test app (derived from TForm) and displayed a message, left the handling to the TMemo's scrolling and everything worked OK. My Delphi is 5 Standard.
0
 
LVL 27

Assisted Solution

by:BigRat
BigRat earned 150 total points
ID: 22669510
BdLm, I think I see what Geert is driving at. It seems (from the Delphi help) that the MouseWheel events are not called from a Frame since the TWinControl base class checks to see whether the component is in a form and if so calls the handler BEFORE calling the components handler (for example in a TMemo in the frame/form). If the component is NOT in a form (although the fame may well be) it just calls the handler using the Perform procedure. Since the Frame is between the component and the form the frame's handlers don't get called.
   What Geert has done, in his code, is to catch the mouse wheel events in the form, find out in which frame they originated and calls the handler if assigned.
   I suggest you copy his code into your application.
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22669537
Hey BigRat,
you grasped my solution,
but I see looking at your solution, i missed out something

I added a Listbox and Memo and they aren't scrolling
I'm trying to solve this your way,
maybe we can end up with a combined solution ...

PS: Delphi 7 Architect, for this problem
0
 
LVL 8

Author Comment

by:BdLm
ID: 22669575
hi,

in my frame there are scrollbars at the edge and a paintbox in the center of the frame, covering almost the complete area,
the frame has mouse wheel events but the paintbox does not have one.
frame ??

best
0
 
LVL 27

Expert Comment

by:BigRat
ID: 22670224
Geert: I don't understand your problem. Both TListBox and TMemo are wrappers for the underlying Windows objects, who both have a hidden ScrollBar object associated with them. These are MouseWheel enabled, that is if a MouseWheel message arrives they send it to the Scoller if it is enabled. What you might have done is to have set Handled to true (I have in my test explicitly set it to false) in which case the subclassing in TWinControl won't send the message to the undelying Windows object.
0
 
LVL 8

Author Comment

by:BdLm
ID: 22671083
what about my paintbox .....   .-)
0
 
LVL 37

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 350 total points
ID: 22676061
no mousewheel events come through from the form to the frame.

Only the focused control gets mousewheel events,
I was looking to give the control at the mousepos the focus first and then process the mousewheel message
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22676127
the paintbox indeed doesn't have these events as it is a graphic control

what do you want to happen with the paintbox ?
and how do the scrollbars interact with the paintbox ?
are these scrollbars part of a TScrollbox ?

0
 
LVL 8

Author Comment

by:BdLm
ID: 22676298
I put that code to my class, but no mouse wheel event has been triggert....

In this Frame I have scrolllbars to move my image in the paintbox, with the mouse wheel I want to realize a Image zoom function like eg. in PaintShop used......

Furthermore I put menue on this Frame and a Status Bar to allow the user to start a lot of image proceesing functions .....


procedure TClientFrame.FrameMouseWheel(Sender: TObject;
  Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
  var Handled: Boolean);
begin
    DisplayText(7, 'Wheel...');
end;
 
procedure TClientFrame.FrameMouseWheelDown(Sender: TObject;
  Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
begin
   DisplayText(7, 'Wheeldown');
end;
 
procedure TClientFrame.FrameMouseWheelUp(Sender: TObject;
  Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
begin
   DisplayText(7, 'Wheelup');
end;

Open in new window

0
 
LVL 37

Accepted Solution

by:
Geert Gruwez earned 350 total points
ID: 22676719
wow man, found a solution
I created a frame with a scrollbox, in it a paintbox and a panel
the panel is just for displaying the zoomfactor (which i didn't implement)

when the mouse is above the Paintbox and the wheel is scrolled up or down,
the zoomfactor is adjusted

when the mouse is next to the Paintbox, but in the scrollbox
the scrollbox is scrolled up or down

is this the behaviour your looking for ?
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Unit2;
 
type
  TForm1 = class(TForm)
    Frame1: TFrame2;
  public
    procedure MouseWheelHandler(var Msg: TMessage); override;
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.MouseWheelHandler(var Msg: TMessage);
var
  aControl: TControl;
  wControl: TWinControl;
  P: TPoint;
begin
  P := ScreenToClient(Point(TWMMouseWheel(Msg).XPos, TWMMouseWheel(Msg).YPos));
  // Find deepest control (first Non Wincontrol then WinControl)
  wControl := Self;
  repeat
    aControl := wControl.ControlAtPos(P, False, False);
    if aControl = nil then
    begin
      aControl := wControl.ControlAtPos(P, False, True);
      wControl := TWinControl(aControl);
    end else
      wControl := nil;
  until ((aControl = nil) and (wControl = nil)) or (aControl is TFrame);
  if (aControl <> nil) and (aControl is TFrame) then
    TFrame(aControl).MouseWheelHandler(Msg)
  else
    inherited MouseWheelHandler(Msg);
end;
 
end.
 
--DFM Form1--
object Form1: TForm1
  Left = 26
  Top = 233
  Width = 1109
  Height = 839
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  inline TFrame21: TFrame2
    Left = 45
    Top = 40
    Width = 666
    Height = 494
    TabOrder = 0
  end
end
 
----
unit Unit2;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, ExtCtrls, StdCtrls, Grids;
 
type
  TFrame2 = class(TFrame)
    ScrollBox1: TScrollBox;
    PaintBox1: TPaintBox;
    Panel3: TPanel;
    Bevel1: TBevel;
    procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    fDrawing: boolean;
    fZoom: Integer;
  protected
  public
    constructor Create(AOwner: TComponent); override;
    procedure MouseWheelHandler(var Msg: TMessage); override;
  end;
 
implementation
 
{$R *.dfm}
 
{ TFrame2 }
 
constructor TFrame2.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  fDrawing := False;
  fZoom := 100;
  Panel3.Caption := IntToStr(fZoom);
end;
 
procedure TFrame2.MouseWheelHandler(var Msg: TMessage);
var
  aControl, xControl: TControl;
  wControl: TWinControl;
  P: TPoint;
  Handled: boolean;
begin
  P := ScreenToClient(Point(TWMMouseWheel(Msg).XPos, TWMMouseWheel(Msg).YPos));
  // Find deepest control (first Non Wincontrol then WinControl)
  // Controls are nested within each other
  // lowest is paintbox (or any graphic control like TLabel)
  wControl := Self;
  aControl := nil;
  repeat
    xControl := aControl;
    aControl := wControl.ControlAtPos(P, False, False);
    if aControl = nil then
    begin
      aControl := wControl.ControlAtPos(P, False, True);
      wControl := TWinControl(aControl);
    end else
      wControl := nil;
  until (aControl = nil) or not (aControl is TWinControl) or ((aControl is TWinControl) and (TWinControl(aControl).ControlCount = 0));
  Msg.Result := 1;
  Handled := False;
  if aControl <> nil then
  begin
    if (aControl = PaintBox1) and not Handled then
    begin
      if TWMMouseWheel(Msg).WheelDelta > 0 then
      begin
        Inc(fZoom);
        Handled := True;
      end else if TWMMouseWheel(Msg).WheelDelta < 0 then
      begin
        Dec(fZoom);
        Handled := True;
      end;
      Panel3.Caption := IntToStr(fZoom);
    end;
  end;
  if xControl <> nil then
  begin
    if (xControl = Scrollbox1) and not Handled then
    begin
      if TWMMouseWheel(Msg).WheelDelta > 0 then
      begin
        with ScrollBox1.VertScrollBar do Position := Position - 1;
        //Handled := True;
      end else if TWMMouseWheel(Msg).WheelDelta < 0 then
      begin
        with ScrollBox1.VertScrollBar do  Position := Position + 1;
        //Handled := True;
      end;
    end;
  end;
end;
 
procedure TFrame2.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  fDrawing := True;
  PaintBox1.Canvas.MoveTo(X, Y);
end;
 
procedure TFrame2.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin
  if fDrawing then
    PaintBox1.Canvas.LineTo(X, Y);
end;
 
procedure TFrame2.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if fDrawing then
    PaintBox1.Canvas.LineTo(X, Y);
  fDrawing := False;
end;
 
end.
 
-- dfm unit 2 --
object Frame2: TFrame2
  Left = 0
  Top = 0
  Width = 666
  Height = 494
  TabOrder = 0
  object ScrollBox1: TScrollBox
    Left = 0
    Top = 0
    Width = 561
    Height = 386
    HorzScrollBar.Increment = 48
    HorzScrollBar.Range = 1000
    VertScrollBar.Range = 1000
    AutoScroll = False
    TabOrder = 0
    object Bevel1: TBevel
      Left = 85
      Top = 35
      Width = 316
      Height = 286
    end
    object PaintBox1: TPaintBox
      Left = 85
      Top = 35
      Width = 316
      Height = 286
      OnMouseDown = PaintBox1MouseDown
      OnMouseMove = PaintBox1MouseMove
      OnMouseUp = PaintBox1MouseUp
    end
    object Panel3: TPanel
      Left = 15
      Top = 125
      Width = 56
      Height = 91
      Caption = '0'
      TabOrder = 0
    end
  end
end

Open in new window

0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22676722
oh yeah, you can draw lines in the paintbox too :)
0
 
LVL 8

Author Comment

by:BdLm
ID: 22676754
thanks a lot,
---------------------------------------------------------------------------------------
your code procedure TFrame2.MouseWheelHandler(var Msg: TMessage);
my code :  procedure TClientFrame.FrameMouseWheelDown(Sender: TObject;
  Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
----------------------------------------------------------------------------------------

I need a bit Time to think on your solution, how  to transfer it to my class.
0
 
LVL 27

Expert Comment

by:BigRat
ID: 22676965
Geert: Handling the mouse wheel message directly, instead of letting TWinControl do it (where it makes this decision about Form or Frame), is basically a good idea. It would howver be better to call the appropiate properties of the objects under the mouse position instead of explicitly testing against known objects.  

Furthermore the TWMMouseWheel structure does not exist in my Delphi 5, so I doubt it will be in Delphi 4.
However it looks like this :-

type
  TWMMouseWheel = RECORD
     Msg: Cardinal;
     fwKeys : WORD;
     zDelta : Smallint;
     CASE Integer OF
     0: (xPos: Smallint; yPos: Smallint);
     1: (ptPos: TSmallPoint; Result: Longint);
  END;
 
0
 
LVL 8

Author Comment

by:BdLm
ID: 22677073
The object TFrame has a Mousewheel property/event.
If I generate the code see   procedure TClientFrame.FrameMouseWheel  .....  above,
this code in the class is not called.
The PaintBox is ontop,  algn:=atClient of the Frame Surface , the Mouseclicks are taken from the PaintBox for several actions,
but where can I get the Mousewheel move most easily
0
 
LVL 37

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 350 total points
ID: 22677225
>>BigRat
Put a Frame, in it a Scrollbox, in that a Paintbox

Assign events to the MouseWheelDown and MouseWheelUp of both Scrollbox and PaintBox

for TPaintBox these events are protected so you need to subclass

(no i didn't mistype the TMyPainBox, as this is a real Pain ;-)  )

Put breakpoints in the event handlers
and the debugger will never stop ... (at least not in Delphi 7 or in my app)


type
  TMyPainBox = class(TPaintBox) end;
 
  TFrame2 = class(TFrame)
    procedure ScrollBox1MouseWheelDown(Sender: TObject; Shift: TShiftState;
      MousePos: TPoint; var Handled: Boolean);
    procedure ScrollBox1MouseWheelUp(Sender: TObject; Shift: TShiftState;
      MousePos: TPoint; var Handled: Boolean);
   public
    constructor Create(AOwner: TComponent); override;
    procedure PaintWheelDown(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
    procedure PaintWheelUp(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
  end;
 
constructor TFrame2.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  TMyPainBox(PaintBox1).OnMouseWheelDown := PaintWheelDown;
  TMyPainBox(PaintBox1).OnMouseWheelUp := PaintWheelUp;
end;

Open in new window

0
 
LVL 8

Author Comment

by:BdLm
ID: 22678176
do I have to add code:

TMyPainBox = class(TPaintBox)
 
  property OnMouseWheelDown .....  
end;


0
 
LVL 8

Author Comment

by:BdLm
ID: 22678191
BTW:  I do not use a scrollbox .....
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22678202
it was just a test for BigRat,
in my comment #22678176 i was trying to explain what i see as your problem :)
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22678210
you mentioned scrollbars , so i assumed they were of a scrollbox in which you had put the paintbox

are these scrollbars of the Frame ?
0
 
LVL 27

Expert Comment

by:BigRat
ID: 22678249
In my TPaintBox (Delphi 5) there are no such events. Note that PaintBox is inherited from TControl and NOT TWinControl, which is the one that causes all the problems.

BdLm: The only way to do it is as Geert first suggested. Your going to have to catch the mouse wheel in the Form, and look for the control under the mouse. If it's your frame you call the handler there.
0
 
LVL 8

Author Comment

by:BdLm
ID: 22678252
I actually I only use scrollbars (position is used to calc. the image size, viewport, .......)
0
 
LVL 8

Author Comment

by:BdLm
ID: 22678417
@bigrat:  why do I have to take the event from the underlying form and can not use the
               event in the frame? I found this one  :-(
   
               why do I have to look for the sending control, can I not directly assign
               in the underlying Mousewheelfunction the Mousewheelfct of the frame?

@geert: I use the frame like a componet on serval forms, your solution means I have to add this code to every form.  

0
 
LVL 27

Expert Comment

by:BigRat
ID: 22679125
BdLm: 1) the event does not appear in the Frame. It must be caught in the Form and applied to the Frame (if you want it there) or to the corresponding object.
    2) If one has, say, two panels on the frame to which panel should the mouse wheel apply?

Geert had provided a general solution to the problem. You can of course call the handler in the Frame if you want.
0
 
LVL 37

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 350 total points
ID: 22679123
@BdLm:
only the form receives the MouseWheelEvents
so yes, you will have to add the code to the Forms :(

allthough, there are probably some easier solutions
like form inheritance

are the forms descendants from TForm ?
Create a new form class
and let your forms descend from that new form class ...


Like below i created a TBdLmForm with the handler in place
(you can't go running around in your company with a TGeertForm eh ?)

it is possible you may need to edit the .DFM file (with a text editor like notepad) for this to work

you need to chance the text .DFM from

object Form1: TForm1
 ...

to

inherited Form1: TForm1
 ...

you only need to replace the word object with inherited
unit BdLmSolutions;
 
type
  TBdLmForm = class(TForm)
  public
    procedure MouseWheelHandler(var Msg: TMessage); override;
  end;
 
procedure TBdLmForm.MouseWheelHandler(var Msg: TMessage);
var
  aControl: TControl;
  wControl: TWinControl;
  P: TPoint;
begin
  P := ScreenToClient(Point(TWMMouseWheel(Msg).XPos, TWMMouseWheel(Msg).YPos));
  // Find deepest control (first Non Wincontrol then WinControl)
  wControl := Self;
  repeat
    aControl := wControl.ControlAtPos(P, False, False);
    if aControl = nil then
    begin
      aControl := wControl.ControlAtPos(P, False, True);
      wControl := TWinControl(aControl);
    end else
      wControl := nil;
  until ((aControl = nil) and (wControl = nil)) or (aControl is TFrame);
  if (aControl <> nil) and (aControl is TFrame) then
    TFrame(aControl).MouseWheelHandler(Msg)
  else
    inherited MouseWheelHandler(Msg);
end;
 
unit Unit1;
 
type
  TForm1 = class(TBdLmForm)
    Frame1: TFrame2;
  end;

Open in new window

0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22679172
my 2.3 cents

I inherit all my forms from my own created form class
If i need to add functionality to *ALL* in *ALL* applications
this is just a 1 time job and recompile all apps :)

Once you get used to Form inheritance, you can't live without it  :-)
 
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22679187
the drawback offcourse.
If you program 1 bug in the base class, you get it all over for free :-(
0
 
LVL 8

Author Comment

by:BdLm
ID: 22679248
--> Once you get used to Form inheritance, you can't live without it  :-)

did this not slow down your applications as you install functions you do not need all the time ?
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22679261
Well i have a few types of form classes ...
Depending on what type of form i need
0
 
LVL 8

Author Comment

by:BdLm
ID: 22681259
I did not tell my form is a midchild ........,
 do I have to piut the MouseWheelHandler
in the midparent, pass the msg to the mdichild and then to the frame inside the mdichipd .....
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22684619
i don't think it should matter

if you get a event in the mdichild form for the mousewheel then it's the same
as for normal forms

if not let me know and i'll look into it
0
 
LVL 37

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 350 total points
ID: 22684627
form inheritance for mdi child is especially usefull
as you probably have an event OnClose in each MdiForm where you set Action := caFree

type
  TBdLmForm = class(TForm)
  protected
    procedure DoClose(var Action: TCloseAction); override;
  end;

procedure TBdLmForm.DoClose(var Action: TCloseAction);
begin
  Action := caFree;
  inherited DoClose(Action);
end;

sets the Action to caFree by Default
and in the event of an MdiChild you could still set it to caNone ...
0
 
LVL 8

Author Comment

by:BdLm
ID: 22685569
Hi,

i can get the mouse wheel in a Form meanwhile by several methodes   :-)
I made some short demo code.

I my large application MDI I failed to run any of the solutions above,
it is my turn to find the root cause.
I#ll accept your both support once I solved my task,
 If I 'll find something I#ll put it here, thanks for your help so far.

Habe a nice week end

Best
Bdlm
0
 
LVL 8

Author Closing Comment

by:BdLm
ID: 31504178
lot of good code work done :-)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question