Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 07/02/23 in all areas

  1. programmerdelphi2k

    TImage inside TComponent serializaton

    or more simple way; you can use only "Memory streams instead save on file" procedure TForm1.Button1Click(Sender: TObject); var LMemStream: TMemoryStream; LStrStream: TStringStream; begin LMemStream := TMemoryStream.Create; try LMemStream.WriteComponent(Image1); LMemStream.SaveToFile('myTImage.bin'); // LStrStream := TStringStream.Create; try LMemStream.Position := 0; ObjectBinaryToText(LMemStream, LStrStream); LStrStream.Position := 0; Memo1.Text := LStrStream.DataString; // showing the propers finally LStrStream.Free; end; // Image1.Picture.Bitmap := nil; // just for test... finally LMemStream.Free; end; end; procedure TForm1.Button2Click(Sender: TObject); var LMemStream: TMemoryStream; begin LMemStream := TMemoryStream.Create; try LMemStream.LoadFromFile('myTImage.bin'); LMemStream.ReadComponent(Image1); finally LMemStream.Free; end; end;
  2. Make the Owner of that TImage instance your component and set csSubComponent in the TImages ComponentStyle. That means, the image should be created like this: FImage := TImage.Create(Self); FImage.SetSubComponent(True);
  3. programmerdelphi2k

    Access TStringGrid InplaceEditor

    @Mike Warren question: doesn't the "inplace editor" have the mission of showing a "custom" control to edit the value of what is shown in the grid? That is, when associating the variable "Control" to a new control, couldn't you simply access the properties of this "control"? function MyComboBoxToGridCustomEditor(AOwner: TComponent { TForm - Form1 } ): TComboBox; begin result := TComboBox.Create(AOwner); // now, you access the properties/events/etc.. // result.Items.AddStrings(MyAllEnumsNames); // result.OnChange := Form1.MyComboBoxChange; end; procedure TForm1.Grid1CreateCustomEditor(Sender: TObject; const Column: TColumn; var Control: TStyledControl); begin // Control is nil (???) = using default controls as defined on grid // Sender is TStyledGrid; // if Column.Index = 1 then // now using my ComboBox Control := MyComboBoxToGridCustomEditor(Self); // destroyed when out scope this procedure... end;
  4. If you need an integration for MarkDown files into Delphi apps, you can find some interesting open-source projects that I'm working on. MarkDownHelpViewer Project The MarkDownHelpViewer, is an Open-Source project to provide a Delphi-integrated help system using markdown files for online "help" creation. The project includes a ready Viewer with its setup to be installed on the user's machine (in practice the equivalent of hh.exe for the help in .chm format (see image) and an "interface" file to add to your own application that hooks the viewer to the "HelpContext" or "HelpKeyword" set on the Delphi components. Besides this also a component that can be used internally to the Delphi application to display help files. Here is the link to the project: https://github.com/EtheaDev/MarkdownHelpViewer This is a "Preview" of the viewer showing the help from the "wiki" of the InstantObjects project: There's also a small demo in the project that explains how to integrate the help with your Delphi application, including the ability to use a MarkDownViewer component right inside your application: The MarkDownShellExtensions Project In addition to the viewer, I recommend to use the MarkDown file editor, which comes with my other project available here: https://github.com/EtheaDev/MarkdownShellExtensions with which it is possible to edit the MarkDown files and immediately see the preview of the final result: Combining the two projects you will be able to offer your Delphi applications a fully integrated and easy to maintain Help system for the end user: when you need to update the images of your application because the GUI has changed, it will be sufficient to update the image on disk and update the associated markdown file, without the need for further updates, in order to always have the help updated to the latest release. Furthermore, the MarkDown format allows it to be easily published (for example as a "wiki" on Git-Hub) and is easily maintainable because it can be subjected to version-control. Those two projects are based on other Open-source projects, like: 1: SVGIconImageList: https://github.com/EtheaDev/SVGIconImageList 2: HtmlViewer: https://github.com/BerndGabriel/HtmlViewer) 2: SynEdit: https://github.com/SynEdit/SynEdit 3: VCLStyleUtils: https://github.com/RRUZ/vcl-styles-utils 4: Delphi-Markdown: https://github.com/grahamegrieve/delphi-markdown
×