Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM Binaries » View Thread |
Messages 1 to 3 of 3 total |
Delphi 2 component |
Mon, Dec 17 2007 10:03 AM | Permanent Link |
"Rita" | If the kids aunts and so on get you down over xmas
can you make these D2 data aware buttons work for Dbisam 4 and D7 I would love a data button that displays the field content and there is such a beast in this zip. Thanks Rita Attachments: buttons.zip |
Mon, Dec 17 2007 2:09 PM | Permanent Link |
Sean McCall | Rita,
It's not real difficult to roll your own. If you have the code for the VCL look at how a TFieldDataLink works in the DBCtrls unit. The following is untested, but will probably do the trick. Sean TDBButton = class(TButton) private FDataLink: TFieldDataLink; protected function GetDataField: String; function GetDataSource: TDataSource; procedure SetDataField(const AValue: String); procedure SetDataSource(Value: TDataSource); published property DataField: string read GetDataField write SetDataField; property DataSource: TDataSource read GetDataSource write SetDataSource; end; constructor TDBButton.Create(AOwner: TComponent); begin inherited Create(AOwner); FDataLink := TFieldDataLink.Create; FDataLink.Control := Self; FDataLink.OnDataChange := DataChange; (* These are probably not needed for a button... FDataLink.OnEditingChange := EditingChange; FDataLink.OnUpdateData := UpdateData; FDataLink.OnActiveChange := ActiveChange; *) end; {constructor} destructor TDBButton.Destroy; begin inherited; FreeAndNil(FDataLink); end; procedure TDBButton.DataChange(Sender: TObject); begin if FDataLink.Field <> nil then begin Caption := FDataLink.Field.Text; end; {if linked to a field} end; function TDBButton.GetDataSource: TDataSource; begin Result := FDataLink.DataSource; end; procedure TDBButton.SetDataSource(AValue: TDataSource); begin if not (FDataLink.DataSourceFixed and (csLoading in ComponentState)) then FDataLink.DataSource := AValue; if Value <> nil then Value.FreeNotification(Self); end; function TDBButton.GetDataField: string; begin Result := FDataLink.FieldName; end; procedure TDBButton.SetDataField(const AValue: string); begin FDataLink.FieldName := AValue; end; |
Tue, Dec 18 2007 4:41 AM | Permanent Link |
"Rita" | Cool thanks Sean u could have done the
whole thing being the season of goodwill an all Rita CheekyBum "Sean McCall" <someone@somewhere.net> wrote in message news:5CE2E654-A18B-4E58-9A86-C06F34262154@news.elevatesoft.com... > Rita, > > It's not real difficult to roll your own. If you have the code for the VCL > look at how a TFieldDataLink works in the DBCtrls unit. The following is > untested, but will probably do the trick. > > Sean > > TDBButton = class(TButton) > private > FDataLink: TFieldDataLink; > protected > function GetDataField: String; > function GetDataSource: TDataSource; > procedure SetDataField(const AValue: String); > procedure SetDataSource(Value: TDataSource); > published > property DataField: string read GetDataField write SetDataField; > property DataSource: TDataSource read GetDataSource write SetDataSource; > end; > > constructor TDBButton.Create(AOwner: TComponent); > begin > inherited Create(AOwner); > FDataLink := TFieldDataLink.Create; > FDataLink.Control := Self; > FDataLink.OnDataChange := DataChange; > (* > These are probably not needed for a button... > > FDataLink.OnEditingChange := EditingChange; > FDataLink.OnUpdateData := UpdateData; > FDataLink.OnActiveChange := ActiveChange; > *) > end; {constructor} > > destructor TDBButton.Destroy; > begin > inherited; > FreeAndNil(FDataLink); > end; > > procedure TDBButton.DataChange(Sender: TObject); > begin > if FDataLink.Field <> nil then begin > Caption := FDataLink.Field.Text; > end; {if linked to a field} > end; > > function TDBButton.GetDataSource: TDataSource; > begin > Result := FDataLink.DataSource; > end; > > procedure TDBButton.SetDataSource(AValue: TDataSource); > begin > if not (FDataLink.DataSourceFixed and (csLoading in ComponentState)) > then > FDataLink.DataSource := AValue; > if Value <> nil then Value.FreeNotification(Self); > end; > > function TDBButton.GetDataField: string; > begin > Result := FDataLink.FieldName; > end; > > procedure TDBButton.SetDataField(const AValue: string); > begin > FDataLink.FieldName := AValue; > end; > > |
This web page was last updated on Thursday, March 28, 2024 at 06:05 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |