Jump to content

robinhodemorais

uniGUI Subscriber
  • Posts

    166
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by robinhodemorais

  1. On 5/8/2013 at 7:36 AM, estrify said:

    Go to panel's ClientEvent -> UniEvents -> OnBeforeInit and add the following:

     

    function OnBeforeInit(sender)

    {

          Ext.apply(sender, {

                style: 'opacity: 0.5;'

          });

    }

     

    Regards,

    I tried to do the same in version 1531 but it didn't work ....


  2. try the following format, download jquery.maskedinput.min.js and jquery.min.js, in custom files declared as not ClientEvents> UniEvents should not be placed beforeInit:

    beforeInit function (sender, configuration)
    {
    Ext.onReady (function () {
    $ ("#" + sender.id + "- inputEl"). mask ("(99) 9999-9999? 9");
    });
    }

    but it didn't work, how can I do that?

  3. I have the StringGrid already configured to contain 24 columns and 40 rows through RowCount and ColCount of StringGrid, to write these values and make a query in my table and perform a loop in quary to pass the values to each cell of the stringgrid.

    Anyway that is filled by the StringGrid, is there no way to change the height of the line? because passing this stringgrid.ColWidths [0] value: = 0; I can hide the column but passing stringgrid.RowHeights [0]: = 0; it does not change the Heights of line 0;

    image.png.4ff4cd89007049a88bbef165facbdde3.png

  4. 4 minutes ago, Sherzod said:

    Can you please explain in more detail?!

    For example, forming an image, without a red rectangle, is two lines of line grid, it is a line 0 and a line 1, how do I hide these lines? if I can pass the height: = 0 parameter how to do the width: = 0 columns, it would work, but we cannot change the height of the specific stringgrid line.

  5.  

    I have a report that I set up on StringGrid, because it got better on it with the manipulation of cores and data by cells, I have 2 first columns that already hide them by passing or colWidth: = 0; however, I need to do this in 2 lines as well, like the first two lines, they use their value for account reports, but they should not be visible to the user, so how can you hide these two lines?
    A single alternative that is done for now changes the value of the blank, but it remains two lines of the string drop.

    Screenshot_6.png

  6. 14 hours ago, azago said:

    Starting an exe is a purely delphi language solution (no UniGUI).
    It all depends on whether you need a return output from running the process.
    In the latter case you have to use a semaphores management (also via file).

    However I have used it in UNIGUI in this way:

    // call
    var
       NameExec     : string;
       NameFileJSON : string;
       rc       : word;
    begin
        // exec process
        if dmDataset.ExecFile(NameExec, NameFileJSON, rc) then begin
           // timer OnThreadTerminate type TUniTimer for file response
           OnThreadTerminate.Enabled := True;
        end;        
    end;

    // function in Datamodule
    function TdmDataset.ExecFile(const sComand, sParameter : string; var rc : word) : boolean;
    var
       SI                        : TStartupInfo;
       PI                        : TProcessInformation;
       sCmd                    : string;
    begin
       Result             := True;

       FillChar(SI, SizeOf(SI), 0);
       SI.cb := SizeOf(SI);
       SI.wShowWindow := SW_SHOWMINNOACTIVE;

       sCmd := sComand;
       if sParameter > '') then sCmd := sCmd + ' ' + sParameter;

       if (Not CreateProcess(Nil, PChar(sCmd), Nil, Nil, False,
                 Normal_Priority_Class, Nil, Nil, SI, PI)) then begin
          rc     := GetLastError;
          Result     := (rc = 0);
          exit;
       end;

       CloseHandle(PI.hThread);
    end;

    procedure OnThreadTerminateTimer(Sender: TObject);
    var
       FFolder     : string;
       Sr          : TSearchRec;
       FileDownload: string;
       SearchStr   : string;
    begin
       // Response dir     
       FFolder := IncludeTrailingPathDelimiter(UniMainModule.Configurazione.PathLocal);

       SearchStr    := '*.json';

       if SysUtils.FindFirst(FFolder + SearchStr, faAnyFile, Sr) = 0 then
       begin
          repeat
             if Sr.Attr and faDirectory = 0 then begin
                if UpperCase(ExtractFileName(ChangeFileExt(Sr.Name, ''))) = 'RESPONSE' then begin
                   // fistr disable
                   OnThreadTerminate.Enabled := False;

                   // action business -- download -- other ---
                   UniSession.SendFile(IncludeTrailingPathDelimiter(UniMainModule.Configurazione.PathLocal) + ExtractFileName(Sr.Name), FileDownload);

                   // send message
                   dmToast.Success('Download. Scarico eseguito.');

                   Break;
                end;
             end;
          until SysUtils.FindNext(sr) <> 0;
          SysUtils.FindClose(sr);
       end;
     

    how do i call a stick or pass a command with that function you did?

  7. WinExec ('e:\Robinho\webSocket\startNodeJS.bat', SW_SHOW);


    in a test in vcl it executes, but that same command by unigui does not execute the command

  8. Looking for how to run a stick with a single topic from that topic http://forums.unigui.com/index.php?/topic/3356-how-to-call-a-executable-file-on-server-side-within- unigui / where mhmda passes a procedure to execute, but I'm trying to implement it in my application and I'm not getting it ...
    when I'm in the development environment running autonomously, I need to execute a stick that is at the root of the root, this type of stop starts the service node of the service, or what I notice is that it appears quickly or that closes but I I can see something.

    in the bat file is in the following configuration

    Quote

    cd E: \ Delphi Projects \ socket
    server.js node

    bat name startNodeJS.bat

  9. 9 hours ago, JarekZ said:

     const
         SERVER_PORT='888';
         SERVER_ROOT='api';

     

    type
      TSQLRestServerTest = class(TSQLRestServerDB)

      published
        procedure Sum(Ctxt: TSQLRestServerURIContext);
        procedure MaxId(Ctxt: TSQLRestServerURIContext);

    end;

    ....

    var
      SerwerXL: TSerwerXL;
      aModel: TSQLModel;
      aProps: TSQLDBConnectionProperties;
      aRestServer:TSQLRestServerTest;
      aHttpServer: TSQLHttpServer;

     

    procedure TSQLRestServerTest.Sum(Ctxt: TSQLRestServerURIContext);
    var a,b: double;
        res: ISQLDBRows;
    begin

      if UrlDecodeNeedParameters(Ctxt.Parameters,'A,B') then begin
        while Ctxt.Parameters<>nil do begin
          UrlDecodeDouble(Ctxt.Parameters,'A=',a);
          UrlDecodeDouble(Ctxt.Parameters,'B=',b,@Ctxt.Parameters);
        end;

        Ctxt.Results([a+b],HTTP_SUCCESS,TEXT_CONTENT_TYPE_HEADER);

    end;

     

    procedure TSQLRestServerTest.MaxId(Ctxt: TSQLRestServerURIContext);
    var a,b: Integer;
        res: ISQLDBRows;
        id:Int64;
    begin

      if UrlDecodeNeedParameters(Ctxt.Parameters,'idpos,rodzaj') then
       begin
        a:=Ctxt.InputInt['idpos'];
        b:=Ctxt.InputInt['rodzaj'];
          if (a<>0) and (b<>0) then
           begin
            res:=aProps.ExecuteInlined('Exec NSMaxNumer '+IntToStr(a)+','+IntToStr(b),true);

            Ctxt.Returns(res.FetchAllAsJSON(true),HTTP_SUCCESS,TEXT_CONTENT_TYPE_HEADER);
           end
          else
           Ctxt.Returns('Error',HTTP_SUCCESS,TEXT_CONTENT_TYPE_HEADER);

      end else
       begin
        Ctxt.Returns('Error',HTTP_SUCCESS,TEXT_CONTENT_TYPE_HEADER);

       end;

    end;

     

    procedure TSerwerXL.ServiceStart(Sender: TService; var Started: Boolean);
    begin
     try
       CoInitialize(nil);
       SQLite3Log.Family.Level := LOG_VERBOSE;// STACKTRACE;
       SQLite3Log.Family.PerThreadLog := ptIdentifiedInOnFile;

       aProps := TOleDBMSSQL2012ConnectionProperties.Create(AdresIP

                                                          ,DataBase
                                                          ,DBUser
                                                          ,DBPassword);
       aModel := DataModel(SERVER_ROOT);
       VirtualTableExternalRegisterAll(aModel,aProps);
        try
          // create the main mORMot server
          aRestServer := TSQLRestServerTest.Create(aModel,true);
          // TSQLRestServerDB.Create(aModel,false); // authentication=false
          try
            // create tables or fields if missing
            try
             aRestServer.CreateMissingTables;
            except

            end;

            aRestServer.AcquireExecutionMode[execORMWrite]:=amBackgroundThread;
            aProps.ConnectionTimeOutMinutes:=10;
            aRestServer.DB.Synchronous:=smOff;
            aRestServer.DB.LockingMode:=lmExclusive;

             aHttpServer := TSQLHttpServer.Create(SERVER_PORT,[aRestServer],'+',HTTP_DEFAULT_MODE,32,secSynShaAes);

            try
              aHttpServer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries
            finally
            end;

          finally
          end;

        finally
        end;
      finally
      end;
     Started:=true;
    end;

     

    in uDataModel.pas

    type TSQLSTORNO=class(TSQLRecord)
       private
        fID_KASJERA   :INTEGER;
        fID_TOWARU    :Int64;
        fILOSC        :real;
        fCENA         :real;
        fRODZAJ       :RawUtf8;
        fID_PARAGONU  :Int64;
        fID_POZYCJI   :Int64;
        fDATA         :TDatetime;
        fWYSLANE      :INTEGER;
        fID_POS       :Integer;
       published
        property ID_KASJERA   :INTEGER read fID_KASJERA write fID_KASJERA;
        property ID_TOWARU    :Int64 read fID_TOWARU write fID_TOWARU;
        property ILOSC        :real read fILOSC write fILOSC;
        property CENA         :real read fCENA write fCENA;
        property RODZAJ       :RawUtf8 read fRODZAJ write fRODZAJ;
        property ID_PARAGONU  :Int64 read fID_PARAGONU write fID_PARAGONU;
        property ID_POZYCJI   :Int64 read fID_POZYCJI write fID_POZYCJI;
        property DATA         :TDatetime read fDATA write fDATA;
        property WYSLANE      :INTEGER read fWYSLANE write fWYSLANE;
        property ID_POS       :Integer read fID_POS write fID_POS;
    end;

    function DataModel(const RootURI: RawUTF8): TSQLModel;

     

    function DataModel(const RootURI: RawUTF8): TSQLModel;
    begin
     result := TSQLModel.Create(TSQLSTORNO[ ],RootURI);
    end;

     

     

    http://localhost:888/api/sum?a=1&amp;b=2.44

    or

    http://localhost:888/api/storno

     

    this is how it looks in general. Launched as a widows service together with unigui.
    This will not work with hyperserver

     

     

    Thanks for the help, you will do some tests, but it will not work with Hypper Server, you will not be able to put it into production, but in any case it will be used for studies .....

    A doubt, do you know the features of the onHttpDocument and onHttpCommand events?

  10. 1 hour ago, JarekZ said:

    What is the API supposed to do? Give a specific example of a function.

    i need to set up an api that will receive a post, this post will be a json of some information

  11. 5 hours ago, MOGSY said:

    This is very usful for many situations.

    Regards

    I really need it too and if the unigui naturally has this feature it will be fantastic, but I didn't find anything helping with these servermodule resources

×
×
  • Create New...