Jump to content

herculanojs

uniGUI Subscriber
  • Posts

    565
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by herculanojs

  1. image.png.477cad09501f25cb03576de2b85b97b6.png

    I have the html code in a UniURLFrame with some components. How can I interact with the components inside the html code, reading and writing values.

    UniURLFrame1.HTML.LoadFromFile('files\login.html');

    I tried with the approach but I didn't get success
    UniSession.AddJS('document.getElementById("inputCPF").value = "36254569"');

    I haven't been able to find a solution on the forum yet.

    image.png

  2. On 8/26/2021 at 10:24 PM, Артем said:

    Última pergunta)

    No BPL, não posso criar o UniForm1 (como formulário livre)?

    Porque no BPL não existe MainModule e é por isso que eu não posso escrever:

    
    function UniForm1: TUniForm1;
    begin
      Result := TUniForm1(UniMainModule.GetFormInstance(TUniForm1));
    end;

     

    I think you have to understand the working dynamics of uniGUI forms regardless of bpl issue, as well as keep in mind that to deal with BPL you must work with object-oriented view and not procedural programming as is customary in Delphi.
    Bpl is nothing more than the box where things will be.
    If there is a form in bpl, you have to understand how uniGUI handles forms in order to create that form class that you pasted into bpl. You will create something derived from what is in bpl.
    Gives a look at object-oriented concepts

  3. 2 minutes ago, herculanojs said:

    If you are going to download the package, you must somehow keep the ID (hmodule) identifying the package associated with TabShett or the resource that loaded the package, in order to have the reference to release the package.

    Just closing and destroying the resource does not free the package from memory.

    MainProject.zip

  4. 4 minutes ago, Артем said:

    Então acontece que ao alternar entre diferentes TabSheet, que eu carreguei BPLs, eu tenho que globalmente em algum lugar no projeto principal para armazenar o nome do BPL, que está localizado na guia selecionada? Ou, mesmo assim, quando você excluir um TabSheet criado dinamicamente, todos os componentes, incluindo o BPL carregado nele, também serão excluídos e é isso?

    If you are going to download the package, you must somehow keep the ID (hmodule) identifying the package associated with TabShett or the resource that loaded the package, in order to have the reference to release the package.

    Just closing and destroying the resource does not free the package from memory.

  5. 6 minutes ago, Артем said:

    Ok, eu entendo você.

    Então, se no meu projeto principal criar novo TabSheet para o meu BPL, devo fechar este TabSheet e essa ação remover todos os componentes e recursos, usando de BPL carregado?

    Será outra coisa?

    I think it would be the steps:
    1) Load package - loadpackage()
    2) Create tabsheet - with frame
    3) Close tabsheet
    4) release package - unloadpackage()

    Or as I mentioned, you can create a control that identifies that there are new resources (bpls) that must be loaded, if the user is using any of these new bpls.
    Then inform him that he should reload the application for a new update.

     

    You don't need to scan components loaded in the package.
    Once you destroy the frame, the package can be released.

  6. 2 minutes ago, Артем said:

    Este?

    
    procedure TMainForm.DoUnloadPackage(Module: HModule);
    var
      i: Integer;
      M: TMemoryBasicInformation;
    begin
      { Make sure there aren't any instances of any
        of the classes from Module instantiated, if
        so then free them.  (This assumes that the
        classes are owned by the application) }
    
      for i := Application.ComponentCount - 1 downto 0 do
      begin
        VirtualQuery(
          GetClass(Application.Components[i].ClassName),
          M, SizeOf(M));
        if (Module = 0) or
          (HMODULE(M.AllocationBase) = Module) then
          Application.Components[i].Free;
      end;
      UnRegisterModuleClasses(Module);
      UnLoadPackage(Module);
    end;
    
    procedure TMainForm.UniButton1Click(Sender: TObject);
    var
      hm:Hmodule;
      FrC : TUniFrameClass;
      Frame : TUniFrame;
    begin
      hm := LoadPackage('Package1.bpl');
      if hm <> 0 then
      begin
        if FindClass('TUniFrameTest') <> nil then
        begin
          FrC := TUniFrameClass(FindClass('TUniFrameTest'));
          if FrC <> nil then
          begin
            frame := FrC.Create(self);
            frame.Align := alClient;
            frame.Parent := UniTabSheet1;
    
            if frame <> nil then
            begin
              if IsPublishedProp(frame,'GlobalValue') then SetPropValue(frame,'GlobalValue',UniEdit1.Text);
            end;
          end;
         end;
      end
      else
      begin
        //Unload package:
        DoUnloadPackage(hm);
      end;
    end;

     

    
     

     

    UnRegisterModuleClasses(Module);

    UnLoadPackage(Module);

     

    I think that alone is enough.
    Now as I already informed you, you won't be able to release a package while resources of it are being used.

    You instantiated a frame inside the package and are using it in a form. As long as this frame is not destroyed, this package cannot be released.

    To work with packages which will have form, frames, etc. must plan the application well in advance.

  7. 24 minutes ago, herculanojs said:

    show, thank you

     <iframe src="https://www.youtube.com/watch?v=zmkAlcOd_AA?rel=0&hd=0&autoplay=0" frameborder="0" width="300"></iframe>

    www.youtube.com refused the connection.

    What can it be?

    image.png.b97d24ce82d7afe601687a6625a053ab.png

  8. 17 hours ago, Артем said:

    Good day!
    Thank you very much for the answer.
    Do you mean to unload the BPL immediately after loading it in the main project? Can you show an example when uploading BPL? Because the code that I used, it does not work.

    You cannot download a package while using resources from the package.

  9. On 8/22/2021 at 9:32 PM, Артем said:

    Excellent, dear @herbernlopez! It's working! 🙏😃

    Thank's! 

    If I will have some question about this theme, I ask you!

    Now, I'm going think about new architecture of my project! 

     

     

    P.S.

    And I still have a couple of questions:
    1. If I add any forms, etc. to the BPL, will they receive a string value from my frame, which was connected as a BPL in the main project?
    2. What is the best way to develop a BPL: launch the IDE separately or use the menu in the screenshot above and add it as a file in the main project, working in one IDE?

    image.png.87e5c8641ca510da2a14fd86258a17f9.png

    3. How to recompile the BPL so that it can be loaded again in the main project without restarting the main project?
    I see the algorithm of actions as follows:
    1. Make changes to the BPL (add some components, code, expand its functionality);
    2. Compile the BPL file somewhere;
    3. Copy the compiled BPL to the folder where the main project looks for my BPL files;
    4. I click on the button in the main project and my BPL is loaded again, but the main project does not close and does not restart.

    There are two problems right now that I cannot fix:
    1. It is not possible to unload all packages and classes first (added the DoUnloadPackage function to the main project);
    2. And it is not possible to compile the BPL itself, tk. if you tell it the directory where to save, for example, like here:

    image.thumb.png.ddc953013c6df377c16e3f4ebe4454ba.png
    then a message is displayed that cannot be compiled. I believe this is due to the fact that the main project does not unload the loaded BPL file that I am trying to update.

    In general, please help with the elimination of problem number 1, or maybe problem number 2 will go away by itself later.

    If not for question # 3, everything works, BPL is loaded, but you have to restart the main project, which is wrong ... 🤔

    Test_new.zip 944,84 kB · 0 downloads

    You have to see how you will implement your scenario to avoid such problems.
    1) You can upload the BPL and after using it download it. This would avoid the issue of not being able to update.
    Without downloading the BPL, unfortunately, you will not be able to perform its update, and would have to be dropping the application to be able to perform this maintenance. So you have to think carefully about the construction of the project.

    You can also place updates in a verification directory for the application to read. When it finds a new update, it prompts open sessions to exit or sets a time for automatic termination. After the end of all sessions, then the application unloadpackages the loaded BPLs and properly replaces the new ones.

    Do not place the application running directly in the Delphi working directory where you compile the BPLs. Try to leave the test application running in another location.

  10. On 7/13/2019 at 4:10 PM, belo said:

    image.png.c764002fa266a73a72f35d3ccef82100.png

     

    
    .x-treelist-nav .x-treelist-item-text {
         line-height: 30px;
    }
     .x-treelist-nav .x-treelist-item-icon:before, .x-treelist-nav .x-treelist-item-tool:before, .x-treelist-nav .x-treelist-item-expander {
         line-height: 30px;
    }

    Regards,

    Eduardo Belo

    Where do I put the mentioned code?

  11. Se você quiser comunicação entre os objetos envolvidos, eles devem ter métodos que podem ser lidos ou escritos.
    Se você está no quadro e quer obter valor a partir do principal, você deve ter um método público no principal que lhe dá acesso e assim por diante.

    • Like 1
  12. On 4/11/2020 at 8:46 PM, Hayri ASLAN said:

    I am unable to run UniVideoPanel. I installed the component without problems, however when running the demo nothing happens.
    What can it be ?

     

    UniWebcam and UniVideoPanel.

     

    UniVideoPanel is a web video player built from the ground up for an HTML5 world. It supports HTML5 video and modern streaming formats, as well as YouTube, Vimeo, and even Flash.

    Screenshot_37.thumb.png.f84745788478e4a5f7a6aaaaa3b60e81.png

     

    UniWebCam : HTML5 Webcam Image Capture Library with Flash Fallback

    NOTE: YOU HAVE TO USE HTTPS TO WORK WITH CAMERAS.

    Screenshot_38.png.82c23599bbeb8d9158ff9eed8ef60e9c.png

     

     

    UniGUIOpenSource.zip 1.49 MB · 197 downloads

     

×
×
  • Create New...