Jump to content

limelect

Members
  • Content Count

    776
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by limelect


  1. Delphi 10.2.3
    I had a problem. 
    On my Vcl program i had ImageList with 250 bitmaps.
    When making the same project for Android (fmx)
    ImageList is not the same.To transfer all bitmaps 
    to fmx ImageList i made this program.

    1. Make a VCL project with a button. Close the project.
    2. Make new>Multi-Device form.
    3. place on it a button and ImageList.
    4. Make sure both forms have different name.
    5. Save and close.
    7. Open Vcl project.
    8. Add Fmx Form to the VCL project.
    9. Disregard ERRORS !!
    10. Add below program to fmx

     

    uses Unit2;

     

    procedure TForm1.Button1Click(Sender: TObject);
    var
      FileStream: TFileStream;
      MemStream: TMemoryStream;
      w, h, scale, iPos: Integer;
      btBitmap: tbitmap;
      si: TCustomSourceItem;
      d: TCustomDestinationItem;
      Layer: TLayer;
    begin
      for iPos := 0 to Form2.ImageList1.Count - 1 do
      begin
        btBitmap := tbitmap.create;
        btBitmap.PixelFormat := pf32bit;
        btBitmap.AlphaFormat := afIgnored;
        Form2.ImageList1.GetBitmap(iPos, btBitmap);
        MemStream := TMemoryStream.Create;
        btBitmap.SaveToStream(MemStream);
        si := ImageList1.Source.Add;
        si.Name := 'Source' + inttostr(iPos);
        scale := 1;
        si.MultiResBitmap.LoadItemFromStream(MemStream, scale);
        W := si.MultiResBitmap.Bitmaps[scale].Width; //Get width from scale
        H := si.MultiResBitmap.Bitmaps[scale].Height; //Get height from scale

        // Destination
        d := ImageList1.Destination.Add;
        Layer := d.Layers.Add;
        Layer.SourceRect.Rect := TRectF.Create(0, 0, W, H); // Create rect W x H
        Layer.Name := si.name;
        MemStream.Free;
        btBitmap.Free;
      end;

      MemStream := nil;
      FileStream := TFileStream.Create('MyList.DAT', fmCreate);
      try
        MemStream := TMemoryStream.Create;
        MemStream.WriteComponent(Form1);
        MemStream.Position := 0;
        ObjectBinaryToText(MemStream, FileStream);
      finally
        MemStream.Free;
        FileStream.Free;
      end;
    end;

     

    11. On vcl add

     

    uses Unit1;

     

    procedure TForm2.Button1Click(Sender: TObject);
    begin
       Form1.ShowModal;
    end;

     

    12. Execute vcl.
    13. Press button. Open fmx form.
    14. Press fmx button.
    15. MyList.DAT file is created which is realy 
        an fmx form with all bitmaps populated in
        in fmx ImageList1.
    16. To end rename MyList.DAT > Unit1.fmx so you end up with
        Unit1.pas and unit1.fmx.
    17. Close the project.
    18. Open your FMX project.
    19. Open UNIT1 in the project
    20. Copy ImageList1 from unit1 to your project.


    I hop it will help some one . And happy coding. 

    • Like 1

  2. @Gary Mugford

    Thanks  You seem to work on the same idea of mine.

    But i took out of the BPL the pascal files used in it.

    That is my starting point.

     

    What i wanted to achieve is to know all the USE of the components on my pallet.

    I thought if a new component is relaying on a BASE class derived from EMBARCADERO

    (Delphi) component i mite find the added property and that way know its use.

    Since i have huge amount of components i  do not remember most of there use

    and on a new project i mite miss some nice features.

    BUT it seem to be a huge effort . 

     

    My next step is i added a search of disk for PAS files so i will have them cataloged.

    Will see how it will be developed.

    Now i will have on one side all my pas files and on the other the BPL PAS files.

     

    Since i have 3 Delphi's on my disk i will have a problem in the future.

     

    P.S as a side value while loading a BPL to my program i had some

          ERRORS that i was NOT AWARE of.

    see Pas files To HTML on my program. VERY USEFUL.

     

    AND lastly the registry section for the  different Delphi which make this program

    only for  my Delphi and similar. 

      


  3. I need your attention to my program.

    I recently was wandering how do I find the class of a component
    in order to know what it is doing. After all I have more than 3000!
    Who remember the fine differences be twin them and even if I had
    only 100.
    The PE program did not help.
    So I started writing an investigating program.

    I came up with this program.
    For what is worth I put it on my Dropbox
    for you to download.
    It will be there for a while.

    So now can you have an idea how to solve
    my main curiosity?

    Going through all the pas files will be crazy
    and need to search them on the whole computer.
    Is this my only option ?

    Wile printing pas files there mite be some
    errors. See my HELP.

    My program

    https://www.dropbox.com/s/ns5ntzpd0kiiolg/Help.zip?dl=0

    Screenshot - 15_09_2019 , 12_42_42.png

    Screenshot - 15_09_2019 , 12_44_29.png

    • Like 1
    • Thanks 1

  4. At a time i got D7 for free with a license from Embarcadero\Borland

    I do not know if it still available.

     

    As for your problem delete all except the dpr and source and try to open\compile.

    If the dfm is as text look if it has information in it.

    If dfm is OK there should not be any problem opening the form

    unless the component are not in the IDE.

    Then i suggest another way.

    First see if the component can be installed on D2007.

    Usually no problem only translate to ANSI mostly.

    And one more possibility fetch from DFM the initialization

    of a component in the form move the component declaration

    to private and on form oncreate   put the DFM initialization.

    Hopefully the component can be compiled  without errors.

    All said if you got the components source !!!

     


  5. Since i am a Delphi developer since #1 and before 

    I am in favor D7 and D10.2.3.

    Delphi is stable unless you add on some staff

    that make it erratic.

    For example closing D7 give an error that

    i never bothered to fix (i know which add on dose it).

    Some times D10.2.3 dose the same on closing.

    But on a days work i did not experience any problem

    unless the components do a problem. 

     

    If one uses Delphi with nothing added no problem 

    experience.


  6. No i do not have RAD SERVER on my pallet.

    There is a project i wanted to see that uses that component.

     

    Latter I found a demo project that is using it "E:\Delphi_Programs\Delphi_DEMO\Object Pascal\Database\EMS\CustomLogin\CustomLoginPackage.dproj"

    in it there is a dpk but then i have a new problem  emsserverapi;

    well i am stack. it is a mess.


  7. @PeterBelow  No DPK no BPL? I have to make my own package? How come?

    Then which components are in C:\Program Files (x86)\Embarcadero\Studio\19.0\source\data\rest

    No "REGISTER" in any PAS file

    any link to procedure to register.

    And is this the only component in the above source?

     Although i am with Delphi since #1 never needed to do it that way 

×