Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

VCL vs EL vs NG

It seems there is some overlap with some components.  eg there are dialogs available under NG dialogs and also the dialog pack.  For other components there are duplicates in the EL set.  eg ElInspector vs SimplePropInspector

Is there a recommendation for which set of components to use?  eg favor NG over EL over other components.


  • 7 Comments sorted by Votes Date Added
  • >>Is there a recommendation for which set of components to use?<<
    For this no general answer is possible - so it depends.
    For your example:
    a. NG DialogPack / LMD DialogPack
    NG DialogPack may be lighter in functionality, but has more modern approach (fluent interface).
    If you don't need the extra functionality in LMD DialogPack, we recommend to use NG DialogPack. 
    The NG controls were designed to minimize dependencies while LMD or ElPack controls are based on the shared LMD common runtime. 

    b. ElInspector vs SimplePropInspector
    SimplePropInspector or InspectorPack is a foundation package for IDE-Tools which is a highly specialized and featured LMD main package. So if you are not ElPack only user you should use SimplePropInspector. 
  • edited March 2022 Posts: 6Vote Up0Vote Down
    Thank you.  Now I have some questions about using NG.DragDrop. In CBuilder, class conversions from Delphi are sometimes complex.

    if C.Data.HasFormat(CF.TEXT) then

    In CBuilder is

    d:   TNGFileArray;
    cnt: TNGFileContents;
    if C.Accept(CF.FILEDESCRIPTOR.Ref(@d)) and
    C.Accept(CF.FILECONTENTS.Ref(@cnt)) then

    TNGFileArray fa;
    TNGFileContents Content;
    for(int i=0; i<fa.Length; i++)
      DelphiInterface<IStream> ConversionStream = Content[i];
      // how to get Stream from IStream ?

    Same with

    At least I can create an IStream at from a stream.
    std::unique_ptr<TMemoryStream> fStream(new TMemoryStream);
    DelphiInterface<IStream> AStream(*(new TStreamAdapter(fStream.get(), soReference)));

    But the problem is that stream needs to be read at the start of the drag operation whereas I need a callback at the end of the drag operation to read the stream.
  • But the problem is that stream needs to be read at the start of the drag operation whereas I need a callback at the end of the drag operation to read the stream.

    Stream can be read only after the drop, that is - at the end of drag&drop operation. In you code example, it seems that you forget if when converting the following to C++:

    d:   TNGFileArray;
    cnt: TNGFileContents;
    if C.Accept(CF.FILEDESCRIPTOR.Ref(@d)) and
       C.Accept(CF.FILECONTENTS.Ref(@cnt)) then

    C.Accept function allow to run the code under "if" only on drop (at the end of drag&drop operation), which is described in documentation.
  • Thank you for pointing out that fault.  I believe I now have two issues:

    1. From TNGDropTarget OnDragAction how do I convert the IStream to a Stream?  TStreamAdapter only works the other way around.  I can read the file again from the filename, but if there is a stream already I should not need to.

    2.With TNGDropSource adding TNGFileDescriptorFormat I get an exception on 32 bit but not 64 bit.
    TNGFileDescriptor fd;
    fd.Name = Filename;
    fd.Size = Size;
  • 1) content := TOleStream.Create(AContents[i]); This is shown in the included demo.

    2) Do I understand right: it compiles well, and rises the exception while runnig? Can you show the exception message?
  • 1. For C++ this works.
    std::unique_ptr<TOleStream> Stream(new TOleStream(Content[i]));
    std::unique_ptr<TMemoryStream> ConversionStream(new TMemoryStream);
    ConversionStream->CopyFrom(Stream.get(), Stream->Size);
    ConversionStream->Seek(0, soFromBeginning);

    2. Seems to be something to do with the way Delphi is using class methods which don't translate to C++.  I had to make a wrapper in Delphi around the code and call from C++ in order for it to work.

    Additionally you can't have the same control as both a source and target.  If you disable /enable the target at the start and end of mouse operations then it works.

    Now the last item is to see if I can change the stream so that it is only read when the file is dropped, not initially dragged.  If it is a long operation to read the stream then it is not so nice for the user to wait for a long time just because they clicked the mouse.

  • The answer to the last question is that I had to sub class TMemoryStream and override Seek, GetSize and Read.  What happens is the Read method is only called once the drop event occurs, so that fixed the asynchronous problem.  That saves reading the stream first and copying into the adapter stream.
Sign In or Register to comment.