home *** CD-ROM | disk | FTP | other *** search
- unit MemoImpl;
-
- interface
-
- uses
- Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
- ComServ, StdVCL, AXCtrls, DelC_TLB;
-
- type
- TMemoX = class(TActiveXControl, IMemoX)
- private
- { Private declarations }
- FDelphiControl: TMemo;
- FEvents: IMemoXEvents;
- procedure ChangeEvent(Sender: TObject);
- procedure ClickEvent(Sender: TObject);
- procedure DblClickEvent(Sender: TObject);
- procedure KeyPressEvent(Sender: TObject; var Key: Char);
- protected
- { Protected declarations }
- procedure InitializeControl; override;
- procedure EventSinkChanged(const EventSink: IUnknown); override;
- procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
- function Get_Alignment: TxAlignment; safecall;
- function Get_BorderStyle: TxBorderStyle; safecall;
- function Get_Color: TColor; safecall;
- function Get_Ctl3D: WordBool; safecall;
- function Get_Cursor: Smallint; safecall;
- function Get_DragCursor: Smallint; safecall;
- function Get_DragMode: TxDragMode; safecall;
- function Get_Enabled: WordBool; safecall;
- function Get_Font: Font; safecall;
- function Get_HideSelection: WordBool; safecall;
- function Get_ImeMode: TxImeMode; safecall;
- function Get_ImeName: WideString; safecall;
- function Get_Lines: IStrings; safecall;
- function Get_MaxLength: Integer; safecall;
- function Get_Modified: WordBool; safecall;
- function Get_OEMConvert: WordBool; safecall;
- function Get_ParentColor: WordBool; safecall;
- function Get_ParentCtl3D: WordBool; safecall;
- function Get_ReadOnly: WordBool; safecall;
- function Get_ScrollBars: TxScrollStyle; safecall;
- function Get_SelLength: Integer; safecall;
- function Get_SelStart: Integer; safecall;
- function Get_SelText: WideString; safecall;
- function Get_Text: WideString; safecall;
- function Get_Visible: WordBool; safecall;
- function Get_WantReturns: WordBool; safecall;
- function Get_WantTabs: WordBool; safecall;
- function Get_WordWrap: WordBool; safecall;
- procedure AboutBox; safecall;
- procedure Clear; safecall;
- procedure ClearSelection; safecall;
- procedure CopyToClipboard; safecall;
- procedure CutToClipboard; safecall;
- procedure PasteFromClipboard; safecall;
- procedure SelectAll; safecall;
- procedure Set_Alignment(Value: TxAlignment); safecall;
- procedure Set_BorderStyle(Value: TxBorderStyle); safecall;
- procedure Set_Color(Value: TColor); safecall;
- procedure Set_Ctl3D(Value: WordBool); safecall;
- procedure Set_Cursor(Value: Smallint); safecall;
- procedure Set_DragCursor(Value: Smallint); safecall;
- procedure Set_DragMode(Value: TxDragMode); safecall;
- procedure Set_Enabled(Value: WordBool); safecall;
- procedure Set_Font(const Value: Font); safecall;
- procedure Set_HideSelection(Value: WordBool); safecall;
- procedure Set_ImeMode(Value: TxImeMode); safecall;
- procedure Set_ImeName(const Value: WideString); safecall;
- procedure Set_Lines(const Value: IStrings); safecall;
- procedure Set_MaxLength(Value: Integer); safecall;
- procedure Set_Modified(Value: WordBool); safecall;
- procedure Set_OEMConvert(Value: WordBool); safecall;
- procedure Set_ParentColor(Value: WordBool); safecall;
- procedure Set_ParentCtl3D(Value: WordBool); safecall;
- procedure Set_ReadOnly(Value: WordBool); safecall;
- procedure Set_ScrollBars(Value: TxScrollStyle); safecall;
- procedure Set_SelLength(Value: Integer); safecall;
- procedure Set_SelStart(Value: Integer); safecall;
- procedure Set_SelText(const Value: WideString); safecall;
- procedure Set_Text(const Value: WideString); safecall;
- procedure Set_Visible(Value: WordBool); safecall;
- procedure Set_WantReturns(Value: WordBool); safecall;
- procedure Set_WantTabs(Value: WordBool); safecall;
- procedure Set_WordWrap(Value: WordBool); safecall;
- end;
-
- implementation
-
- uses About16;
-
- { TMemoX }
-
- procedure TMemoX.InitializeControl;
- begin
- FDelphiControl := Control as TMemo;
- FDelphiControl.OnChange := ChangeEvent;
- FDelphiControl.OnClick := ClickEvent;
- FDelphiControl.OnDblClick := DblClickEvent;
- FDelphiControl.OnKeyPress := KeyPressEvent;
- end;
-
- procedure TMemoX.EventSinkChanged(const EventSink: IUnknown);
- begin
- FEvents := EventSink as IMemoXEvents;
- end;
-
- procedure TMemoX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
- begin
- { Define property pages here. Property pages are defined by calling
- DefinePropertyPage with the class id of the page. For example,
- DefinePropertyPage(Class_MemoXPage); }
- end;
-
- function TMemoX.Get_Alignment: TxAlignment;
- begin
- Result := Ord(FDelphiControl.Alignment);
- end;
-
- function TMemoX.Get_BorderStyle: TxBorderStyle;
- begin
- Result := Ord(FDelphiControl.BorderStyle);
- end;
-
- function TMemoX.Get_Color: TColor;
- begin
- Result := FDelphiControl.Color;
- end;
-
- function TMemoX.Get_Ctl3D: WordBool;
- begin
- Result := FDelphiControl.Ctl3D;
- end;
-
- function TMemoX.Get_Cursor: Smallint;
- begin
- Result := Smallint(FDelphiControl.Cursor);
- end;
-
- function TMemoX.Get_DragCursor: Smallint;
- begin
- Result := Smallint(FDelphiControl.DragCursor);
- end;
-
- function TMemoX.Get_DragMode: TxDragMode;
- begin
- Result := Ord(FDelphiControl.DragMode);
- end;
-
- function TMemoX.Get_Enabled: WordBool;
- begin
- Result := FDelphiControl.Enabled;
- end;
-
- function TMemoX.Get_Font: Font;
- begin
- GetOleFont(FDelphiControl.Font, Result);
- end;
-
- function TMemoX.Get_HideSelection: WordBool;
- begin
- Result := FDelphiControl.HideSelection;
- end;
-
- function TMemoX.Get_ImeMode: TxImeMode;
- begin
- Result := Ord(FDelphiControl.ImeMode);
- end;
-
- function TMemoX.Get_ImeName: WideString;
- begin
- Result := WideString(FDelphiControl.ImeName);
- end;
-
- function TMemoX.Get_Lines: IStrings;
- begin
- GetOleStrings(FDelphiControl.Lines, Result);
- end;
-
- function TMemoX.Get_MaxLength: Integer;
- begin
- Result := FDelphiControl.MaxLength;
- end;
-
- function TMemoX.Get_Modified: WordBool;
- begin
- Result := FDelphiControl.Modified;
- end;
-
- function TMemoX.Get_OEMConvert: WordBool;
- begin
- Result := FDelphiControl.OEMConvert;
- end;
-
- function TMemoX.Get_ParentColor: WordBool;
- begin
- Result := FDelphiControl.ParentColor;
- end;
-
- function TMemoX.Get_ParentCtl3D: WordBool;
- begin
- Result := FDelphiControl.ParentCtl3D;
- end;
-
- function TMemoX.Get_ReadOnly: WordBool;
- begin
- Result := FDelphiControl.ReadOnly;
- end;
-
- function TMemoX.Get_ScrollBars: TxScrollStyle;
- begin
- Result := Ord(FDelphiControl.ScrollBars);
- end;
-
- function TMemoX.Get_SelLength: Integer;
- begin
- Result := FDelphiControl.SelLength;
- end;
-
- function TMemoX.Get_SelStart: Integer;
- begin
- Result := FDelphiControl.SelStart;
- end;
-
- function TMemoX.Get_SelText: WideString;
- begin
- Result := WideString(FDelphiControl.SelText);
- end;
-
- function TMemoX.Get_Text: WideString;
- begin
- Result := WideString(FDelphiControl.Text);
- end;
-
- function TMemoX.Get_Visible: WordBool;
- begin
- Result := FDelphiControl.Visible;
- end;
-
- function TMemoX.Get_WantReturns: WordBool;
- begin
- Result := FDelphiControl.WantReturns;
- end;
-
- function TMemoX.Get_WantTabs: WordBool;
- begin
- Result := FDelphiControl.WantTabs;
- end;
-
- function TMemoX.Get_WordWrap: WordBool;
- begin
- Result := FDelphiControl.WordWrap;
- end;
-
- procedure TMemoX.AboutBox;
- begin
- ShowMemoXAbout;
- end;
-
- procedure TMemoX.Clear;
- begin
-
- end;
-
- procedure TMemoX.ClearSelection;
- begin
-
- end;
-
- procedure TMemoX.CopyToClipboard;
- begin
-
- end;
-
- procedure TMemoX.CutToClipboard;
- begin
-
- end;
-
- procedure TMemoX.PasteFromClipboard;
- begin
-
- end;
-
- procedure TMemoX.SelectAll;
- begin
-
- end;
-
- procedure TMemoX.Set_Alignment(Value: TxAlignment);
- begin
- FDelphiControl.Alignment := TAlignment(Value);
- end;
-
- procedure TMemoX.Set_BorderStyle(Value: TxBorderStyle);
- begin
- FDelphiControl.BorderStyle := TBorderStyle(Value);
- end;
-
- procedure TMemoX.Set_Color(Value: TColor);
- begin
- FDelphiControl.Color := Value;
- end;
-
- procedure TMemoX.Set_Ctl3D(Value: WordBool);
- begin
- FDelphiControl.Ctl3D := Value;
- end;
-
- procedure TMemoX.Set_Cursor(Value: Smallint);
- begin
- FDelphiControl.Cursor := TCursor(Value);
- end;
-
- procedure TMemoX.Set_DragCursor(Value: Smallint);
- begin
- FDelphiControl.DragCursor := TCursor(Value);
- end;
-
- procedure TMemoX.Set_DragMode(Value: TxDragMode);
- begin
- FDelphiControl.DragMode := TDragMode(Value);
- end;
-
- procedure TMemoX.Set_Enabled(Value: WordBool);
- begin
- FDelphiControl.Enabled := Value;
- end;
-
- procedure TMemoX.Set_Font(const Value: Font);
- begin
- SetOleFont(FDelphiControl.Font, Value);
- end;
-
- procedure TMemoX.Set_HideSelection(Value: WordBool);
- begin
- FDelphiControl.HideSelection := Value;
- end;
-
- procedure TMemoX.Set_ImeMode(Value: TxImeMode);
- begin
- FDelphiControl.ImeMode := TImeMode(Value);
- end;
-
- procedure TMemoX.Set_ImeName(const Value: WideString);
- begin
- FDelphiControl.ImeName := TImeName(Value);
- end;
-
- procedure TMemoX.Set_Lines(const Value: IStrings);
- begin
- SetOleStrings(FDelphiControl.Lines, Value);
- end;
-
- procedure TMemoX.Set_MaxLength(Value: Integer);
- begin
- FDelphiControl.MaxLength := Value;
- end;
-
- procedure TMemoX.Set_Modified(Value: WordBool);
- begin
- FDelphiControl.Modified := Value;
- end;
-
- procedure TMemoX.Set_OEMConvert(Value: WordBool);
- begin
- FDelphiControl.OEMConvert := Value;
- end;
-
- procedure TMemoX.Set_ParentColor(Value: WordBool);
- begin
- FDelphiControl.ParentColor := Value;
- end;
-
- procedure TMemoX.Set_ParentCtl3D(Value: WordBool);
- begin
- FDelphiControl.ParentCtl3D := Value;
- end;
-
- procedure TMemoX.Set_ReadOnly(Value: WordBool);
- begin
- FDelphiControl.ReadOnly := Value;
- end;
-
- procedure TMemoX.Set_ScrollBars(Value: TxScrollStyle);
- begin
- FDelphiControl.ScrollBars := TScrollStyle(Value);
- end;
-
- procedure TMemoX.Set_SelLength(Value: Integer);
- begin
- FDelphiControl.SelLength := Value;
- end;
-
- procedure TMemoX.Set_SelStart(Value: Integer);
- begin
- FDelphiControl.SelStart := Value;
- end;
-
- procedure TMemoX.Set_SelText(const Value: WideString);
- begin
- FDelphiControl.SelText := String(Value);
- end;
-
- procedure TMemoX.Set_Text(const Value: WideString);
- begin
- FDelphiControl.Text := TCaption(Value);
- end;
-
- procedure TMemoX.Set_Visible(Value: WordBool);
- begin
- FDelphiControl.Visible := Value;
- end;
-
- procedure TMemoX.Set_WantReturns(Value: WordBool);
- begin
- FDelphiControl.WantReturns := Value;
- end;
-
- procedure TMemoX.Set_WantTabs(Value: WordBool);
- begin
- FDelphiControl.WantTabs := Value;
- end;
-
- procedure TMemoX.Set_WordWrap(Value: WordBool);
- begin
- FDelphiControl.WordWrap := Value;
- end;
-
- procedure TMemoX.ChangeEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnChange;
- end;
-
- procedure TMemoX.ClickEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnClick;
- end;
-
- procedure TMemoX.DblClickEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnDblClick;
- end;
-
- procedure TMemoX.KeyPressEvent(Sender: TObject; var Key: Char);
- var
- TempKey: Smallint;
- begin
- TempKey := Smallint(Key);
- if FEvents <> nil then FEvents.OnKeyPress(TempKey);
- Key := Char(TempKey);
- end;
-
- initialization
- TActiveXControlFactory.Create(
- ComServer,
- TMemoX,
- TMemo,
- Class_MemoX,
- 16,
- '{FA7B842E-9ED7-11D0-AA40-444553540000}',
- 0);
- end.
-