Jump to content

LogSistemas01

Members
  • Posts

    45
  • Joined

  • Last visited

Posts posted by LogSistemas01

  1. As the picture below 

    Form.png

    My form is positioned below the "Adicionar" button and opened by the Show command.

    It can be found in the "Outros Dados" tabsheet in "PageControl_X" which is inside the "Cadastro de Pessoa" Screen, which is also inside a TabnSheet in "PageControl_Y"

    What I wanted is that when changing the tabsheet of PageControl_X or PageControl_Y, if the form is visible, the form would hide and when returning to the correct TabSheet, it would present again.

    I can even do this in the PageControl onChange event by calling the Hide option. but I'm having to have control variables for this, as the forms increase this can complicate it a little.

    If there were some way through web language to make it more automatic would be better.

    That is what I need, I hope it has become clear.

     

     

  2. Hello 

     

    I have a form where it appears as a popup, with the Show routine. It is invoked by a button inside a TabSheet. I wanted to know how I do to link this form to this tabsheet, that is, when changing tabsheet, it hides, when it comes back to it, it appears, because it will be in the tabsheet.

     

     

  3. I'd like you conditionals.

    I dont know if i will use madexcept, but thanks!

    Based on my tests, assigning True to Handled, the standard unigui warning of the error is not displayed,

    What would it be

    AlertDisabled := True;

    thanks!

  4. On 5/16/2020 at 5:31 AM, Abaksoft said:

     

    You can use  OnGetText property  (DataSet Field) :

    1. For a Persistent Field in this case "Etat" :

    
    
    procedure TFraDemandes.MyDataSetEtatGetText(Sender: TField; var Text: string;
      DisplayText: Boolean);
    begin
      if DisplayText then
      begin
        // Demandé
        if Sender.AsVariant = NULL then
           Text:= '<i class="fas fa-smile fa-2x " style=color:orange; ></i>'
    
        // Proposé
        else if Sender.AsInteger = 1 then
           Text:= '<i class="fas fa-smile fa-2x " style=color:green; ></i>'
    
        // Absent
        else if Sender.AsInteger = 2 then
           Text:= '<i class="fas fa-smile fa-2x " style=color:black; ></i>'
    
        // Traité
        else if Sender.AsInteger = 3 then
           Text:= '<i class="fas fa-smile fa-2x " style=color:grey; ></i>';
      end;
    
    end;

     

    2.  On an Optional Field (not existing in the DataBase)  like column Edit and Trash :

    You can Add theese two Fields on your SQL query :

    
      txtSQL:='Select TPL.IDPlaning,  .......' +
             _____________________________  
              '0 As Editer, 0 As Trash' +
             _____________________________    
    
              ' From TPLANINGS TPL ' +
              ' Join ....';
              
              

     

    with the same technic :

    
    
    procedure TFraDemandes.MyDataSetTrashGetText(Sender: TField; var Text: string;
      DisplayText: Boolean);
    begin
      if DisplayText then Text:='<i class="fas fa-trash"></i>';
    end;

     

     

     

    1.png

    Ah, I know this possibility, I used it only once, thanks for reminding me!

  5. Hello people,

    would I like to put an image of Fontawesome in the column of my grid?

    I managed to do it by putting in SQL:
     

    <i class = "far fa-edit"> </i>

    It worked, but it doesn't make much sense to have this information in SQL.

    I was wondering if there is another way?

    If it is possible to put a button too, then on that button I would put fontawesome.
    I searched the demos and didn't find it, I saw only one case with an image where canvas is used.
    If there is an easier way it would be good to know.

    And also if it is possible to make the HandPoint mouse cursor appear in the column with the image.


    Thank you guys!

  6. On 5/5/2020 at 12:22 PM, Mehmet Emin said:

    There is an event in servermodule may be it can help you (I have never used it). 

    procedure TUniServerModule.UniGUIServerModuleException(
      Sender: TUniGUIMainModule; AException: Exception; var Handled: Boolean);
     

     

     

    Thanks, I will try.

  7. Folks,

    at VCL, I did exception handling with TApplicationEvents.OnException

    All exceptions burst in this routine, I treated the way to display the message according to the type of exception, if it was a controlled exception, it shows a simple message, if not, it shows some other details.

    Is it possible to do this centralization of exception in Unigui?

    Through applicationevents it was not possible.

  8. Hello, I realized today that the problem of setfocus still occurs.

    I have the current trial version.

    The informed function JSCallDefer worked.

    If you do the same operation with Showmessage, it works normally with

    uniEdit.Setfocus;

    I don't know if it has already been fixed, I would open a topic, but as I located this topic, I'm just giving feedback here.

  9. Hello people,

    I had the following situation:

    I needed to change a mask at run time based on the index of a UniCombobox.

    If index 1, mask XXX
    If index 2, mask YYY.

    I resolved it as follows:

    UniEdit1.JSInterface.JSCode ('$ ("#' + UniEdit1.JSName + '_id-inputEl"). Inputmask ("999.999.999-99");');

    I just change the mask according to the index.

     

    I wanted to understand the following question:

    To apply css to a Unibutton for example, I add the css class to the button, as follows:

    UniButton.JSInterface.JSCall ('addCls', ['className']);

    This way the CSS is applied correctly.

     

    From what I've studied, this routine above is JQuery call (https://www.w3schools.com/jquery/html_addclass.asp).

    The example I reported for the mask is also JQuery call (https://plugins.jquery.com/jquery.inputmask/)

    I tried to call the mask routine in a similar way to the addClass routine, but without success.

    UniEdit1.JSInterface.JSCall ('inputmask', '999.999.999-99');
    

    I wanted to understand why JSCALL worked with addClass and did not work with inputmask?

    I may be making trouble with everything, if anyone can clear me up I would be grateful.

    How to make JQuery calls, Js I still don't understand, I'm confused, if someone has some study material and can indicate it would be good too.

    thank you.

    • Like 1
  10. 40 minutes ago, Mehmet Emin said:

    This advice is if you are using FireDAC but should be possible with other libs.

    To keep minimum database connections  at any one time, use "offlining connection" option of FireDAC combined with "connection pooling".

    This way you open the connection when you require and do your job and put it back to offline mode.

    These links has the information

    http://docwiki.embarcadero.com/RADStudio/Rio/en/Offlining_Connection_(FireDAC)

    http://docwiki.embarcadero.com/RADStudio/Rio/en/Multithreading_(FireDAC)     (Connection Pooling)

    Also check uniGUI docs for proper use of FireDAC components in multi threaded apps.

     

    Nice! Thank you!! I didnt know about "offlining connection".

  11. 52 minutes ago, NelZ said:

    Transform you system to work with rest server.. uses DataSnap or RestDataware.

    Each procedures/functions will create a connection in runtime, execute, and return a json.

    In UniGUI project, create process to call this rest server e process this json.

    In future, you architecture will works with any type of client side and will consume lowerest resource.

    Yes, we are studying restdataware.
    But until we learn, we are in that situation.

    But thanks for the advice.

    But what did you say, does restdataware automatically create and destroy the connection?

    Thank you again!

  12. Hello people,

    I'm starting at Unigui and doing VCL conversion. My team and I have the following scenario regarding connection to the database.

    We have a class that manages the connection to the database. Every time it is needed, it is created and connected to the database, and after completing the process it is destroyed. This way, at various times, the application will not be connected to the bank.

    In the other case, it would be to have the connection component in the MainModule connected all the time.

    I would like to know what you think would be better in terms of consuming less resources, since one option stays connected all the time and the other makes several connections?
    If anyone has or has had this scenario and can give some feedback, I would be grateful.

    Any tip is welcome.
    Thank you!

  13. Olá pessoal,

    Estou iniciando no Unigui e fazendo conversão do VCL. Eu e minha equipe temos o seguinte cenário referente conexão com o banco de dados.

    Temos uma classe que gerencia a conexão com o banco de dados. A cada vez que é necessário, ela é criada e conecta no banco do cliente, e após concluir o processo ela é destruída. Dessa forma, em vários momentos, a aplicação não estará conectada no banco.

    No outro caso, seria ter o componente de conexão no MainModule o tempo todo conectado.

    Gostaria de saber o que vocês acham que seria melhor em termos de consumir menos recursos, visto que uma opção se mantém o tempo todo conectado e o outro faz várias conexões ? 
    Se alguém tem ou já teve este cenário e puder dar algum feedback, ficaria agradecido.

     

    Qualquer dica é bem vinda.
    Obrigado!

     

  14. Hello, I'm starting at Unigui and converting a class, a Singleton.

    How to deal with this in Unigui, since it will have the same value between sessions and I need it to be different.

    It is a User class, where I store data and permissions, but I have other cases as well.

    I saw in the manual, an example where a record was created in MainModule, I would not like to have this 'dependency' there, is there another way to do this? Making my class a singleton per session ?

    Follow my class to analyze.

    type
      TSystem = class
      private
        constructor Create;
        destructor Destroy; override;
        class var FCompany: TCompanyController;
        class var FUser: TUserController;
      public
        class function LogIn(CompanyID: integer = 0; UserID: integer = 0): TCompanyController;
        class function LoggedUser: TCompanyController;
        class function LoggedCompany: TUserController;
      end;
    
    implementation
    
    
    { TSistema }
    
    constructor TSystem.Create;
    begin
    
    end;
    
    destructor TSystem.Destroy;
    begin
      inherited;
    end;
    
    class function TSystem.LoggedUser: TCompanyController;
    begin
      FCompany.RefreshConn;
      Result := FCompany;
    end;
    
    class function TSystem.LogIn(CompanyID: integer = 0; UserID: integer = 0): TCompanyController;
    begin
      try
        {Colocar destroy das classes no logout e finalization}
    
        if not Assigned(FUser) then
          FUser := TUserController.Create;
    
        if not Assigned(FCompany) then
          FCompany := TCompanyController.Create;
    
        FCompany.Get( CompanyID );
        FUser.Get( UserID, CompanyID);
    
        Result := FCompany;
      except
        on E: Exception do
        begin
          Raise;
        end;
      end;
    end;
    
    class function TSystem.LoggedCompany: TUserController;
    begin
      if not Assigned( FUser ) then
        raise Exception.Create('FUsuarioLogado não instanciado, realize o login na empresa!');
    
      FUser.RefreshConn;
      Result := FUser;
    end;
    
    initialization
    
    finalization
      if Assigned(TSystem.FCompany) then
        FreeAndNil(TSystem.FCompany);
    
      if Assigned(TSystem.FUser) then
        FreeAndNil(TSystem.FUser);
    
    
    end.

    Example:

    Open 2 Sessions

     

    1º Session

    TSystem.LogIn(1,1);
    
    ShowMessage(TSystem.LoggedUser.User.Name);

    Shows 'User 1'.

     

    2º Session

    TSystem.LogIn(2,2);
    
    ShowMessage(TSystem.LoggedUser.User.Name);

    Shows 'User 2'

     

    On 1º Session

    ShowMessage(TSystem.LoggedUser.User.Name);

    Also shows 'User 2'

     

    Thank you!

×
×
  • Create New...