Jump to content

ChrisChuah

Members
  • Content Count

    121
  • Joined

  • Last visited

Posts posted by ChrisChuah


  1. 1 hour ago, ChrisChuah said:

    Hi

    I tried to install Indy 10.6.2 into Delphi 6.

    First I would need to recompile the CompUtils.dpr under delphi 6 running in Windows XP as i think the CompUtils.exe is not meant for Win XP.

    After compiling that into CompUtils.exe, i run the fulld_6.bat in terminal mode

    Once that has been done,

    Open the Delphi 6 and compile the package IndyCore60.dpk.  When i tried to install it, it prompted me "Cannot load package IndySystem60. It contains unit IdWinSock2 which is also contained in Package Indy60."

    Then i recompile and install dclIndyCore60.dpk and it came out the same message. "Cannot load package IndySystem60. It contains unit IdWinSock2 which is also contained in package Indy60

    Then i recompile and install IndySystem60.dpk and another message "Cannot load IndySystem60. It contains unit IdGlobal which is also contained in package Indy60.

     

    Where is Indy60 package?

    I tried to look for it but cant find it.

    please advise

     

    regards

    chris

     

    Finally managed to install Indy 10 on Delphi 6.

    I need to remove the indy60.bpl files from c:\windows\system32 as well as c:\program files\borland\delphi6\projects\bpl

    also remove all the indy*.bpl from those 2 directories and install the delphi 10 dpk file

     

    seems like need to install packages from different directories as compared to Indy9

    Install the design package from Core then Protocol directory. 

     

    Is this correct?

     

    regards

    chris


  2. On 8/1/2021 at 9:11 PM, mjustin said:

     

    Indy 9.0.50 can be downloaded here:

    https://github.com/IndySockets/Indy9

     

    Indy 10.6.2 works with Delphi 6 and can be downloaded here:

    https://github.com/IndySockets/Indy <== Downloaded the package from here

     

    Hi

    I tried to install Indy 10.6.2 into Delphi 6.

    First I would need to recompile the CompUtils.dpr under delphi 6 running in Windows XP as i think the CompUtils.exe is not meant for Win XP.

    After compiling that into CompUtils.exe, i run the fulld_6.bat in terminal mode

    Once that has been done,

    Open the Delphi 6 and compile the package IndyCore60.dpk.  When i tried to install it, it prompted me "Cannot load package IndySystem60. It contains unit IdWinSock2 which is also contained in Package Indy60."

    Then i recompile and install dclIndyCore60.dpk and it came out the same message. "Cannot load package IndySystem60. It contains unit IdWinSock2 which is also contained in package Indy60

    Then i recompile and install IndySystem60.dpk and another message "Cannot load IndySystem60. It contains unit IdGlobal which is also contained in package Indy60.

     

    Where is Indy60 package?

    I tried to look for it but cant find it.

    please advise

     

    regards

    chris

     


  3. hi

    attached is the code whereby it generated the error.

    The funny thing is that this app can run on other machines without error but only that particular machine.

     

    procedure TDataModule1.loadFilterTable;
    var
      l_str : string;
      l_ini : TIniFileEx;
      l_fieldList : string;
    begin
      if (trim(FFilterDay) = '') and (Trim(FFilterOthers) = '') then
        l_str := ''
      else if (Trim(FFilterDay) = '') and (Trim(FFilterOthers) <> '') then
        l_str := Trim(FFilterOthers)
      else if (Trim(FFilterDay) <> '') and (Trim(FFilterOthers) = '') then
        l_str := Trim(FFilterDay)
      else
        l_str := Trim(FFilterDay) + ' and ' + Trim(FFilterOthers);
      cdsDYNAFLTS.Close;
      qyDYNAFLTS.Close;
      if DataModule1.getLoginSuccess then begin
        try
          cdsDYNAFLTS.IndexName := '';
          cdsDYNAFLTS.Filter := '';
          cdsDYNAFLTS.Filtered := false;
          qyDYNAFLTS.SQL.Clear;
          l_Ini := TIniFileEx.create(ChangeFileExt(Application.ExeName, '.ini'));
          l_fieldList := l_ini.ReadString(DYNAFLTS_TABLE, INI_SECT_FIELDS, '');
          // cc : if the field list is still empty, then make it a *
          if Trim(l_fieldList) = '' then
            l_fieldList := '*';
          l_ini.Free;
          qyDYNAFLTS.SQL.Add('SELECT ' + l_fieldList + ' FROM ' + DYNAFLTS_TABLE );
          if l_str <> '' then
            qyDYNAFLTS.SQL.Add(' WHERE ' + l_str);
          DoLog('LoadTableData2 SQL: ' + qyDYNAFLTS.SQL.Text);
          cdsDYNAFLTS.ProviderName := '';
          cdsDYNAFLTS.ProviderName := 'dspDYNAFLTS';
          cdsDYNAFLTS.Active := true; <== when open is called, the BeforeOpen will be logged. However the afterOpen is not called
        except
          on e:Exception do begin
            if not CheckDBConnectionError(e.message) then
              DoLog('Error in LoadFilterTable: ' + e.message); <== this will log down the access violation as shown int he log
          end;
        end;
      end;

    end;
     


  4. Hi

    I am having a problem with this function. When issued a ClientDataset.open, the Before Open event is triggered but before the After event is triggered, it returned an Access violation

     

    ==== Access Violation Log =====

    22-12-7 14:46:48-10.100.252.26> LoadTableData2 SQL: SELECT ROW_ID,CREATED_AT,CREATED_BY,FIDSID,AODBID,EVENT,FLIGHT,DOMINT,SDT,TABLENAME,TABLENUMBER,XMLFILE FROM DYNAFLTS
     WHERE (CREATED_AT>=1670342400 and CREATED_AT<1670428800)

    <22-12-7 14:46:48-10.100.252.26> cdsDYNAFLTS Before Open
    <22-12-7 14:46:48-10.100.252.26> Error in LoadFilterTable: Access violation at address 00F5CC2B in module 'FidsEventViewer.exe'. Read of address 00000000
    <22-12-7 14:46:48-10.100.252.26> App Exception: cdsDYNAFLTS: Cannot perform this operation on a closed dataset
    === =========

     

    ==== Normal log on other machine ====

    <7/12/2022 2:53:56 pm-192.168.0.124> LoadTableData2 SQL: SELECT ROW_ID,CREATED_AT,CREATED_BY,FIDSID,AODBID,SDT,FLIGHT,DOMINT,TABLENAME,EVENT,XMLFILE FROM DYNAFLTS
     WHERE (CREATED_AT>=1670342400 and CREATED_AT<1670428800)

    <7/12/2022 2:53:56 pm-192.168.0.124> cdsDYNAFLTS Before Open
    <7/12/2022 2:53:56 pm-192.168.0.124> cdsDYNAFLTS Start AfterOpen
    <7/12/2022 2:53:56 pm-192.168.0.124> cdsDYNAFLTS Start read INI
    <7/12/2022 2:53:56 pm-192.168.0.124> cdsDYNAFLTS End read INI
    <7/12/2022 2:53:56 pm-192.168.0.124> cdsDYNAFLTS Assign Field to process
    <7/12/2022 2:53:56 pm-192.168.0.124> cdsDYNAFLTS End AfterOpen
    =============

     

    In my code, the SQL is added to TQuery

    The Client dataset is link to the Provider. The provider is linked to TQuery.

     

    This application is run on another machine without this error but always gives an access violation on this machine.

    Is there a "cache" file that ClientDataset would read after the BeforeOpen event?

     

    Please advise

    regards

    chris

     


  5. Hi

    In Windows, there is a TWinExit component to allow us to reboot the OS from our software.

    Is there one that can reboot the Linux OS?

    Or is there a script component whereby the software can call it to reboot?

    please advise

     

    regards

    chris

     


  6. hi

    here is the getItInstall.log.

    From GitHub, it states that SynEdit supports up to Delphi 10.4

    Could this error due to not able to support 11.1?

     

    regards

    chris

     

    ====== Start ======

    [2022-08-29 09:28:55] [DEBUG] GetIt: Loading EULAS...
    [2022-08-29 09:29:02] [DEBUG] GetIt: Installing Library "SynEdit for VCL"...
    [2022-08-29 09:29:03] [DEBUG] GetIt: Downloading Library "SynEdit for VCL"...
    [2022-08-29 09:29:07] [DEBUG] GetIt: Extracting Library "SynEdit for VCL" to "C:\Users\chuahyen\Documents\Embarcadero\Studio\22.0\CatalogRepository\SynEdit-2022.03-11\". This could take a while...
    [2022-08-29 09:29:08] [DEBUG] GetIt: Compiling project "SynEditDR.dproj"...
    [2022-08-29 09:29:13] [DEBUG] GetIt: Problem occurred when compiling for "Win64" platform with "Release" configuration.
    [2022-08-29 09:29:15] [DEBUG] GetIt: Problem occurred when compiling for "Win64" platform with "Debug" configuration.
    [2022-08-29 09:29:17] [DEBUG] GetIt: Problem occurred when compiling for "Win32" platform with "Release" configuration.
    [2022-08-29 09:29:18] [DEBUG] GetIt: Problem occurred when compiling for "Win32" platform with "Debug" configuration.
    [2022-08-29 09:29:19] [DEBUG] GetIt: Error when executing an action of "SynEdit for VCL" catalog. The action is "CompileProject" (ID 6).
    [2022-08-29 09:29:19] [DEBUG] GetIt: A problem occurred during the process.
    [2022-08-29 09:29:26] [DEBUG] GetIt: Cancelling process...
    [2022-08-29 09:29:39] [DEBUG] GetIt: Loading EULAS...
    [2022-08-29 09:29:41] [DEBUG] GetIt: Installing Library "SynEdit for VCL"...
    [2022-08-29 09:29:41] [DEBUG] GetIt: Downloading Library "SynEdit for VCL"...
    [2022-08-29 09:29:42] [DEBUG] GetIt: Extracting Library "SynEdit for VCL" to "C:\Users\chuahyen\Documents\Embarcadero\Studio\22.0\CatalogRepository\SynEdit-2022.03-11\". This could take a while...
    [2022-08-29 09:29:42] [DEBUG] GetIt: Compiling project "SynEditDR.dproj"...
    [2022-08-29 09:29:45] [DEBUG] GetIt: Problem occurred when compiling for "Win64" platform with "Release" configuration.
    [2022-08-29 09:29:47] [DEBUG] GetIt: Problem occurred when compiling for "Win64" platform with "Debug" configuration.
    [2022-08-29 09:29:48] [DEBUG] GetIt: Problem occurred when compiling for "Win32" platform with "Release" configuration.
    [2022-08-29 09:29:50] [DEBUG] GetIt: Problem occurred when compiling for "Win32" platform with "Debug" configuration.
    [2022-08-29 09:29:50] [DEBUG] GetIt: Error when executing an action of "SynEdit for VCL" catalog. The action is "CompileProject" (ID 6).
    [2022-08-29 09:29:50] [DEBUG] GetIt: A problem occurred during the process.
    [2022-08-29 09:32:26] [DEBUG] GetIt: Cancelling process...
    ===== End =======


  7. Hi 

    Is there a XML Viewer component rather than using the TWebBrowser component?

    Although i can use the TMemo component to load the xml but the output is not that pretty.

    Please advise

     

    regards

    chris


  8. We are just learning. I am still learning too

    I tried not to create the form but to call showmodal each time user click on the update button

    But i will get a problem is that cannot Showmodal when the form is visible.

    In the FormClose of aircrafttype form, i set it to caHide instead of caFree

    and i have that error.

     

    I feel that even though i have use delphi since Delphi 1, i am still learning how to use this language.

    Delphi 6 was the most stable version that i used and I am still using that now to do minor changes to those application written in 2007.

     


  9. The DetailForm close event will have Action := caFree

    I tried this way

     

    ===== Ghosting Windows

    procedure DisableProcessWindowsGhosting;

    var
      DisableProcessWindowsGhostingProc: procedure;
    begin
      DisableProcessWindowsGhostingProc := GetProcAddress(
        GetModuleHandle('user32.dll'),
        'DisableProcessWindowsGhosting');
      if Assigned(DisableProcessWindowsGhostingProc) then
        DisableProcessWindowsGhostingProc;

    end;

     

    begin
      Application.Initialize;
      DisableProcessWindowsGhosting;
      TStyleManager.TrySetStyle('Iceberg Classico');
      Application.CreateForm(TDataModule1, DataModule1);
      Application.CreateForm(TfrmMain, frmMain);
      Application.Run;
    end.
    =======================

     

    But will also have the same effect that open and close the form too many times will result in hanging of the application or the form will not show.

     

    Only when i removed the Style Manager, then i will not have this problem.

    The Grid is also having its own DrawColumnCell Event

     

    =====================

    procedure TfrmMain.dbgACTDrawColumnCell(Sender: TObject; const Rect: TRect;
      DataCol: Integer; Column: TColumn; State: TGridDrawState);
    var
      l_bitmap : TBitmap;
      l_rect : TRect;
      l_bmpWidth, l_width : integer;
      l_str : string;
    begin
      with dbgACT do begin
        if (gdSelected in State) then begin
          Canvas.Font.Color := clBlack;
          Canvas.Brush.Color := clLime;
        end
        else begin
          if ( (DataSource.Dataset).RecNo mod 2 = 0) then begin
            if Canvas.Brush.Color = Color then begin
              Canvas.Brush.Color := clSkyBlue;
            end;
          end;
        end;
      end;
      l_rect := Rect;
      l_str := Column.Field.DisplayText;
      l_width := dbgACT.Canvas.TextExtent(l_str).cx + 5;
      if Column.FieldName = 'ROW_ID' then begin
        l_bitmap := TBitmap.create;
        try
          ImageList2.GetBitmap(tsACT.ImageIndex, l_bitmap);
          l_bmpWidth := (Rect.bottom - Rect.Top);
          l_rect.Right := Rect.Left + l_bmpWidth;
          dbgACT.Canvas.StretchDraw(l_rect, l_bitmap);
        finally
          l_bitmap.Free;
        end;
        // cc : reset the output rectangle
        l_rect := Rect;
        l_rect.Left := l_rect.Left + l_bmpWidth;
        l_width := 5 + dbgACT.Canvas.TextExtent(l_str).cx;
      end;
        if (l_width > Column.Width) then
          Column.Width := l_width;
      dbgACT.DefaultDrawColumnCell(l_rect, DataCol, (Column as TColumn), State);
    end;
    ====================

     

    But not sure if this affected the style manager or not

     

    regards

    chris

     


  10. HI 

    I am having this funny problem in Delphi 11.1 using VCL.

     

    ====

      FDetailForm := TfrmAircraftTypesNew.Create(self);
      try
        (FDetailForm as TfrmAircraftTypesNew).setData(UpdateRow, l_rec);
        FDetailForm.Visible := false;
        FDetailForm.ShowModal;
      finally
        l_rec.Free;
      end;
      FDetailForm := nil;
    =======

    When i open and close the FDetailForm a few times, the detail form would not show and the main window will hang.

    See this video to see what i mean.

     

    In the Form Close of the TfrmAircraftTypesNew, i will have

    Action := caFree;

    1655068418_Screenshot2022-08-22at20_58_57.thumb.png.44d4ad21823c1bf09bcda563e4cbe085.png

    Can help why the form is not able to show on top. 

    I have already tried to put the PopupMode to Explicit.

     

    Another Finding:

    when i remove or commented the style from the startup, i did not have this problem of not able to showModal

     

    Application.Initialize;
    //  TStyleManager.TrySetStyle('Iceberg Classico');  <== Remove/commented this line
      Application.CreateForm(TDataModule1, DataModule1);
      Application.CreateForm(TfrmMain, frmMain);
      Application.Run;

     

    Not sure why this style is giving problem....

     

    Please advise

    regards

    chris


  11. Thanks. need to use locate with disable/enable controls so that the table will not have moving effect.

    However, for my dataset, it has 50 columns but the dbgrid can only show first 10 columns on the screen.

    If need to show next 10 columns, i will need to scroll to the next 10 columns.

    So, when i am looking at the next 10 columns and the table refreshed, can the refresh go to the next 10 columns rather than always go back to the 1st 10 columns?

     

    regards

    cris

     


  12. Hi

    When the database table is updated and i use dbgrid.datasource.dataset.refresh, the dbgrid is refreshed back to the first row.

    Is it possible to refresh the grid without going back to the first row?

    This is because if there is frequent update to the database and this Refresh notification is sent to my app each time another app updates the table, the dbgrid will always move back to the first row when it is refreshed.

    Any advise

     

    regards

    chris

     


  13. Hi

    I managed to implement it in windows using this event

    TfrmMain : TForm

            Gauge1 : TGauge;

            tmrInactivity: TTimer;
            procedure FormCreate(Sender: TObject);
            procedure tmrInactivityTimer(Sender: TObject);
    private    

            FInactivityTimeout : cardinal;
            FInactivityCounter : cardinal;

     

            // cc : application event to handle key down and left mouse click
            // cc : for activity timeout
            procedure ApplicationEventMsg(var Msg: tagMSG; var Handled: Boolean);
    public

     

    end;

     

    procedure TfrmMain.FormCreate(Sender: TObject);

    var

      l_ini : TIniFile;

    begin

        // this event msg is to capture keyboard and mouse event

        Application.OnMessage := ApplicationEventMsg;

     

        // cc : get the amount of seconds allowed before timeout

         l_ini := TIniFile.create(ChangeFileExt(Application.ExeName, '.ini'));

        FInactivityTimeout := l_ini.ReadInteger('Main', 'Inactivity Timeout', 60);
        Gauge1.MaxValue := FInactivityTimeout;
        Gauge1.MinValue := 0;
        FInactivityCounter := 0;

       l_ini.Free;

    end;
     

    procedure TfrmMain.tmrInactivityTimer(Sender: TObject);
    begin
      // Inactivity timeout will disconnect every connection
      tmrInactivity.Enabled := false;
      if (not DataModule1.getLoginSuccess) then begin
        FInactivityCounter := 0;
        Gauge1.Progress := 0;
        tmrInactivity.Enabled := true;
        exit;
      end;
      if (FInactivityCounter > FInactivityTimeout) then begin
          DataModule1.closeAll;
        end;
        FInactivityCounter := 0;
        Gauge1.Progress := 0;
      end
      else begin
        FInactivityCounter := FInActivityCounter +1;
        Gauge1.Progress := FInactivityCounter;
      end;
      tmrInactivity.Enabled := true;
    end;
     

     


  14. Hi

    I have another question.

    After i use the AddIndex and set the IndexName to the index field created, how can i get back the information of what index field is used and what is the sorting order (asc or desc)

     

    e.g.

      l_indexName := 'ABN_REM' + '_INDEX';
      l_indexes := TStringList.create;
      (TntDBGrid1.DataSource.DataSet as TClientDataSet).GetIndexNames(l_indexes);
      if l_indexes.IndexOf(l_indexName) > -1 then
        (TntDBGrid1.DataSource.DataSet as TClientDataset).DeleteIndex(l_indexName);
      l_indexes.Free;
      (TntDBGrid1.DataSource.DataSet as TClientDataset).AddIndex(l_indexName, 'FREE_REM', [ixDescending],'','',0 );

      (TntDBGrid1.DataSource.DataSet as TClientDataset).IndexName := l_indexName;
     

    In the above code, i have set the IndexName to 'ABN_REM_INDEX' with field 'FREE_REM' used and sort in descending order.

     

    So, how can i get back this information that the field name 'FREE_REM' is used and the sorting is in descending order?

     

     

    regards

    chris

     


  15. Hi

    I am not sure if this function affected the drawing

     

    procedure TForm1.ClientDataSet1AfterOpen(DataSet: TDataSet);
    var
      l_index : integer;
      l_fieldName : string;
    begin
      for l_index := 0 to ClientDataSet1.FieldCount - 1 do begin
        l_fieldName := ClientDataSet1.Fields[l_index].FieldName;
        ClientDataSet1.Fields[l_index].DisplayWidth :=10;
        if (l_fieldName  = 'SDT') or (l_fieldName = 'EST_D') or
           (l_fieldName = 'LAST_D') or (l_fieldName = 'ACT_D') or
           (l_fieldName = 'CREATED_AT') or (l_fieldName = 'UPDATED_AT') then
          ClientDataSet1.Fields[l_index].OnGetText := getDateTimeStr
        else if (l_fieldName = 'STIME') then
          ClientDataSet1.Fields[l_index].OnGetText := getTimeStr
        else if (l_fieldName = 'SDATE') then
          ClientDataSet1.Fields[l_index].OnGetText := getDateStr
        else if (l_fieldName = 'ORDEST_N_C') or (l_fieldName = 'FREE_REM') then
          ClientDataSet1.Fields[l_index].OnGetText := getForeignStr;
      end;
      Dataset.Last;
    end;

     

    procedure TForm1.TntDBGrid1DrawColumnCell(Sender: TObject;
      const Rect: TRect; DataCol: Integer; Column: TColumn;
      State: TGridDrawState);
    var
      l_bitmap : TBitmap;
      l_rect : TRect;
      l_bmpWidth, l_width : integer;
      l_str : string;
    begin
      if (ClientDataSet1.RecNo mod 2 = 0) then begin
        if TntDBGrid1.Canvas.Brush.Color = TntDBGrid1.Color then begin
          TntDBGrid1.Canvas.Brush.Color := clSkyBlue;
        end;

      end;
      l_rect := Rect;
      l_str := Column.Field.DisplayText;
      if Column.FieldName = 'ROW_ID' then begin
        l_bitmap := TBitmap.create;
        try
            ImageList3.GetBitmap(1, l_bitmap);
          l_bmpWidth := (Rect.bottom - Rect.Top);
          l_rect.Right := Rect.Left + l_bmpWidth;
          TntDBGrid1.Canvas.StretchDraw(l_rect, l_bitmap);
        finally
          l_bitmap.Free;
        end;
        // cc : reset the output rectangle
        l_rect := Rect;
        l_rect.Left := l_rect.Left + l_bmpWidth;
        l_width := 5 + TntDBGrid1.Canvas.TextExtent(l_str).cx;  <==
        if (l_width > Column.Width) then <==
          Column.Width := l_width;  <==
      end;
      TntDBGrid1.DefaultDrawColumnCell(l_rect, DataCol, (Column as TTntColumn), State);
    end;
     

    As i store all the dates as Unix Epoch format. hence i need to translate all the values to date time format when drawn on the grid.

    However, is there a way to know when the drawing on the grid is completed?

    Or is there a better way to make the grid draw out faster?

     

    Seems like if i dont make it auto size for every column, the drawing is faster.

    The longest column is the Foreign Characters and the resizing took quite long there

    Is there a way to auto size and auto fit the column which is not done during the drawing part?

     

     

    please advise

     

    regards

    chris

     

×