Jump to content

chkaufmann

Members
  • Content Count

    167
  • Joined

  • Last visited

Posts posted by chkaufmann


  1. In 10.3 (Rio), class constructors are implemented the same way as initialization sections of units. This means, I have no control about the order. So if I create an object of my class in an initialization section, I cannot be sure, that the class constructor for this class was already called.

     

    Just wondering: is this problem fixed in 10.4? Or is it still done the same way?

     

    Christian


  2. Hi,

     

    The color select dialog in Delphi (TColorDialog, TColorBox) looks quite old and keeping multiple custom colors available doesn't really work.

     

    Does somebody have a recommendation to replace it?

     

    Christian


  3. In my application I have a TApplicationEvents object and there I use the OnMessage event.

     

    I was wondering why this event is called all the time even then when I don't touch the mouse and/or the keyboard. Now I noticed that WM_MOUSEMOVE are sent all the time.

     

    Is this normal - probably not - but how can I find out, where these messages come from. As soon as I move the mouse cursor outside of my applications window the messages stop.

     

    Christian


  4. We built our own framework where we can define different entity types. Each Entity Type has 1-n values. Then we allow different relation between entity types:
    - Parent / Child
    - Reference
    - Link (m:n relation)

     

    At first glance a parent/child relation is the same as a mandatory reference. But somehow it feels, it's not and I try to find the rules when to choose parent/child and when to choose reference.

     

    Can someone point me to appropriate reading?

     

    Thanks

    Christian
     


  5. Hi,

     

    from time to time I run into an endless AV when running grep from GExperts. Here is the stack trace. I'm not sure if this is a GExperts or a DevExpress problem:


     

    [5005FD90]{rtl260.bpl  } System.TObject.InheritsFrom (Line 18239, "System.pas" + 6) + $0
    [5005FBE2]{rtl260.bpl  } System.@IsClass (Line 17942, "System.pas" + 1) + $8
    [0B4ED18C]{themeloader260.bpl} System. + $0
    [0B4ED959]{themeloader260.bpl} Idetheme.Vclstyledialogshooks.TTabControlIDEDialogStyleHook.Paint + $2D
    [50E05577]{vcl260.bpl  } Vcl.Themes.TCustomStyleServices.DrawParentBackground (Line 2592, "Vcl.Themes.pas" + 1) + $F
    [50E05591]{vcl260.bpl  } Vcl.Themes.TCustomStyleServices.DrawParentBackground (Line 2598, "Vcl.Themes.pas" + 1) + $D
    [0B4E61F2]{themeloader260.bpl} Idetheme.Vclstylehooks.TTabControlIDEStyleHook.PaintBackground + $82
    [0B4D8D17]{themeloader260.bpl} Idetheme.Vclstylehooks.TIDEStyleHook.WMPaint + $EF
    [0B4D8E82]{themeloader260.bpl} Idetheme.Vclstylehooks.TIDEStyleHook.WndProc + $7A
    [0B4D97B0]{themeloader260.bpl} Idetheme.Vclstylehooks.TMouseTrackControlIDEStyleHook.WndProc + $0
    [0B4E6AB2]{themeloader260.bpl} Idetheme.Vclstylehooks.TTabControlIDEStyleHook.WndProc + $A
    [0B4D8924]{themeloader260.bpl} Idetheme.Vclstylehooks.TIDEStyleHook.HandleMessage + $A0
    [0B511493]{themeloader260.bpl} Idetheme.Stylemanager.TIDEThemeStyleEngine.HandleMessage + $97
    [0B511C96]{themeloader260.bpl} Idetheme.Stylemanager.TIDEThemeStyleEngine.UnRegisterSysStyleHook + $DA
    [50D197BC]{vcl260.bpl  } Vcl.Controls.TWinControl.WndProc (Line 10122, "Vcl.Controls.pas" + 10) + $48
    [50CF65D7]{vcl260.bpl  } Vcl.Graphics.FreeMemoryContexts (Line 7138, "Vcl.Graphics.pas" + 12) + $8
    [50D19314]{vcl260.bpl  } Vcl.Controls.TWinControl.MainWndProc (Line 9977, "Vcl.Controls.pas" + 3) + $6
    [501796A4]{rtl260.bpl  } System.Classes.StdWndProc (Line 17932, "System.Classes.pas" + 11) + $2
    [1D14BADA]{DevEx_Main.bpl} Cxcontainer.TcxCustomInnerListBox.DoGetGestureOptions + $AFE
    [1D08A9E1]{DevEx_Main.bpl} Dxhooks. + $0
    [50E6EC33]{vcl260.bpl  } Vcl.Forms.TApplication.ProcessMessage (Line 10747, "Vcl.Forms.pas" + 23) + $1
    [50E6EC5E]{vcl260.bpl  } Vcl.Forms.TApplication.ProcessMessages (Line 10769, "Vcl.Forms.pas" + 1) + $4
    

    I'm using Delphi 10.3.2 and GExperts 1.3.13.77.

     

    Christian

    • Like 1

  6. I have a TEdit that is a bit higher than normal in order to align it with other controls. Then I wanted to center the text vertically but there is no such property and the only solution I found is to overwrite the Paint method in a subclass. Is this really the case? Or did I miss something?

     

    Christian


  7. But if I don't declare T:class I cannot use it in the InheritsFrom() method. Same for an IInterface with the Support method:

     

    function TComponentHelper.FindComponents<I:IInterface>: IBSEnumerable<I>;
    var
      ix  : Integer;
      lst : IBSList<I>;
      tmp : I;
    begin
      lst := TBSGenerics.GenList<I>;
      for ix := 0 to ComponentCount - 1
        do if Supports(Components[ix], I, tmp)
          then lst.Add(tmp);
      Result := tmp;
    end;
    
    function TComponentHelper.FindComponents<T:class>: IBSEnumerable<T>;
    var
      ix  : Integer;
      lst : IBSList<T>;
      tmp : T;
    begin
      Assert(T.InheritsFrom(TComponent), 'Nur für Subklassen von TComponent');
      lst := TBSGenerics.GenList<T>;
      for ix := 0 to ComponentCount - 1 do if Components[ix].InheritsFrom(T) then begin
        TComponent(tmp) := Components[ix];
        lst.Add(tmp);
      end;
      Result := lst;
    end;

     

    Christian


  8. Hi,

     

    I try to create this helper:

     

      TComponentHelper = class helper for TComponent
      public
        function FindComponents<I:IInterface>: IBSEnumerable<I>; overload;
        function FindComponents<T:class>: IBSEnumerable<T>; overload;
      end;

    but I get an error "methods with identical parameters". In my generic code I filter components either by using "InheritsFrom" or "Supports()". Therefore I need IInterface and class in the declaration or is there another way to do that?

     

    Christian


  9. Thanks for all hints. I already use FastMM full version, so I know, there are no memory leaks. I run a huge import from one database to another. I have to pass the data through my business classes.

     

    Since I use interfaced objects a lot, destruction is sometimes late. Combined with caching of some complex structures it's not always obvious, where there are still references. I will try to add logging with the code of Stefan.

     

    Christian


  10. I have to solve some "out of memory" problems during an import in my application. My application is still 32bit and when I check the memory in the process explorer, it's not 100% clear for me, which values are critical. Here are my questions:

    - What is an easy way to see the number of objects of each class during debugging? Do I have to build something on my own? Can I get this info for records as well?

    - Is it worth to switch the application to 64bit?

    - For 32bit, which values in the Process Explorer are critical and what are the maximum values during runtime that will be save?

     

    Thanks for any hints and tips here.

     

    Christian


  11. The goal is, to avoid values for unchanged properties (Name, CharSet, Height) spread over all my controls in the DFM files. If I want my application using the Screen.MessageFont, automatic update does not work for all controls with different color and/or style.

     

    Christian


  12. Hi,

    when I change the color and/or style (italic, underline) of the Font of any control (most of the time it's TLabel), then I get this in the DFM:

     

              Font.Charset = DEFAULT_CHARSET
              Font.Color = clHighlight
              Font.Height = -12
              Font.Name = 'Segoe UI'
              Font.Style = [fsBold]
              ParentFont = False
     

    But the added information is only this:

     

              Font.Color = clHighlight
              Font.Style = [fsBold]
     

    Now the only solution I see, is to write my own descendant for the control and add my own properties for Style and Color. But even then I would have to suppress usage of these properties during design time in order to leave Font/ParentFont unchanged. Or did I miss something?

     

    Christian

     


  13. I have a custom control and defined the following published properties:

     

        property MaxValue: Integer read FMaxValue write SetMaxValue default High(Integer);
        property MinValue: Integer read FMinValue write SetMinValue default Low(Integer);
    

    It works fine for MaxValue, but for MinValue I always get this in my dfm files:

     

          MinValue = -2147483648


     

    Are there limitations for default values and if yes, where can I find these?

     

    Christian

     


  14. Thanks for your answer.

     

    You are right regarding "properly" designed forms. Unfortunately I deal with old applications, that are not perfect and I thought, if I see it with the most common font/size used today, I could just fix the major problems. Mainly fix "Top" and "Height" problem are an issue because all labels and controls are higher.

     

    Christian


  15. On 11/9/2019 at 11:00 PM, Anders Melander said:

    And then I just make sure to set all forms ParentFont=True at design time.

     

    I looked at the problem again and this seems the most reasonable solution for me. The only question that remains, how can I set the IDE font used during designing to "Segoe UI, 9pt" because right now, when I choose "ParentFont = True" then I still get "Tahoma 8pt".

     

    Christian


  16. When I create a new form (File - New - VCL Form) font and size is always like this:

     

      Font.Height = -11
      Font.Name = 'Tahoma'

    but I would like to have it like this:

     

      Font.Height = -12
      Font.Name = 'Segoe UI'
    

    Is there a simple way to achieve this? I remember, that I saw a sample with an IDE expert for this, but is there no way to set this default in the IDE or "per project"?

     

    Christian
     


  17. I still try to locate the problem. Right now I have the situation, that a request blocks all following request. So I want to cancel it as save as possible. In the main thread I know my TIdHTTPServer component and I know the TIdContext of the request I want to remove. What is the savest way to do it from "outside the request"?


  18. Hi,

     

    I use a TIdFtp component to upload files to a server in a background thread. The main application creates changed file irregularly, sometimes there is up to 30 minutes between two uploads, sometimes there are up to a 100 files at the same time.

     

    My problem is that a some point the server disconnects and calling IdFtp.Put() fails. Is there no message from the server when it disconnects? Can a get this information from the server somehow? Or what is the best way to handle that?

    My first approach was doing Connect/Put/Disconnect for each file but I have one user who has a problem with his web provider because of this - when uploading too many files at the same time.

     

    Christian


  19. On 9/10/2019 at 9:51 PM, Remy Lebeau said:

    So figure out why the message queue is getting blocked in your code.

    In the end, that's what I was afraid of 😞. Any hints on how to isolate that? Especially on a users computer since I never had it on my own machine. The number of places something wrong happens are almost endless in a huge application. All I know is, often when it happens, the computer comes back from screen saver mode.

     

    Christian


  20. Hi,

     

    I wrote a remote storage for files and manage it using an Indy TIdHttp component with some post request (get file, put file, delete file). So far this works fine local and with a remote server but when I try the script with my hosting provider I get a "Connection reset by peer" for some requests.

     

    I can reproduce it when I try to put a specific file. I always use a TIdMultiPartFormDataStream with some text variables and a file upload. I always get an error 5000 and an empty response in this case and the error message "Connection reset by peer".

     

    I already had some emails with my provider and the ensure, that there is no firewall or anything blocking my requests. And now comes the most difficult part: I tried to reduce my main application to a small sample application just with this specific request and now the request runs fine, file is uploaded and saved.

     

    So as next I put the test request in the MainForm.FormCreate event and it works as well, even when I call it more than once.

     

    I always recreate my TIdHttp component but the question remains, why do I get this error? And what could I do to isolate the problem?

     

    Christian

     

     

×