Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

4 Neutral

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney
  1. joachimd

    changing inherited control

    what does Delphi complain? Component not found? What about placing your grid to the form? Same error? Probably only a path issue. If it's just the MouseDown not working: use override as explained in Günther's post. I used the same technique multiple times.
  2. joachimd

    Sql Delete

    DELETE FROM MDETAIL WHERE ID IN (SELECT ID FROM MDETAIL MD JOIN ITEMS IT ON MD.ITEMNO=IT.ITEMNO WHERE MD.RNO=120 and IT.ITEMTYPE ='001'); If you don't have a unique ID value, maybe your dbms has (rowid).
  3. joachimd

    How to get data from class to TVirtualStringTree?

    no, because my events are ways simpler 😉 btw: I use very seldom the "RAD things" ... setting all required properties and event handlers in code looks awful at first, but IMHO it results in a clearer structure of your code. I'd love to see Delphi creating code instead of DFM files (like C# does). That would make things even more simple.
  4. joachimd

    How to get data from class to TVirtualStringTree?

    Correct. My component only has a few (required) Events and Properties, but VST events are not mapped to the outside.
  5. joachimd

    How to get data from class to TVirtualStringTree?

    sure ... it's no big deal 😉 I only have two columns for this viewer: First is the caption, second the ID (for Debug purposes, usually not displayed). procedure TAppListViewer.treeviewGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: string); var data: PSuperNode; begin try data := treeview.GetNodeData(Node); case Column of 0: CellText := data.obj.Caption; 1: CellText := ID2String(data.obj.ID); //btw: it's TGUID, but I leave it open for other datatypes end; except end; end; BTW: You can also define a function in your 'IAppListItem" interface to get the string your need (e.g. function GetText(column: integer): string)
  6. joachimd

    How to get data from class to TVirtualStringTree?

    For such purposes I've written my own component, derived from TWinControl. It contains a TVirtualStringTree and implements all methods required to run it. For the outside world, I've implemented my own methods and properties. Within the implementation part of that unit, I've defined a Node record being used for all data handling. This record contains an implementation of a an interface: interface type TAppListViewer = class(TWinControl) //... implementation type PSuperNode = ^TSuperNode; TSuperNode = record obj: IAppListItem; end; //... IAppListItem iss defined in another unit: IAppListItem=interface ['{CA2770B8-8A4B-4F52-AE6F-5F55E45C6014}'] procedure SetID(const aValue: TIDType); function GetID(): TIDType; property ID:TIDType read GetID write SetID; procedure SetCaption(const aValue: string); function GetCaption(): string; property Caption:string read GetCaption write SetCaption; procedure SetParent(const aValue: IAppListItem); function GetParent(): IAppListItem; property Parent:IAppListItem read GetParent write SetParent; function GetChildren(): TAppList; property Children:TAppList read GetChildren; procedure AddChild(aChild: IAppListItem); procedure RemoveChild(aChild: IAppListItem); //... end; My component has a property getting one such an item (the root) and all children of it. Setting it will cause a rebuilt of the tree. property AppList:IAppListItem read FAppList write SetAppList; HTH Joachim