Jump to content

Achim Kalwa

Members
  • Content Count

    67
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by Achim Kalwa


  1. 5 hours ago, hsvandrew said:

    Is there an option (or plugin) to get class completion to work in a way where all new procedures & functions will appear at the bottom of the unit or in the same order as its declared, rather than in some kind of alpha sorted location?

    Yes, there is "DDevExtension" by Andreas Hausladen. That IDE plugin has an option to disable the alpha-sort class completion (and much more valuable stuff):

     

    DDevExtensions_Options.thumb.png.874bb7dd509bb46f50ed432f4b02055b.png

     

    For Delphi 2009...10.4.2 you can download this plugin form Andreas' blog:

    https://www.idefixpack.de/

     

    For Delphi 11 there is a fork on Github:

    https://github.com/DelphiPraxis/DDevExtensions/releases

     

    • Thanks 1

  2. 1 hour ago, Henry Olive said:
    
    Uses System.StrUtils;		
    var		
      S, FirstStr, SecStr : String,		
    begin		
      S := SqlQuery1.FieldByName ('RANGE').asString; // it is '5/10'		
      FirstStr := SplitString(S, '/')[0];		
      SecStr  := SplitString(S, '/')[1];		
    end;		

    Above code works in Delphi-XE w/o any problem but

    i get   Not enough actual parameters err.msg in  Delphi 10.3

    What is wrong ?

    In line #3 the list of variables must me terminated by a semicolon, not by a comma. Beside that your code works as expected (Delphi 11.0).

    And because you did not tell in which line the error occours I can only wild guess that there is some other "SplitString" function in reach with uses different parameters.

    Where do you land when doing a Ctrl+Click on "SplitString"?


  3. Embarcadero has fixed the menu font color problem in V11 update 2.

    I really would like to know why Microsoft discarded the well-looking menu colors from Windows 10 and now uses the Windows-2000-colors for menus. And the selection bar height is 2 pixel too small on Windows 11, which makes font decenders difficult to see.

    At least Microsoft has "fixed" the bar height on recent Windows 11 builds.

    • Like 1

  4. 19 hours ago, Edwin Yip said:

    Let's say we have a VCL program with DPI-aware enabled (with xml manifest correctly set, all forms have `Scaled` set to true and working), and the form inheritance is like this:

    TFormC inherits from TFormB which in turn inherits from TFormA, which have some buttons on some panels.

    [...]

    TFormA will be auto scaled for 1 time and it's correct. But TFormB will be wrongly scaled and shifted twice, while TFormC will be scaled and shifted for 3 times.

    Any special alignments of panels and buttons (Bottom, Right)?

    Can you provide a sample project?


  5. On 11/9/2021 at 9:44 AM, dummzeuch said:

    Hm, the minimum height for this form is set to 660 pixels. That might be a bit tight depending on the height of your task bar.

    On top of that there might be the general scaling problems in Delphi 11, but I actually doubt that this is the issue. 

    No, Delphi 11 is not guilty here 😉

    There is some code in GX_Configure.pas which looks like some debug leftover: In line 311...316 the dialog is inflated to a minimum of 1000 x 1000 pixel. Remove that code an the configuration dialog will become usable.

    • Thanks 1

  6. 7 hours ago, Lars Fosdal said:

    They could have made the "Patch available" a little more prominent, as well as putting it in the "New in GetIt" and "Promoted in GetIt" panes.

    Any the should remove that hint after installing the patch. I'm working with several VMs; and sometimes I forget which VM includes the patch and which one still needs the patch. Some information in the About-box would be helpful, too. Delphi 11 Patch 1 still shows <No Updates Installed>.

    • Like 2

  7. On 10/7/2021 at 3:14 PM, Tom Mueller said:

    Windows 11 menu without and with image (hard to read black text on dark-blue background)

    Can anyone reproduce this behavior?

    Yes. And I've reported this issue some weeks ago as RSP-35049. The black text is caused by a bug in Vcl.Menus.pas; procedure DoThemedDrawText(): The parameter "Selected" is completely ignored in that code, but should be used to select to correct theme element details. Feel free to vote for it 😉.

     

    But even if this will be (hopefully) fixed in some Delphi 11.1 update I'm still looking for a workaround without using a full copy of Vcl.Menus.pas. Something like patching Vcl.Menus at runtime (using Delphi Detours? Or code from Andreas Hausladen's VCLFixPack?) to replace DoThemedDrawText() with a fixed version (see RSP-35049 for the required changes). Any help appreciated.

     

    • Like 4
    • Thanks 2

  8. 2 hours ago, FranzB said:

    I use this  code  below to read an integer value  from an database

    Which Database system do you use? Which connection components?

    Quote

    my code is functional, if there is an integer value stored.  

    Reading an  " "  empty field I get an exception failure. 

    What is the  best coding style to  avoid  this error  in an application ?  

    If the field in the database is declared as "Integer", it should never contain a Space character. It could be NULL, which means it doesn't contain any value. Most database access components will translate NULL to the value 0, so an empty field should not raise an exception.

     

    Which value do you expect in case the field is NULL?

     

    To be save, you can test for empty fields yourself:

    var F : TField;
    
    F := Qry.FindField('IntegerField');
    if Assigned(F) and (not F.IsNull) then
      aObject.IntValue := F.AsInteger
    else
      aObject.IntValue := -1; // or whatever value you choose in case of an empty field.

     

    • Like 2
    • Thanks 1

  9. Maybe some of the scaling issues could be solved by setting Form.Scaled := True. I've added

    procedure TfmBaseForm.Loaded;
    begin
      inherited;
      {$IFDEF IDE_IS_HIDPI_AWARE}
      Scaled := True;
      {$ENDIF}
    end;

    to TfmBaseForm (GX_BaseForm.pas) (to not edit every dfm by hand). But I am not sure if this works on all inherited forms. My first test with the "Goto" experts are looking good:

    1975572875_GXScaling.thumb.png.3bc504e850bcdc511c060dffecb37281.png

     

    Achim


  10. Watch the grid's indicator column: The current (active) row is marked with a triangle, while selected rows are marked with a dot. If the current row is also a selected row, the indicator shows a dot and a arrow.

     

    You need to make the current row a selected row:

    if DBGrid1.SelectedRows.Count = 0 then
        DBGrid1.SelectedRows.CurrentRowSelected := True;

     


  11. I did a clean install of Delphi 10.4.2. One of the first steps is to compile and install GExperts. SVN revision 3449 compiled fine, but when running the "Register-GExperts-XX104.cmd" it fails with "Runtime error 217 at 50CDB390", followed by "Problem beim Starten von .\GExpertsRS104.dll. Eine DLL-Initialisierungsroutine ist fehlgeschlagen."

     

    To trace the error I compiled GExperts in Debug mode, using Debug-DCUs. Then I used Run->Parameters to set "C:\Windows\System32\rundll32.exe" as "Host", and the full path to the compiled GExpertsRS104.dll and ",InstallGExperts" as parameter:

     

    Host application:
    C:\Windows\System32\rundll32.exe

     

    Parameters:
    C:\Full\Path\To\GExpertsRS104.dll,InstallGExperts

     

    Now I could debug the installation from within the Delphi IDE.

    The startup-code InitUnits (in System.pas) initializes all units and calls class constructors; and in Vcl.WinXCtrls.pas it calls a class constructor TSearchBox.Create. This code creates an internal TImageCollection and adds two default images, which finally leads to TWICImage.Create in Vcl.Graphics.pas (Line 10624 ff).

     

    The call to CoCreateInstance(CLSID_WICImagingFactory, ...) fails with error code $800401F0 = CO_E_NOTINITIALIZED =  'CoInitialize has not been called' and an exception is raised with message 'Cannot create instance of class CLSID_WICImagingFactory'.

     

    To solve this problem, I need to insert CoInitialize(nil) somewhere, and because I won't change VCL and RTL units I had to find another place. Finally I found that the initialization block in GX_GenericUtils.pas is called some steps before the exception is raised, and already uses unit ActiveX, so I placed a CoInitialize(nil) in GX_GenericUtils.pas initialization block.

    initialization
      CoInitialize(nil);  // this line added
      Initialize;
    ...

    And the error is gone!

    Finally I could install GExperts into Delphi 10.4.2 😉 [Yes, I know how to use RegEdit].

    @dummzeuch : Maybe there is a better place to insert that missing CoInitialize(nil). Also I don't know if that call has side effects on older Delphi versions and should be surrounded by some IFDEFs. Since it is only one line inserted, I did not create a patch.

     

    I'm going to report this new VCL bug to quality portal.

     

    Thanks for reading,

    Achim

    • Like 1
    • Thanks 2

  12. Hello Thomas,

    I would just like to notice that the "Grep" expert is no longer available due to some changes in SVN rev. 3383 ff. The defined hotkey does nothing, and the menu item is gone. The new Grep submenu has "show Grep results", but no "Grep search".


  13. On 10/29/2020 at 10:20 PM, Carlos Tré said:

    I already had an expert in place to change the editor's toggle insert / overwrite mode for I am a lousy typist and was going crazy hitting the insert key when home was intended.

    @Carlos TréVery interesting; I would like to use that expert, too. What's the name of that expert? Or did you write it yourself and are willing to share the code?


  14. In fact first attempt was to integrate this little patch into GExperts. There is already GX_VCLFixPack.pas, which is a slightly modified version of Andreas' VclFixPack.pas. It is currently not in use (disabled by $IFDEF) and needs some cleanup, e.g. remove unused and old Win95 code 🙂. But for a "complete" GX Expert it would be neccessary to have at least an on/off configuration switch in the IDE settings section; but I did not dig deep enough to implement such a thing. And some kind of documentation would be helpful, too.

    Maybe I'll find some spare time at the weekend for creating a patch to GExperts.

     

    • Thanks 1

  15. I know I am late to the party, but you might try the attached package for Delphi 10.4.1.

    It uses the hooking code from Andreas Hausladen's VclFixPack v1.4 to patch the TControl.DefineProperties method to a modified code, which does not write those Explicit* properties to the DFM file.

    Unpack the zip archive, open DControlsFix.dpk in Delphi 10.4.1, compile & install. There is nothing to customize. If this package is installed, the patch is active. If you like to get the default behaviour back, just uninstall the package.

    Use at your own risk 😉

     

    DControlsFix.zip

    • Like 2
    • Thanks 7
×