Einzelnen Beitrag anzeigen

owolicious

Registriert seit: 14. Feb 2007
38 Beiträge
 
#10

Re: Selected = False wenn Click außerhalb Komponente

  Alt 15. Feb 2007, 17:03
also erstmal vielen dank für eure hilfe

also ich habs mal so gemacht aber leider passiert nix beim klicken

Delphi-Quellcode:
interface

uses
  SysUtils, Classes, Controls, ExtCtrls, Graphics, Messages;

type
  TShapeType = (stRechteck, stDreieck, stProzess);

  TShape1 = class(TShape)
  private
    { Private declarations }
    FShape : TShapeType;
    FCaption : String;
    FSelected : Boolean;

    rx, ry,
    oH, oW,
    oL, oT : Integer;

    procedure SetShape(Value : TShapeType);
    procedure SetCaption(Value : String);
    procedure SetSelection(Value : Boolean);
  protected
    { Protected declarations }
     protected procedure Paint();override;
     protected procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override;
     protected procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
     protected procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override;
  public
    { Public declarations }
  published
    { Published declarations }
    property Shape: TShapeType read FShape write SetShape;
    property Caption: String read FCaption write SetCaption;
    property Selected: Boolean read FSelected write SetSelection;

  end;

type TMyShape = class(TWinControl)
  Shape : TShape1;
       procedure Exit(var msg:TMessage);message cm_exit;
       procedure Button(var msg:TMessage);message wm_lbuttondown;
       constructor create(Aowner:Tcomponent);override;
       destructor destroy;
end;
procedure Register;

implementation

constructor TMyShape.create;
begin
  inherited create(Aowner);
  shape:=Tshape1.Create(self);
  shape.Parent:=self;
  shape.Enabled:=false;
  self.TabStop:=true;
end;

destructor TMyShape.destroy;
begin
  shape.Free;
  inherited;
end;

procedure TMyShape.Exit(var msg:TMessage);
begin
  self.Shape.Selected := false;
end;

procedure TMyShape.Button(var msg:TMessage);
begin
  self.Shape.Selected := true;
end;
  Mit Zitat antworten Zitat