FabioMorcillo Posted December 7, 2018 Posted December 7, 2018 Hi, I need add new properties to columns in UniDBGrid, i have inherited to new component and change the property columns to new object, but property editor don´t show my new property. Any here can help me ? CODE https://drive.google.com/file/d/1Tfzc0z4tMwbz_kTjFV8ClhHFfc-iIjy4/view?usp=sharing OBJECT INSPECTOR WITH CORRECT TYPE https://drive.google.com/file/d/16BCfgVSkhVg0KyxGnkRagU_oGgWgy4Z8/view?usp=sharing EDITOR PROPERTY WITH INCORRECT TYPE https://drive.google.com/file/d/1dSlHJ6VhU7gXEOZi_pzfFaBLZ9-5fpy2/view?usp=sharing Thank you, Quote
BantuKumar Posted December 8, 2018 Posted December 8, 2018 13 hours ago, FabioMorcillo said: Hi, I need add new properties to columns in UniDBGrid, i have inherited to new component and change the property columns to new object, but property editor don´t show my new property. Any here can help me ? Thank you, I am just confirming if you have added under published section? Quote
FabioMorcillo Posted December 8, 2018 Author Posted December 8, 2018 Hi BantuKumar, I am have added under published. You can see the code and print screen in: CODE https://drive.google.com/file/d/1Tfzc0z4tMwbz_kTjFV8ClhHFfc-iIjy4/view?usp=sharing OBJECT INSPECTOR WITH CORRECT TYPE https://drive.google.com/file/d/16BCfgVSkhVg0KyxGnkRagU_oGgWgy4Z8/view?usp=sharing EDITOR PROPERTY WITH INCORRECT TYPE https://drive.google.com/file/d/1dSlHJ6VhU7gXEOZi_pzfFaBLZ9-5fpy2/view?usp=sharing Quote
SEGNA Posted July 21, 2022 Posted July 21, 2022 On 12/8/2018 at 3:22 PM, FabioMorcillo said: Hi BantuKumar, I am have added under published. You can see the code and print screen in: CODE https://drive.google.com/file/d/1Tfzc0z4tMwbz_kTjFV8ClhHFfc-iIjy4/view?usp=sharing OBJECT INSPECTOR WITH CORRECT TYPE https://drive.google.com/file/d/16BCfgVSkhVg0KyxGnkRagU_oGgWgy4Z8/view?usp=sharing EDITOR PROPERTY WITH INCORRECT TYPE https://drive.google.com/file/d/1dSlHJ6VhU7gXEOZi_pzfFaBLZ9-5fpy2/view?usp=sharing Hello, Did you manage to show the property? Quote
Sherzod Posted July 21, 2022 Posted July 21, 2022 6 hours ago, SEGNA said: Did you manage to show the property? Hello, This post may help you: Quote
Iskaropki Posted February 8 Posted February 8 On 12/8/2018 at 12:37 AM, FabioMorcillo said: I need add new properties to columns in UniDBGrid, i have inherited to new component and change the property columns to new object, but property editor don´t show my new property. Hello! I have the same problem: the new TUniDBGrid column property doesn't display in design mode. The code is exactly the same as the thread author's: I created subclasses of TUniDBGrid, TUniDectopDBGridColumns, and TUniDBGridColumn. And the result is the same: the column list in the object editor displays the new type, but the columns themselves are of the old type. Please help. I'm using the latest UNIGui demo with Delphi 2007 (FMSoft_uniGUI_Complete_Professional_1.95.0.1610_Trial.exe). On 7/21/2022 at 8:02 PM, Sherzod said: This post may help you: Unfortunately, the code at your link is no longer available for review. Regards. Quote
Sherzod Posted February 9 Posted February 9 Hello, 8 hours ago, Iskaropki said: Unfortunately, the code at your link is no longer available for review. The link works. Possible reason why it doesn't open for you: Quote
Vitiai77 Posted February 9 Posted February 9 6 hours ago, Sherzod said: Hello, The link works. Possible reason why it doesn't open for you: Hello, Sherzod! I have adjust my e-mail, but still can't see these links(( Quote
Sherzod Posted February 9 Posted February 9 2 minutes ago, Vitiai77 said: I have adjust my e-mail Hello, I don’t see that you have adjusted your email settings. Quote
Vitiai77 Posted February 9 Posted February 9 My FMS (fmsoft.net) acc: My forums.unigui.com acc: However, I must say, I only registered today, if that's important. Quote
Vitiai77 Posted February 9 Posted February 9 (edited) 26 minutes ago, Sherzod said: Hello, I don’t see that you have adjusted your email settings. Sherzod, thanks for responding so soon! I show it in my previous message. Am I doing something wrong? Edited February 9 by Vitiai77 thx Quote
Sherzod Posted February 9 Posted February 9 OK, I can see that you are a subscriber, but the forum doesn’t seem to recognize you as one, so you might not be able to see all the available features. We’ll check this. In the meantime, could you clarify what exactly you wanted to ask? 1 Quote
Vitiai77 Posted February 9 Posted February 9 2 minutes ago, Sherzod said: OK, I can see that you are a subscriber, but the forum doesn’t seem to recognize you as one, so you might not be able to see all the available features. We’ll check this. In the meantime, could you clarify what exactly you wanted to ask? My main question in this theme: How can I at "UniDBGrid add new property to column"? And upload the relevant code examples. Quote
Sherzod Posted February 9 Posted February 9 The post I mentioned above (which you can’t see) doesn’t actually answer your question. Could you please clarify which property you want to add and what you need it for? Quote
Vitiai77 Posted February 9 Posted February 9 It's very valuable point) I need to add Field (It is for example, I will need to make more improvements in the future) property Scalable: Boolean to Visual component - TUniDBDesktopGridColumn. To do this, I made some classses and register user visual component [TUniDBGridEx]. I can't see my new field in Designe Time, but i see it in Run Time. What is the mistake? My code: XUniGuiDBD.dpk: package XUniGuiDBD; {$R *.res} {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} {$ALIGN 8} {$ASSERTIONS ON} {$BOOLEVAL OFF} {$DEBUGINFO OFF} {$EXTENDEDSYNTAX ON} {$IMPORTEDDATA ON} {$IOCHECKS ON} {$LOCALSYMBOLS ON} {$LONGSTRINGS ON} {$OPENSTRINGS ON} {$OPTIMIZATION OFF} {$OVERFLOWCHECKS ON} {$RANGECHECKS ON} {$REFERENCEINFO ON} {$SAFEDIVIDE OFF} {$STACKFRAMES ON} {$TYPEDADDRESS OFF} {$VARSTRINGCHECKS ON} {$WRITEABLECONST OFF} {$MINENUMSIZE 1} {$IMAGEBASE $400000} {$DEFINE DEBUG} {$ENDIF IMPLICITBUILDING} {$IMPLICITBUILD ON} requires rtl, vclimg, vcl, vclwinx, soaprtl, dbrtl, vcldb, uniGUI28, uniGUI28Core, uniTools28, uIndy28; contains UniDBExtended in 'UniDBExtended.pas'; end. UniDBExtended.pas: unit UniDBExtended; interface uses System.SysUtils, System.Classes, Vcl.Controls, Vcl.Forms, uniGUIBaseClasses, uniGUIAbstractClasses, uniGUIClasses, uniBasicGrid, uniDBGrid; type TUniDbGridExColumn = class(TUniDBDesktopGridColumn) private FScalable: Boolean; protected procedure AssignTo(Dest: TPersistent); override; published property Scalable: Boolean read FScalable write FScalable default False; end; TUniDBGridExColumns = class(TUniDesktopDBGridColumns) protected function GetItem(AIndex: Integer): TUniDbGridExColumn; reintroduce; procedure SetItem(AIndex: Integer; const AValue: TUniDbGridExColumn); reintroduce; public property Items[Index: Integer]: TUniDbGridExColumn read GetItem write SetItem; default; end; TUniDBGridEx = class(TUniDBGrid) private { Private declarations } FScaleColumns: Boolean; protected { Protected declarations } function GetColumnClass: TUniDBGridColumnClass; override; function GetColumnsClass: TUniDBGridColumnsClass; override; function GetColumns: TUniDBGridExColumns; reintroduce; procedure SetColumns(AValue: TUniDBGridExColumns); reintroduce; public { Public declarations } published { Published declarations } property ScaleColumns: Boolean read FScaleColumns write FScaleColumns default False; property Columns: TUniDBGridExColumns read GetColumns write SetColumns stored False; end; procedure Register; implementation procedure Register; begin RegisterClasses([TUniDbGridExColumn,TUniDBGridExColumns]); RegisterComponents('UniGUI Extended', [TUniDBGridEx]); end; { TUniDbGridExColumn } procedure TUniDbGridExColumn.AssignTo(Dest: TPersistent); begin inherited; if Dest is TUniDbGridExColumn then begin TUniDbGridExColumn(Dest).Scalable:=Self.Scalable; end; end; { TUniDBGridExColumns } function TUniDBGridExColumns.GetItem(AIndex: Integer): TUniDbGridExColumn; begin Result:=TUniDbGridExColumn(inherited GetItem(AIndex)); end; procedure TUniDBGridExColumns.SetItem(AIndex: Integer; const AValue: TUniDbGridExColumn); begin inherited SetItem(AIndex, AValue); end; { TUniDBGridEx } function TUniDBGridEx.GetColumnClass: TUniDBGridColumnClass; begin Result:=TUniDbGridExColumn; end; function TUniDBGridEx.GetColumnsClass: TUniDBGridColumnsClass; begin Result:=TUniDBGridExColumns; end; function TUniDBGridEx.GetColumns: TUniDBGridExColumns; begin Result:=TUniDBGridExColumns(inherited GetColumns); end; procedure TUniDBGridEx.SetColumns(AValue: TUniDBGridExColumns); begin inherited SetColumns(AValue); end; end. Quote
Sherzod Posted February 10 Posted February 10 Hello, Your implementation looks correct. However, if columns were created before you introduced the Scalable property, they may still be instances of the base TUniDBDesktopGridColumn. Try removing all columns and adding them again. New columns should be created as TUniDbGridExColumn and the Scalable property should appear... Quote
Vitiai77 Posted February 10 Posted February 10 If you suggest doing this in Design Time, then it doesn't work. I everytime after compiling and installing package create new App with new Form and place there my component TUniDBGridEx with TUniDbGridExColumn. And in Run Time, as it was written here earlier, the columns are of the right type and have the new property. As soon as I add a column to Columns of TUniDBGridEx1 in Design Time in Structure Window, IDE adds columns with type TUniDBGridColumn instead of UniDBGridExColumn. In addition, as it shown below in the screenshot, in Objct Insperctor, this column has type TVCLDBColumn. And the TVCLDBColumn code, in turn, is not available anywhere else. Quote
Oliver Morsch Posted February 10 Posted February 10 Try at the places where you use "reintroduce" to use "override" (with the original parameter type). Quote
Vitiai77 Posted February 11 Posted February 11 There isn't possible to override a non-virtual method. [dcc32 Error] ..: E2170 Cannot override a non-virtual method In uniGUI code, in the ancessor classes, the methods of their ancessores are changed in the same way, by reintroduce. But replacing it where possible doesn't help. Hm..🤔 Quote
Iskaropki Posted February 11 Posted February 11 On 2/10/2026 at 7:33 AM, Sherzod said: Hello, Your implementation looks correct. However, if columns were created before you introduced the Scalable property, they may still be instances of the base TUniDBDesktopGridColumn. Try removing all columns and adding them again. New columns should be created as TUniDbGridExColumn and the Scalable property should appear... The grid field list object is created in the constructor of the base grid class (TUniCustomDBGrid). In the child grid's constructor, simply deleting them and creating the columns as objects of a new class is not enough. This is because in the TUniCustomDBGrid base class constructor, after creating the columns, the grid object address is assigned to the private FOwnerGrid field of the column class: unit uniDBGrid; ... constructor TUniCustomDBGrid.Create(AOwner:TComponent); begin ... FColumns := GetColumnsClass.Create(Self, GetColumnClass) as TUniCustomDBGridColumns; ... FColumns.FOwnerGrid := Self; // <===== ... ......and the FOwnerGrid field is private: unit uniDBGrid; TUniCustomDBGridColumns = class(TUniDBGridColumns) private // <=== FState: TUniDBGridColumnsState; FOwnerGrid : TUniCustomDBGrid; // <=== Because the field is private, it cannot be changed.. 🤔 Quote
Iskaropki Posted February 11 Posted February 11 And I don’t see the point in recreating the columns: after all, the columns of the required class are immediately created, since the GetColumnClass method is used. Quote
Sherzod Posted February 11 Posted February 11 "Actually, need to add a field to VCL column which is not open source yet" Quote
Iskaropki Posted February 11 Posted February 11 47 minutes ago, Sherzod said: "Actually, need to add a field to VCL column which is not open source yet" That is, right now it is impossible to implement the requested functionals? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.