-
Content Count
2992 -
Joined
-
Last visited
-
Days Won
107
Everything posted by dummzeuch
-
Which in itself could be a phishing attempt. Just saying.
-
I have received a few reports about bugs in GExperts in Delphi 10.4.1 that do not occur in Delphi 10.4. Here is a GExperts DLL that was compiled with Delphi 10.4.1. Maybe it will solve some of theses problems. Read on in the blog post.
-
Searching Edit component with autocomplete for Directory/Files
dummzeuch replied to Carlo Barazzetta's topic in VCL
Hm. my "larger code" is the test program here: https://svn.code.sf.net/p/dzlib/code/dzlib/trunk/tests/AutoCompleteTest Which isn't much more than a form with a few TEdits and calls to the various TEdit_AutoAutoCompleteXxx procedures in the constructor: constructor Tf_AutoCompleteTest.Create(_Owner: TComponent); var sl: TStringList; begin inherited; TEdit_ActivateAutoCompleteDirectories(ed_AutoCompleteDirs); sl := TStringList.Create; try sl.Add('one'); sl.Add('two'); sl.Add('three'); sl.Add('four'); sl.Add('five'); sl.Add('six'); sl.Add('seven'); sl.Add('eight'); sl.Add('nine'); sl.Add('ten'); TEdit_SetAutoCompleteStringList(ed_AutoCompleteStrings, sl); finally FreeAndNil(sl); end; TEdit_ActivateAutoCompleteFiles(ed_AutoCompleteDfmFiles, '*.dfm'); TEdit_ActivateAutoCompleteFiles(ed_AutoCompleteFilesCallback, AutocompleteFilter); // These masks are passed to Masks.MatchesMask, so they allow something more than just '*' and '?' // wildcards, e.g. '[a-z]_*.dpr' would also work, which matches 'a_blablub.dpr'. TEdit_ActivateAutoCompleteFiles(ed_AutoCompleteFilesMasks, ['*.dpr', '*.pas']); TEdit_ActivateAutoCompletePath(ed_AutoCompletePath); end; procedure Tf_AutoCompleteTest.AutocompleteFilter(_Sender: TObject; const _Filename: string; var _Accept: Boolean); var ext: string; begin ext := TFileSystem.ExtractFileExtFull(_Filename); _Accept := SameText(ext, '.pas') or SameText(ext, '.dfm'); end; Could you please post the code you used to test your .Next implementation(s)? -
Searching Edit component with autocomplete for Directory/Files
dummzeuch replied to Carlo Barazzetta's topic in VCL
Unfortunately both your proposed changes to the code of .Next still raise the same "System exception (code 0xc0000374) at 0x77026e13" with "77026db3 ntdll.RtlIsZeroMemory + 0x93" at the top of the call stack" as my original code did in Delphi 12. My changed code works in all versions of Delphi from 2007 up. You are right with the problem in Skip though. I should have read the description more carefully. -
Autocompletion for TEdits fixed for Delphi 11 and later
dummzeuch posted a topic in Tips / Blogs / Tutorials / Videos
My dzlib contains several helper functions to add TEdit-autocompletion for directories, files (with a filter) and generic strings from a string list. All of them worked fine for me and were used in several our internal programs. But that changed when trying them with Delphi 11 as @Carlo Barazzetta found out: Using these functions now raised a system exception as soon as the IEnumString.Next method was being called the first time. It turned out that the way I tried to cheat with the memory allocation of WideStrings no longer works. Read on in the blog post. -
Searching Edit component with autocomplete for Directory/Files
dummzeuch replied to Carlo Barazzetta's topic in VCL
Fixed the problem in revision #1737. Something must have changed in the way Delphi handles WideStrings between Delphi 10.4 and Delphi 11. The hack of setting a WideStiring variable to NIL no longer cleared it without decrementing the reference counter, but apparently freed that string. Instead the code now allocates new memory and moves the content to that new memory. Or possibly it never actually worked but for some reason didn't raise an exception until Delphi 11. While I was at it, I moved the boiler plate code to a new class TEnumStringsHelper so all descendants now only need to implement two simple methods rather than four. -
Searching Edit component with autocomplete for Directory/Files
dummzeuch replied to Carlo Barazzetta's topic in VCL
The code works fine up until Delphi 10.4 and fails from Delphi 11 on. If I remember correctly, the largest change between these versions was by monitor DPI support, but I'm not sure wether that was for applications or the IDE or both. -
For the record: The last Delphi version that had a Borland entry under HKLM and HKCU\Software was Delphi 2007 (BDS 5.0). 2009 and 2010 were under CodeGear and everything after that under Embarcadero.
-
Searching Edit component with autocomplete for Directory/Files
dummzeuch replied to Carlo Barazzetta's topic in VCL
Sorry, I totally missed this post. I guess answering nearly a year later is kind of limited use for you, but anyway: Regarding 2: There is only very limited support for Win64 (and none at all for non windows platforms) Regarding 1: We (I and my coworkers) use dzlib primarily with Delphi 2007 and Delphi 10.2. There is very limited testing for other Delphi versions. Some part of it is used in GExperts so that one gets wider testing, but TEnumStringFiles is not part of that. Edit: I just tried it with Delphi 11 and I can reproduce the problem. It also happens in Delphi 12. It does not happen in Delphi 10.2 and 2007 so I guess something in the RTL changed. No solution yet. Yes, https://sourceforge.net/projects/dzlib/ is the latest version, or rather https://blog.dummzeuch.de/dzlib/ which links there and will be updated should I ever decide to host the code elsewhere. -
If I remember correctly there is a project group for each Delphi version. You load that into the IDE, do a build all and then install all the designtime packages. Since every 2nd package is a designtime package, it is a lot of clicks, but you can leave out those which you don't use.
-
If I remember correctly, the CE does not contain the command line compiler. The GetIt-Installation for JCL/JVCL requires that, so you can't use that. Your best bet is to load the JEDI packages into the IDE and compile them there.
-
Show executable size after successful build?
dummzeuch replied to PeterPanettone's topic in Delphi IDE and APIs
Probably even more than implementing that feature in a plugin would take. -
Show executable size after successful build?
dummzeuch replied to PeterPanettone's topic in Delphi IDE and APIs
Stop harassing Peter, please. -
Show executable size after successful build?
dummzeuch replied to PeterPanettone's topic in Delphi IDE and APIs
GExperts as well as any other IDE plugin. -
Show executable size after successful build?
dummzeuch replied to PeterPanettone's topic in Delphi IDE and APIs
There is no built in option for that, but a plugin could add this information. -
Avoid parameter evaluation
dummzeuch replied to Maxime Janvier's topic in RTL and Delphi Object Pascal
No, you are wrong. Even anonymous methods were in Java first. -
Avoid parameter evaluation
dummzeuch replied to Maxime Janvier's topic in RTL and Delphi Object Pascal
Yes, some special characters plus if plus ifend are a lot more convenient than an if then statement. I'm sold. -
Avoid parameter evaluation
dummzeuch replied to Maxime Janvier's topic in RTL and Delphi Object Pascal
It's cumbersome to have that if statement all the time. -
Given a TStringGrid with FixedRows = 1 FixedCols = 0 RowCount = 51 (50 data rows) ColCount = 3 I want to configure the vertical scroll bar so that the thumb represents the part of the string grid that is visible relative to the full height. I found an article on SwissDelphiCenter which gives the folowing code: procedure TForm1.Button1Click(Sender: TObject); var info: TScrollInfo; begin FillChar(info, SizeOf(info), 0); with info do begin cbsize := SizeOf(info); fmask := SIF_ALL; GetScrollInfo(StringGrid1.Handle, SB_VERT, info); fmask := fmask or SIF_PAGE; nPage := 5 * (nmax - nmin) div StringGrid1.RowCount; // whatever number of cells you consider a "page" end; SetScrollInfo(StringGrid1.Handle, SB_VERT, info, True); end; As far as I understand this, it sets the thumb size to represent 5 rows. I looked up the documentation of GetScrollInfo and SetScrollInfo and came up with a slightly modified version: ///<summary> /// Sets the thumb of the scroll bar of a TStringGrid to represent the visible area relative to the full area. /// @param GridHandle is the window handle of a TStringGrid /// @param Which is either SB_VERT or SB_HORZ /// @Param VisibleCount is TStringGrid.VisibleRows (for SB_VERT) or .VisibleCols (for SB_HORZ) /// @param DataCount is number of non-fixed rows (for SB_VERT) or columns (for SB_HORZ) </summary> procedure TStringGrid_AdjustScrollBarPage(_GridHandle: HWND; _Which: Integer; _VisibleCount, _DataCount: Integer); var Info: TScrollInfo; Size: Integer; begin Size := SizeOf(Info); ZeroMemory(@Info, Size); Info.cbSize := Size; Info.fMask := SIF_ALL; GetScrollInfo(_GridHandle, _Which, Info); Info.fMask := SIF_PAGE or SIF_RANGE; Info.nPage := _VisibleCount; Info.nMin := 1; Info.nMax := _DataCount; SetScrollInfo(_GridHandle, _Which, Info, True); end; (I can probably get rid of the call to GetScrollInfo, as I don't need the values of nMin and nMax to calculate nPage) I call it in the form's Resize event like this: TStringGrid_AdjustScrollBarPage(TheGrid.Handle, SB_VERT, TheGrid.VisibleRowCount, TheGrid.RowCount - TheGrid.FixedRows); (Which sets nPage to 10, nMin to 1 and nMax to 50.) And it seems to work ... ... at least visually. Unfortunately moving the thumb down to the bottom no longer shows the last lines of the grid: (Remember: There are 50 data rows + 1 fixed row) What am I doing wrong here? Is there some other value I need to adjust? Edit: The culprit seems to be the code in TCustomGrid.ModifyScrollBar which calculates the new NewTopLeft value wrongly. Possibly because it makes some assumptions that are no longer true when the scrollbar parameters are set like this. So I either need to figure out a different way to set those parameters or handle the WM_VSCROLL message myself.
-
So there seems to be a bug: When the toolbar is disabled, enabling it for the left hand side (and probably anything but the top, but I haven't tested it) will not be shown. After enabling it for top it is shown and can then be moved to the left. (At least that is what I could reproduce, I don't use that toolbar myself). Can you confirm this?
-
Try to put it on top. Does that work? Then, change it to the left.
-
I forgot to mention, that in the lastest GExperts Beta release for Delphi 12, the configuration tab for the Editor enhancement has been moved to a separate “Editor Enhancement” expert. https://blog.dummzeuch.de/2024/02/26/gexperts-editor-enhancement-tab/
-
What is Python Subprocess That's why I asked when others suggested TDOSCommand. From the github page, it only mentions command line apps. TDosCommand can run other Delphi programs and executables. It can even run python scripts, if the interpreter for that is installed. So I guess that fits the bill.
-
That was the problem with this topic from the beginning. What exactly is a "subprocess in python"? What does it do, if it is "more than DOS / command line stuff"?
-
“Transitive” type redefinitions in interface section
dummzeuch replied to Dmitry Onoshko's topic in Algorithms, Data Structures and Class Design
I have used something similar, but not for normal types but for nested types. unit UnitA; interface uses MyTypes; type TSomeType = class(TSomeOtherClass) public type TSomeNestedType = MyTypes.SomeType; end; The idea is to reference the nested type instead of the type declared in MyTypes, so if the nested type was changed later to something else (but similar enough as to not require code changes), the other code doesn't need to be updated. Hm, thinking about it now, with a more modern Delphi than 2007 (which I used when I wrote this), I would probably use Generics instead.