-
Content Count
2854 -
Joined
-
Last visited
-
Days Won
101
Everything posted by dummzeuch
-
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. -
Turn off (remote) Debug symbols in the linker options, if it is turned on.
-
Where can I find the official version numbers of the embarcadero products?
dummzeuch replied to Mr. E's topic in General Help
Just for completeness, there are also some lists on version information on the Delphi Wiki: https://delphi.fandom.com/wiki/Delphi_Release_Dates https://delphi.fandom.com/wiki/CompilerVersion_Constant https://delphi.fandom.com/wiki/Delphiversions.inc https://delphi.fandom.com/wiki/RTLVersion_Constant https://delphi.fandom.com/wiki/Borland_Compiler_Conditional_Defines https://delphi.fandom.com/wiki/Delphi_Build_Numbers I (and a few others) try to keep them more or less up to date, but I just noticed that some have lapsed again. Having seen that there are other lists that seem to be better maintained I'm considering just pointing there instead. The whole Wiki is mostly outdated anyway, the original maintainer(s) having disappeared. -
Where can I find the official version numbers of the embarcadero products?
dummzeuch replied to Mr. E's topic in General Help
I inherited most of it, the part that I wrote was based on the existing code, so I can't take the credit. -
Where can I find the official version numbers of the embarcadero products?
dummzeuch replied to Mr. E's topic in General Help
The difference between updates and patches seems to be that updates change the version number on the about dialog and patches don't. If installed via GetIt, patches are listed in the registry and will be shown in the about dialog as an additional information, but that does not happen if you don't use GetIt for the installation. Both can switch some executables, which then will get a new version number, but you have to know for which executables to look to see that difference. I have code in GExperts that identifies the current update and patch level in case some workaround or fix is necessary. I thought about making a small stand alone tool from this, but never came around doing it. That code is in https://sourceforge.net/p/gexperts/code/HEAD/tree/trunk/Source/Framework/GX_GetIdeVersion.pas In case anybody is interested. -
Watch me coding in Delphi on YouTube
dummzeuch replied to silvercoder79's topic in Tips / Blogs / Tutorials / Videos
Break out the crayons and draw away. We don't need no stinkin' AI. -
Tool to sort units used in project by dependency
dummzeuch replied to uligerhardt's topic in Delphi IDE and APIs
You could try the nightly build or get the source code and compile it yourself (I do that once in a while, it's not rocket science but more complex than with GExperts). But I don't know whether this might solve the problem. -
Tool to sort units used in project by dependency
dummzeuch replied to uligerhardt's topic in Delphi IDE and APIs
cnpack has a tool to remove unused units from the uses list. It's not perfect, but a good starting point. -
I just now stumbled upon a small bug in a unit from Jedi Math which we are using. Any references to that library that google found seem to be rather outdated (some even talk about CVS access to the source code). Project Jedi on Github does not mention Jedi Math at all. Does anybody know whether this library is still being maintained? And if yes, who to contact and where?
-
No, I mean the Jedi Math library linked from https://wiki.delphi-jedi.org/wiki/JEDI_Math . It definitely looks unmaintained to me, but I thought I'd ask anyway.
-
There are none. Free can always be called on nil instance. I wasn't talking bout calling free for an object, but what you were describing next: As I said: Wrong example on my part. I apologize.
-
Ouch, yes you are right! I chose the wrong example. But there are always more complex examples where this won't work. (Unfortunately I can't think of one right now. GetMem/FreeMem should also work fine.)