home *** CD-ROM | disk | FTP | other *** search
- unit DbRXEdit;
- {
- Version 1.0
-
- Freeware
- An exploding data-aware RTF memo component with popup to
- change fonts.
-
- Using Helmut Tammen's (German) and James Gabriel's (English)
- component, who based their's on Borland-code.
- Modified to explode on click by Dieter Menne, 100016.2125@compuserve.com
- Also, some anomalities corrected (=bugs removed) and
- some "works-as-designed" features added (= new bugs introduced).
- This version is used in DBCasc-Controls.
- Currently, I can't get it to work with Cached Updates.
- This is a reported bug in version of the BDE coming with Delphi 2.0 supposed
- to be corrected in 2.01, but I could not test this version yet.
- Almost all comments are by D.M.
- }
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, ComCtrls,DB,DBCtrls,Menus,DBTables;
-
- const USER_SETFOCUS=WM_USER+100;
-
- type
- { TDbRXEdit }
- TDbRXEdit = class(TRichEdit)
- private
- FOnExplode,
- FOnCollapse: TNotifyEvent;
- FDataLink: TFieldDataLink;
- FIsExploded, FAutoExplode,
- FAutoDisplay,
- FFocused,
- FMemoLoaded: Boolean;
- FSelStart: Integer;
- FPaintControl: TPaintControl;
- FPopup: TPopupMenu;
- FExLeft,FExTop,FExWidth,FExHeight: integer;
- FDefLeft,FDefTop,FDefWidth,FDefHeight: integer;
- FDefParent: TWinControl;
-
- procedure DataChange(Sender: TObject);
- procedure EditingChange(Sender: TObject);
- procedure EditDataLink;
- function GetDataField: string;
- function GetDataSource: TDataSource;
- function GetField: TField;
- function GetReadOnly: Boolean;
- procedure SetDataField(const Value: string);
- procedure SetDataSource(Value: TDataSource);
- procedure SetReadOnly(Value: Boolean);
- procedure SetAutoDisplay(Value: Boolean);
- procedure SetFocused(Value: Boolean);
-
- procedure UpdateData(Sender: TObject);
-
- procedure UserSetFocus(var Mess: TMessage); message USER_SETFOCUS;
- procedure WMKillFocus(var Message: TWMKillFocus); message WM_KILLFOCUS;
- procedure WMCut(var Message: TMessage); message WM_CUT;
- procedure WMPaste(var Message: TMessage); message WM_PASTE;
- procedure CMEnter(var Message: TCMEnter); message CM_ENTER;
- procedure CMExit(var Message: TCMExit); message CM_EXIT;
- procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN;
- procedure WMLButtonDblClk(var Message: TWMLButtonDblClk); message WM_LBUTTONDBLCLK;
- procedure WMPaint(var Message: TWMPaint); message WM_PAINT;
- procedure CMGetDataLink(var Message: TMessage); message CM_GETDATALINK;
-
- procedure ProcessKey( Key: Char );
- procedure CreatePopupMenu;
- procedure FPopupOnPopup( Sender: TObject );
- procedure MenuClickBold( Sender: TObject );
- procedure MenuClickItalic( Sender: TObject );
- procedure MenuClickUnderline( Sender: TObject );
- procedure MenuClickStrikeout( Sender: TObject );
- procedure MenuClickFont( Sender: TObject );
-
- procedure SetExploded(Value: boolean);
- procedure StoreExSize;
- procedure WMMove( var Msg : TWMMove ) ; message WM_MOVE ;
- procedure WMSize( var Msg : TWMSize ) ; message WM_SIZE ;
-
- protected
- procedure Change; override;
- procedure KeyDown(var Key: Word; Shift: TShiftState); override;
- procedure KeyPress(var Key: Char); override;
- procedure Notification(AComponent: TComponent;
- Operation: TOperation); override;
- procedure WndProc(var Message: TMessage); override;
- procedure Loaded; override;
-
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- procedure Explode;virtual;
- procedure Collapse;virtual;
- procedure LoadMemo;
- property Field: TField read GetField;
-
- published
- property Align;
- property Alignment;
- property AutoDisplay: Boolean read FAutoDisplay write SetAutoDisplay default True;
- property BorderStyle;
- property Color;
- property Ctl3D;
- property DataField: string read GetDataField write SetDataField;
- property DataSource: TDataSource read GetDataSource write SetDataSource;
- property DragCursor;
- property DragMode;
- property AutoExplode: boolean read FAutoExplode write FAutoExplode;
- property ExLeft: integer read FExLeft write FExLeft;
- property ExTop: integer read FExTop write FExTop;
- property ExWidth: integer read FExWidth write FExWidth;
- property ExHeight: integer read FExHeight write FExHeight;
- // The idea of setting stored = false was to avoid storing an exploded
- // state of the edit field. It seems not to work as expected, though
- property Exploded: boolean read FIsExploded write SetExploded stored False;
- property Enabled;
- property Font;
- property MaxLength;
- property ParentColor;
- property ParentCtl3D;
- property ParentFont;
- property ParentShowHint;
- property ReadOnly: Boolean read GetReadOnly write SetReadOnly default False;
- property ScrollBars;
- property ShowHint;
- property TabOrder;
- property TabStop;
- property Visible;
- property WantTabs;
- property WordWrap;
- property OnChange;
- property OnClick;
- property OnCollapse: TNotifyEvent read FOnCollapse write FOnCollapse;
- property OnDblClick;
- property OnDragDrop;
- property OnDragOver;
- property OnExplode: TNotifyEvent read FOnExplode write FOnExplode;
- property OnEndDrag;
- property OnEnter;
- property OnExit;
- property OnKeyDown;
- property OnKeyPress;
- property OnKeyUp;
- property OnMouseDown;
- property OnMouseMove;
- property OnMouseUp;
- property OnStartDrag;
- end;
-
- procedure Register;
-
- { ----------------------------- implementation --------------------------------}
- implementation
-
- uses DBConsts;
-
- { -------------------------- Create -------------------------------------------}
- constructor TDbRXEdit.Create(AOwner: TComponent);
- begin
- inherited Create(AOwner);
- inherited ReadOnly := True;
- FIsExploded:=False;
- FAutoDisplay := True;
- FAutoExplode:=True;
- FDataLink := TFieldDataLink.Create;
- FDataLink.Control := Self;
- FDataLink.OnDataChange := DataChange;
- FDataLink.OnEditingChange := EditingChange;
- FDataLink.OnUpdateData := UpdateData;
- FPaintControl := TPaintControl.Create(Self, 'RICHEDIT');
-
- Height:=21; // We start with a small size
- Width:=121;
- if not (csDesigning in ComponentState) then
- CreatePopupMenu();
- end;
-
- { ------------------------------ Loaded ---------------------------------------}
- procedure TDbRXEdit.Loaded;
- begin
- inherited Loaded;
- // Can anybody tell me how I can inhibit storing of exploded states?
- if Exploded then // Should not happen, because we don't store it
- raise Exception.Create('DbRXEdit or CascMemo stored in exploded state');
- end;
-
- { ------------------------------ Destroy ---------------------------------------}
- destructor TDbRXEdit.Destroy;
- begin
- if FPopup <> nil then
- begin
- FPopup.OnPopup := nil;
- FPopup.Free;
- end;
- FPaintControl.Free;
- FDataLink.Free;
- FDataLink := nil;
- inherited Destroy;
- end;
-
- { --------------------------- CreatePopupMenu ---------------------------------}
- procedure TDbRXEdit.CreatePopupMenu;
- begin
- FPopup := TPopupMenu.Create( self );
- { Thanks to Robert Vivrette's Unofficial Newletter to remind me
- of this shortcut }
- with FPopup.Items do
- begin
- Add(NewItem('&Bold',0,False,True,MenuClickBold,0,'MenuItem1'));
- Add(NewItem('&Italic',0,False,True,MenuClickItalic,0,'MenuItem2'));
- Add(NewItem('&Underline',0,False,True,MenuClickUnderline,0,'MenuItem3'));
- Add(NewItem('&Strikeout',0,False,True,MenuClickUnderline,0,'MenuItem4'));
- Add(NewLine);
- Add(NewItem('&Fonts',0,False,True,MenuClickFont,0,'MenuItem5'));
- end;
- FPopup.OnPopup := FPopupOnPopup;
- PopupMenu := FPopup;
- end;
-
-
- { ----------------------------- Notification ---------------------------------}
- procedure TDbRXEdit.Notification(AComponent: TComponent;
- Operation: TOperation);
- begin
- inherited Notification(AComponent, Operation);
- if (Operation = opRemove) and (FDataLink <> nil) and
- (AComponent = DataSource) then DataSource := nil;
-
- end;
-
- { ---------------------------- EditDataLink -----------------------------------}
- procedure TDbRXEdit.EditDataLink;
- var SStart,SLength: integer;
- begin
- { Changed, D.M.}
- if FDataLink.Editing then exit;
- { Keep selection and caret position }
- SStart:=SelStart; SLength:=SelLength;
- FDataLink.Edit;
- { Restore Selection }
- SelStart:=SStart; SelLength:=SLength;
- end;
-
- { ------------------------------ KeyDown --------------------------------------}
- procedure TDbRXEdit.KeyDown(var Key: Word; Shift: TShiftState);
- begin
- inherited KeyDown(Key, Shift);
- if FMemoLoaded then
- begin
- if (Key = VK_DELETE) or ((Key = VK_INSERT) and (ssShift in Shift)) then
- EditDataLink;
- end else
- Key := 0;
- end;
-
- { ------------------------------ KeyPress -------------------------------------}
- procedure TDbRXEdit.KeyPress(var Key: Char);
- begin
- inherited KeyPress(Key);
- if FMemoLoaded then
- begin
- if (Key in [#32..#255]) and (FDataLink.Field <> nil) and
- not FDataLink.Field.IsValidChar(Key) then
- begin
- MessageBeep(0);
- Key := #0;
- end;
- case Key of
- ^H, ^J, ^M, ^V, ^X, #32..#255:
- EditDataLink;
- ^B, ^I, ^U, ^S:
- begin
- EditDataLink;
- ProcessKey( Key );
- end;
- #27:
- FDataLink.Reset;
- end;
- end else
- begin { Memo not yet loaded }
- if Key = #13 then LoadMemo;
- Key := #0;
- end;
- end;
-
- { ------------------------------ Change ---------------------------------------}
- procedure TDbRXEdit.Change;
- begin
- if FMemoLoaded then FDataLink.Modified;
- //FMemoLoaded := True; { Why in original code?? D.M.}
- inherited Change;
- end;
-
- { ------------------------- Get/SetDataSource ---------------------------------}
- function TDbRXEdit.GetDataSource: TDataSource;
- begin
- Result := FDataLink.DataSource;
- end;
-
- procedure TDbRXEdit.SetDataSource(Value: TDataSource);
- begin
- FDataLink.DataSource := Value;
- if Value <> nil then Value.FreeNotification(Self);
- end;
-
- { ------------------------- Get/SetDataField ----------------------------------}
- function TDbRXEdit.GetDataField: string;
- begin
- Result := FDataLink.FieldName;
- end;
-
- procedure TDbRXEdit.SetDataField(const Value: string);
- begin
- FDataLink.FieldName := Value;
- end;
-
- { ------------------------------ GetReadOnly ----------------------------------}
- function TDbRXEdit.GetReadOnly: Boolean;
- begin
- Result := FDataLink.ReadOnly;
- end;
-
- procedure TDbRXEdit.SetReadOnly(Value: Boolean);
- begin
- FDataLink.ReadOnly := Value;
- end;
-
- { ------------------------------ GetField -------------------------------------}
- function TDbRXEdit.GetField: TField;
- begin
- Result := FDataLink.Field;
- end;
-
- { ------------------------------ LoadMemo -------------------------------------}
- procedure TDbRXEdit.LoadMemo;
- var
- BlobStream: TBlobStream;
- begin
- if FMemoLoaded or not (FDataLink.Field is TBlobField) then exit;
- try
- BlobStream:= TBlobStream.create( TBlobField(FDataLink.Field), bmRead );
- Lines.loadfromstream(BlobStream);
- BlobStream.free;
- FMemoLoaded := True;
- except
- on E:Exception do
- // Message "this is not a blob" comes up when using Cached Updates
- // with the version of the BDE coming with Delphi 2.0 (D.M)
- ShowMessage(E.Message+' ('+FDataLink.FieldName+
- '). Are you using cached updates with the BDE coming with D2.0?');
- end;
- EditingChange(Self);
- end;
-
- { --------------------------- DataChange --------------------------------------}
- procedure TDbRXEdit.DataChange(Sender: TObject);
- var SStart,SLength: integer;
- WasLoaded: boolean;
- begin
- if FDataLink.Field <> nil then
- if FDataLink.Field is TBlobField then
- begin
- if FAutoDisplay or (FDataLink.Editing and FMemoLoaded) then
- begin
- { Keep selection and caret position }
- { The solution used here is not perfect, but somewhat
- better than that in the original Borland Memo where
- the caret jumps confusingly even on trivial
- edit state changes. D.M.}
- WasLoaded:=FMemoLoaded;
- SStart:=SelStart;
- SLength:=SelLength;
- { Force loading }
- FMemoLoaded := False;
- LoadMemo;
- { Restore Selection }
- if WasLoaded then
- begin
- SelStart:=SStart;
- SelLength:=SLength;
- end;
- end else
- begin
- Text := '(' + FDataLink.Field.DisplayLabel + ')';
- FMemoLoaded := False;
- end;
- end else
- begin
- if FFocused and FDataLink.CanModify then
- Text := FDataLink.Field.Text
- else
- Text := FDataLink.Field.DisplayText;
- FMemoLoaded := True;
- end
- else
- begin
- if csDesigning in ComponentState then Text := Name else Text := '';
- FMemoLoaded := False;
- end;
- end;
-
- { --------------------------- EditingChange -----------------------------------}
- procedure TDbRXEdit.EditingChange(Sender: TObject);
- begin
- inherited ReadOnly := not (FDataLink.Editing and FMemoLoaded);
- end;
-
- { --------------------------- UpdateData --------------------------------------}
- procedure TDbRXEdit.UpdateData(Sender: TObject);
- var
- BlobStream: TBlobStream;
- begin
- BlobStream:= TBlobStream.create( TBlobField( FDataLink.Field ), bmReadWrite );
- Lines.savetostream(BlobStream);
- BlobStream.free;
- end;
-
- { ---------------------------- SetFocused -------------------------------------}
- procedure TDbRXEdit.SetFocused(Value: Boolean);
- begin
- if FFocused <> Value then
- begin
- FFocused := Value;
- if not (FDataLink.Field is TBlobField) then FDataLink.Reset;
- end;
- end;
-
- { ------------------------------ WndProc --------------------------------------}
- procedure TDbRXEdit.WndProc(var Message: TMessage);
- begin
- with Message do
- if (Msg = WM_CREATE) or (Msg = WM_WINDOWPOSCHANGED) or
- (Msg = CM_FONTCHANGED) then FPaintControl.DestroyHandle;
- inherited;
- end;
-
- { ------------------------------ CMEnter --------------------------------------}
- procedure TDbRXEdit.CMEnter(var Message: TCMEnter);
- begin
- if AutoExplode then Explode; { Even if this is done in WMLButtonClick,
- we need it here too for tabbing. Luckily, Explode immediately
- returns if it is already done, so not much is lost.}
- SetFocused(True);
- inherited;
- end;
-
- { ------------------------------ CMExit ---------------------------------------}
- procedure TDbRXEdit.CMExit(var Message: TCMExit);
- begin
- // I would like to get rid of the extra Editing test, but
- // when it's missing I get "Dataset not in Edit mode" on leaving
- // the Editor with tab.
- if (FDataLink.Field is TBlobField) and (FDataLink.Editing) then
- try
- FDataLink.UpdateRecord;
- except
- SetFocus;
- raise;
- end;
- SetFocused(False);
- inherited;
- end;
-
- { ----------------------- SetAutoDisplay --------------------------------------}
- procedure TDbRXEdit.SetAutoDisplay(Value: Boolean);
- begin
- if FAutoDisplay <> Value then
- begin
- FAutoDisplay := Value;
- if Value then LoadMemo;
- end;
- end;
-
- { ------------------------ WMLButtonDblClk ------------------------------------}
- procedure TDbRXEdit.WMLButtonDblClk(var Message: TWMLButtonDblClk);
- begin
- if not FMemoLoaded then LoadMemo else inherited;
- end;
-
-
- { ------------------------ WMLButtonDown --------------------------------------}
- procedure TDbRXEdit.WMLButtonDown(var Message: TWMLButtonDown);
- begin
- inherited;
- if not (csDesigning in ComponentState) and FAutoExplode then
- Explode; { Doing' this in WMEnter should be
- enuff, but it leads to an address violation.
- If anyone knows why? D.M.}
- end;
-
-
- { -------------------------- WMKillFocus --------------------------------------}
- procedure TDbRXEdit.WMKillFocus(var Message: TWMKillFocus);
- begin
- // Collapse when focus goes to another control
- inherited;
- if FAutoExplode then Collapse;
- end;
-
- { ------------------------------ WMCut ----------------------------------------}
- procedure TDbRXEdit.WMCut(var Message: TMessage);
- begin
- EditDataLink;
- inherited;
- end;
-
- { ------------------------------ WMPaste --------------------------------------}
- procedure TDbRXEdit.WMPaste(var Message: TMessage);
- begin
- EditDataLink;
- inherited;
- end;
-
- { --------------------------- CMGetDataLink -----------------------------------}
- procedure TDbRXEdit.CMGetDataLink(var Message: TMessage);
- begin
- Message.Result := Integer(FDataLink);
- end;
-
- { ---------------------------- WMPaint ---------------------------------------}
- procedure TDbRXEdit.WMPaint(var Message: TWMPaint);
- var
- S: string;
- begin
- if not (csPaintCopy in ControlState) then inherited else
- begin
- if FDataLink.Field <> nil then
- if FDataLink.Field is TBlobField then
- S := AdjustLineBreaks(FDataLink.Field.AsString) else
- S := FDataLink.Field.DisplayText;
- SendMessage(FPaintControl.Handle, WM_SETTEXT, 0, Integer(PChar(S)));
- SendMessage(FPaintControl.Handle, WM_PAINT, Message.DC, 0);
- end;
- end;
-
- { ---------------------------- ProcessKey ------------------------------------}
- procedure TDbRXEdit.ProcessKey( Key: Char );
- begin
- case Key of
- ^B:
- begin
- if fsBold in SelAttributes.Style then
- SelAttributes.Style := SelAttributes.Style - [fsBold]
- else
- SelAttributes.Style := SelAttributes.Style + [fsBold];
- end;
- ^I:
- begin
- if fsItalic in SelAttributes.Style then
- SelAttributes.Style := SelAttributes.Style - [fsItalic]
- else
- SelAttributes.Style := SelAttributes.Style + [fsItalic];
- end;
- ^U:
- begin
- if fsUnderline in SelAttributes.Style then
- SelAttributes.Style := SelAttributes.Style - [fsUnderline]
- else
- SelAttributes.Style := SelAttributes.Style + [fsUnderline];
- end;
- ^S:
- begin
- if fsStrikeout in SelAttributes.Style then
- SelAttributes.Style := SelAttributes.Style - [fsStrikeout]
- else
- SelAttributes.Style := SelAttributes.Style + [fsStrikeout];
- end;
- end;
- end;
-
- { --------------------------- MenuClickFont ----------------------------------}
- procedure TDbRXEdit.MenuClickFont( Sender: TObject );
- var
- dlg: TFontDialog;
- SStart,SLength: integer;
- begin
- SStart:=SelStart; { Why does the f... selction disapear? }
- SLength:=SelLength;
-
- dlg := TFontDialog.Create( self );
- dlg.Font.Name := SelAttributes.Name;
- dlg.Font.Color := SelAttributes.Color;
- dlg.Font.Pitch := SelAttributes.Pitch;
- dlg.Font.Size := SelAttributes.Size;
- dlg.Font.Style := SelAttributes.Style;
- dlg.Font.Height := SelAttributes.Height;
-
- if dlg.Execute() then begin
- EditDataLink;
- SelStart:=SStart;
- SelLength:=SLength;
- SelAttributes.Name := dlg.Font.Name;
- SelAttributes.Color := dlg.Font.Color;
- SelAttributes.Pitch := dlg.Font.Pitch;
- SelAttributes.Size := dlg.Font.Size;
- SelAttributes.Style := dlg.Font.Style;
- SelAttributes.Height := dlg.Font.Height;
- end;
- dlg.Free;
- end;
-
-
- { ------------------------- FPopupOnPopup -------------------------------------}
- procedure TDbRXEdit.FPopupOnPopup( Sender: TObject );
- begin
- { Replaces the convoluted "if" code in original Borland source.}
- FPopup.Items[0].Checked := fsBold in SelAttributes.Style;
- FPopup.Items[1].Checked := fsItalic in SelAttributes.Style;
- FPopup.Items[2].Checked := fsUnderline in SelAttributes.Style;
- FPopup.Items[3].Checked := fsStrikeout in SelAttributes.Style;
- end;
-
- { -------------------------- MenuClickBold ------------------------------------}
- procedure TDbRXEdit.MenuClickBold( Sender: TObject );
- var Key:Char;
- begin
- Key:=^B;
- KeyPress( Key );
- end;
-
- { ----------------------------MenuClickItalic --------------------------------}
- procedure TDbRXEdit.MenuClickItalic( Sender: TObject );
- var
- Key: Char;
- begin
- Key := ^I;
- KeyPress( Key );
- end;
-
- { ------------------------ MenuClickUnderline ---------------------------------}
- procedure TDbRXEdit.MenuClickUnderline( Sender: TObject );
- var
- Key: Char;
- begin
- Key := ^U;
- KeyPress( Key );
- end;
-
- { ------------------------ MenuClickStrikeout -------------------------------}
- procedure TDbRXEdit.MenuClickStrikeout( Sender: TObject );
- var
- Key: Char;
- begin
- Key := ^S;
- KeyPress( Key );
- end;
-
- { -------------------------- StoreExSize --------------------------------------}
- procedure TDbRXEdit.StoreExSize;
- begin
- { On designing, we copy the exploded size when collapsing }
- if csDesigning in ComponentState then
- begin
- ExLeft:=Left-FDefParent.Left;
- ExTop:=Top-FDefParent.Top;
- ExWidth:=Width;
- ExHeight:=Height;
- end;
- end;
-
- { ------------------------------ WMMove ---------------------------------------}
- procedure TDbRXEdit.WMMove( var Msg : TWMMove ) ;
- begin
- inherited ;
- if FIsExploded then StoreExSize;
- end ;
-
- { ------------------------------ WMSize ---------------------------------------}
- procedure TDbRXEdit.WMSize( var Msg : TWMSize ) ;
- begin
- inherited ;
- if FIsExploded then StoreExSize;
- end ;
-
- { -------------------------- SetExploded -------------------------------------}
- procedure TDbRXEdit.SetExploded(Value: boolean);
- begin
- if Value=FIsExploded then exit; { Nothing to do }
- if Value then
- begin
- { Set a default Exploded width and Height if nothing set }
- if FExWidth< Width then FExWidth:=2*Width;
- if FExHeight< Height then FExHeight:=2*Height;
- Explode;
- end
- else
- Collapse;
- end;
-
- { -------------------------- UserSetFocus -------------------------------------}
- procedure TDbRXEdit.UserSetFocus(var Mess: TMessage);
- begin
- { We get this message posted on explode. Make sure that
- the caret gets visible immediately at the right position }
- Windows.SetFocus(Handle);
- SelStart:=FSelStart;
- end;
-
- { -------------------------- Explode ------------------------------------------}
- procedure TDbRXEdit.Explode;
- begin
- { Anything to do?}
- if FIsExploded then exit;
- if Assigned(FOnExplode) then FOnExplode(self);
-
- { Stores the current position values }
- FDefLeft:=Left;
- FDefTop:=Top;
- FDefWidth:=Width;
- FDefHeight:=Height;
- FSelStart:=SelStart;
- FDefParent:=Parent; { Keep for Collapse }
- { Set Expanded position, correcting for Form's coordinates.}
- Parent:=Owner as TWinControl; { If on panel, allow paint on background form}
- FIsExploded:=True;
- SetBounds(FDefParent.Left+FExLeft,FDefParent.Top+FExTop,
- FExWidth,FExHeight);
- PopupMenu:=FPopup; // Must reassign because parent may have changed
-
- { Tricky way to assure that the exploded state gets the focus
- if the Owner changed, e.g. when on a label }
- if not (csDesigning in ComponentState) then
- PostMessage(Handle,WM_USER+100,0,0);
- end;
-
- { ------------------------------ Collapse -------------------------------------}
- procedure TDbRXEdit.Collapse;
- var Designing: boolean;
- begin
- { Anything to do?}
- if Not FIsExploded then exit;
- if Assigned(FOnCollapse) then FOnCollapse(self);
- Designing:=csDesigning in ComponentState;
- StoreExSize;
- Parent := FDefParent; { Restore limitation to panel }
- PopupMenu := FPopup; // Probably not necessary, just to be safe
- if Designing then FIsExploded := False;
- SetBounds(FDefLeft,FDefTop,FDefWidth,FDefHeight);
- if Not Designing then FIsExploded := False;
- end;
-
- { ------------------------------ Register -------------------------------------}
- procedure Register;
- begin
- RegisterComponents('Data Controls', [TDbRXEdit]);
- end;
-
- end.
-
-