Jump to content

MVakili

uniGUI Subscriber
  • Posts

    172
  • Joined

  • Last visited

  • Days Won

    9

Posts posted by MVakili

  1. Thank you for your follow up
    Yes, it may be because of CSS
    It is possible to write a simple CSS for me
    It is possible that I have used the wrong item in my instructions due to unfamiliarity with internal names
    In the submitted example, I tried to include the related CSS but the problem does not occur

  2. 1 minute ago, Sherzod said:

    Hello @MVakili

    Can you make a simple testcase to check?

    Hi @Sherzod

    It's really hard to make a simple testcase
    Because this is part of a big project
    But this is how it works
    1- I have a static one that looks like this

     object CFPageControl: TUniPageControl
            AlignWithMargins = True
            Left = 3
            Top = 3
            Width = 840
            Height = 383
            Hint = ''
            Align = alClient
            TabOrder = 0
            OnChange = FileView
            ExplicitLeft = 0
            ExplicitTop = 0
            ExplicitWidth = 846
            ExplicitHeight = 389
          end


    2- I create a tab for each sub-page, and its order is as follows

            With DM.VTsqlCommands Do
               Begin
    .....................
                  first;
                  while Not Eof do
                      Begin
                         EngTName := Dmt.Reg_TableName(FieldByName('CSqlCmd').AsString);
                         F:=False;
                         With CFPageControl Do
                         for I := 0 to PageCount-1 do
                             if Pages[I].Name=EngTName then
                                F:=True;
    
                         if Not F then
                            Begin
    .....................
    
                                           TabSheet := TUniTabSheet.Create(CFPageControl);
                                           TabSheet.PageControl := CFPageControl;
                                           TabSheet.Name :=  Trim(EngTName);
                                           TabSheet.Caption :=  FieldByName('Titr').AsString;;
                                           TabSheet.Hint := FieldByName('CSeq').AsString;
                                        End;
                                  End;
                            End;
                         Next;
                      End;


    Things I checked:
    1- set pagecontrol Margins, which finally got better but was not resolved
    2- I deleted the CSS, but it didn't change
    3- I set RTL to false , but it didn't make a difference

  3. 39 minutes ago, Naina DDK said:

    Please check UniGUI Demo (Dynamic Form)  it has sample code to create dynamic objects.

    You need make Parent and object Name are proper.

     

     

     

    Thank you for your explanation
    I have created dynamics, but I don't know why the flash hides in the corner to move in the sheets

  4. Solved 😀

    procedure TDMT.ShowListStart(TTl: STring);
    Var
       F : TUniForm;
       RollingStone : TUniHTMLFrame;
    Begin
    
        F := TUniForm(UniApplication.FindComponent('MyShowListName'));
        if Assigned(F) then
           FreeAndNil(F);
    
         F := TUniForm.Create(UniApplication);
         With F Do
            Begin
               AlignmentControl:=uniAlignmentServer;
               ClientHeight := 512 ;
               ClientWidth := 1248;
               OldCreateOrder := False   ;
               Width:=Round(Screen.Width/4);
               Height:=Round(Screen.Height/2);
               Left:=Screen.Width-Round(Screen.Width/8);
               Top:=Screen.Height-Round(Screen.Height/4);
               Position:=poScreenCenter;
               BorderStyle:=bsSingle;
               BorderIcons:=[biMaximize,biSystemMenu];
               Name:='MyShowListName';
               KeyPreview:=True;
               Rtl:=False;
               Caption:='';
               CaptionAlign:=taCenter;
               FormStyle:=fsStayOnTop;
               OnKeyDown:= KeyDownConfig;
               Caption:=TTl;
               FreeOnClose:=True;
    
            End;
         RollingStone:=TUniHTMLFrame.Create(F);
         With RollingStone Do
            Begin
               Parent:=F;
               AlignWithMargins := True;
               RTL := True;
               Align:=alClient;
               AutoScroll := True;
               Name:='MyShowListRollingStoneName';
            end;
       F.Show;
    
    End;

     

    • Like 2
  5. I use this procedure to create a runtime form with HTMLFrame

    procedure TDMT.ShowListStart(TTl: STring);
    Var
       F : TUniForm;
       RollingStone : TUniHTMLFrame;
    Begin
        F := TUniForm(UniApplication.FindComponent('MyShowListName'));
        if Assigned(F) then
           FreeAndNil(F);
         F := TUniForm.Create(UniApplication);
         With F Do
            Begin
    //           Parent:=MainForm;
               AlignmentControl:=uniAlignmentServer;
               ClientHeight := 512 ;
               ClientWidth := 1248;
               OldCreateOrder := False   ;
               Width:=Round(Screen.Width/4);
               Height:=Round(Screen.Height/2);
               Left:=Screen.Width-Round(Screen.Width/8);
               Top:=Screen.Height-Round(Screen.Height/4);
               Position:=poScreenCenter;
               BorderStyle:=bsSingle;
               BorderIcons:=[biMaximize,biSystemMenu];
               Name:='MyShowListName';
               KeyPreview:=True;
               Rtl:=False;
               Caption:='';
               CaptionAlign:=taCenter;
               FormStyle:=fsStayOnTop;
               OnKeyDown:= KeyDownConfig;
               Caption:=TTl;
               FreeOnClose:=True;
            End;
         RollingStone:=TUniHTMLFrame.Create(F);
         With RollingStone Do
            Begin
               Parent:=F;
               AlignWithMargins := True;
               RTL := True;
               Align:=alClient;
               AutoScroll := True;
               Name:='MyShowListRollingStoneName';
            end;
    
    End;

    And I use the normal form buttons to close it.
    This form closes without issue when called on a frame
    But if it is called while working on a form, the regular close button cannot close the form
    The form is designed as a server side


    How can I solve this problem?

  6. 7 hours ago, picyka said:

    The problem with these server side functions using the timer is that the unigui session doesn't die.

    in timer you can use a variable for counting and 

       Inc(C);
       if C>5 Then
          PingTimer.Enabled:=False;

    and in LPing.OnClick

    C:=0;
    PingTimer.Enabled:=True;

     

    • Like 1
  7. And finaly

    for this 

    image.png.72743b2839fae5b49514111d05c1006f.png

    you can use this function + Unitimer

    function TDMT.Ping2(const AHost: string): Integer;
    var
      ICMP: TIdICMPClient;
      Started: Tdatetime;
    begin
       Result:=-1;
      Started := Now;
      ICMP := TIdICMPClient.Create(nil);
      try
        ICMP.Host := AHost;
        ICMP.ReceiveTimeout := 2000;
        ICMP.Ping();
        If  (ICMP.ReplyStatus.ReplyStatusType = rsEcho) Then
          Result:=MilliSecondsBetween(TDateTime.Now, Started);
    
      finally
        ICMP.Free;
      end;
    end;

    in timer

    procedure TMainForm.UniTimer1Timer(Sender: TObject);
    Var
       T : Integer;
       
    begin
       T:=Ping2('1.1.1.1');
       if T>=0 then
          LPing.Caption:=T.ToString+ ' ms'
       Else
          LPing.Caption:= ' Error';
    end;

     

    and for program server as @Sherzod guide me we can use this code

    Function UniServer(Var RetParams : Tstringlist):Integer;
    begin
      With RetParams Do
         Begin
            Add('Memory Used:'+UniServerModule.ServerResources.MemoryUsed.ToString+'/'+UniServerModule.ServerResources.PeakMemoryUsed.ToString);
            Add('Process Memory Used:'+UniServerModule.ServerResources.ProcessMemoryUsed.ToString+'/'+UniServerModule.ServerResources.PeakProcessMemoryUsed.ToString);
            Add('USER Objects:'+UniServerModule.ServerResources.USERObjects.ToString+'/'+UniServerModule.ServerResources.PeakUSERObjects.ToString);
            Add('GDI Objects:'+UniServerModule.ServerResources.GDIObjects.ToString+'/'+UniServerModule.ServerResources.PeakGDIObjects.ToString);
            Add('CPU Usage:'+FloatToStr(UniServerModule.ServerResources.CPUUsage)+'/'+FloatToStr(UniServerModule.ServerResources.PeakCPUUsage));
            Add('Handles:'+UniServerModule.ServerResources.Handles.ToString+'/'+UniServerModule.ServerResources.PeakHandles.ToString);
         End;
    end;

     

    • Like 3
  8. Just now, Sherzod said:

    No, the ping must be from the client side...

    In fact, I want to display the client's connection speed to the software (which is hosted on the server). 
    After that, I need to know the speed of the software's connection to the data server (which can be located in different places in our designs). 
    And finally, I need to know the status of the server for processing tasks (whether it is involved in heavy processing or not).

    image.png.a7c8dc34769991b7375dbb9238b76e58.png

  9. I think this code is useful for checking ping time to a server
     

    Function Ping(const Host: string; Port: Integer):Integer;
    var
      Started: Tdatetime;
      Http: TIdHTTP;
    begin
      Started := Now;
      Http := TIdHTTP.Create(nil);
      try
        try
          Http.Get('http://' + Host + ':' + IntToStr(Port));
          Result:=MilliSecondsBetween(TDateTime.Now, Started);
        except
          // this is expected
        end;
      finally
        Http.Free;
      end;
    end;



     

       if IsConnected then
          Caption:='Connected'+IntToStr(Ping('Server',any port))
       Else
          Caption:='Not Connected'

     

  10.  

    Yes, that's correct.
    In fact, the problem consists of several parts:
    1. Is there a connection to the server?
    2. What is the speed of the connection to the server?
    3. What is the speed of the connection between the program and the database?
    4. What is the CPU processing power?
    And similar questions.

     

    The goal is actually to be able to check the required aspects on the client side and make the user aware of potential bottlenecks in the operations.
     

  11. 12 minutes ago, irigsoft said:
    Thank you for your quick reply
    But I don't know how to use these codes in UniGui 
    We used to use this method to connect to the Internet
    
    
    function YourFunctionName : boolean;
      var
         origin : cardinal;
      begin
         result := InternetGetConnectedState(@origin,0);
    
         //connections origins by origin value
         //NO INTERNET CONNECTION              = 0;
         //INTERNET_CONNECTION_MODEM           = 1;
         //INTERNET_CONNECTION_LAN             = 2;
         //INTERNET_CONNECTION_PROXY           = 4;
         //INTERNET_CONNECTION_MODEM_BUSY      = 8;
      end;

     

  12. image.png.072921f156aea692edc45f12a3c4a62d.png

    I want to display the internet connection and Ping speed similar to what we see in the image at the top of the program to the user.
    Has anyone had any experience in this field?
     
  13. On 7/29/2023 at 7:37 PM, Eugeniusz Rink said:

    Hi MVakili.

    Why do you only provide .pas files in your published project?

    Easier to post a custom sample project.

    I apologize for the delayed response.

    Yes, you are right. I wasn't paying attention to the forms when I was copying.

    Anyway, it wasn't a big deal. There was only one form with a popup on it. The most important part was the definition that @Sherzod had provided, which can also be seen in the program's text.

    type
      TXPopupMenu = class(TUniPopupMenu)
    
      end;

    and for using css

       TXPopupMenu(UniPopupMenu1).MenuControl.JSInterface.JSCall('addCls', ['uni-popup']);

    and my css for popup

    .x-title.x-menu-header-title {
        height: 25px;
        text-align: center;
        font-weight: bold;
        background-image: linear-gradient(#dae7f6, #cddef3 45%, #abc7ec 46%, #abc7ec 50%, #b8cfee 51%, #cbddf3);
    
    }
     .uni-popup {
      position: absolute;
      display: none;
      background-color: #f1f1f1;
      min-width: 160px;
      box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
      z-index: 1;
    }
    
    .uni-popup a {
      color: black;
      padding: 12px 16px;
      text-decoration: none;
      display: block;
    }
    
    .uni-popup a:hover {
      background-color: #ddd;
    }
    
    .uni-popup.show {
      display: block;
    }
    .dropdown-content {
      display: none;
      position: absolute;
      background-color: #f1f1f1;
      min-width: 160px;
      box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
      padding: 12px 16px;
      z-index: 1;
    }
    
    .dropdown:hover .dropdown-content {
      display: block;
    }

    And finally you can download full project 

    Sample XPop.rar

    • Like 1
  14. 20 hours ago, Sherzod said:

    ClientEvents.UniEvents.Values['pagingBar.beforeInit']:=

    thank you
    Your solution worked
    one more question
    When I activate the row number, it starts from 1 on each page
    Is there a way to make it persistent instead of resetting every time?

  15. 10 hours ago, Sherzod said:

    Hello, 

    Yes, because you didn't copy correctly. Please be careful. Missing { character before config.

    Thank you
    No more errors
    But he didn't do anything!
     

    image.png.0c0605dbeb982d9c1cc72c3e3c8ea6cb.png
    In fact, I need to know how many records I have out of all the records in the dataset (RecNo/RecordCount)
    And I don't know how to get it

    Is it possible to modify the code?

×
×
  • Create New...