JonRobertson
Members-
Content Count
278 -
Joined
-
Last visited
-
Days Won
6
Everything posted by JonRobertson
-
Loading and Saving PNG into TBitmap changes the image
JonRobertson replied to XylemFlow's topic in FMX
Deleted invalid reply that was VCL specific. -
Assuming that the code for your component is already in a package, right-click on the package in the Projects window and select the Install menu item: The documentation that you referenced is lacking. If your component directly interacts with the Delphi IDE, such as using any of the Design*.pas units in the $(BDS)\Source\ToolsAPI folder, then you need to separate your design-time specific code from your run-time code and have separate design-time and run-time packages. Here are some links that may be helpful. Search engines are your friend: Creating Packages Runtime/Designtime what? Delphi Packages Component package - where to divide runtime, designtime, registration
-
Looking for Advice on Improving the Performance of Delphi Applications
JonRobertson replied to Andro12's topic in Tips / Blogs / Tutorials / Videos
And look at any code in events that may be accessing the underlying data source or server. For example, there are events that will fire as you scroll through the data shown in a db grid. If your grid, dataset, or datasource components have events connected, those will slow down the performance of using the grid. -
Your app may need elevated rights to kill the process. There are processes that cannot be killed via Task Manager, even when it is elevated. Some other apps (possibly Process Explorer or another utility from Sysinternals) are more aggressive and successful at killing processes. There are many system services cannot be killed and that would include any child processes that those services launch. Have you confirmed which techniques are able to kill this process, outside of writing your own code? That will be necessary to determine which approach would work for your code. If you haven't, I highly recommend determining what is launching the process and what it is doing, using another utility such as Process Monitor from Sysinternals. I have a strong dislike for background processes that consume CPU, I/O, or memory resources. But I research what they are doing and how they were launched to determine whether they are really needed or safe to disable.
-
What is Python Subprocess That's why I asked when others suggested TDOSCommand. From the github page, it only mentions command line apps.
-
Python's subprocess does more than DOS / command line stuff. How well does TDOSCommand work with Windows executables?
-
There is also TProcess, ported from Lazarus lcl. I've never used it and the last update was 7 years ago. I suspect most Delphi developers use CreateProcess, as long as the project is Windows only. See Darian's link above. Here are a few others: https://www.delphibasics.info/home/delphibasicssnippets/createprocessandwaitforexit http://www.delphicorner.f9.co.uk/articles/wapi4.htm https://riptutorial.com/delphi/example/18340/createprocess
-
You can also search for Glyph.Data in the DFM files. There are components other than TBitBtn that have a Glyph property, but each of those should (I think) be a visual component that has an image stored in the component that would be displayed in the app. I agree with others that you should either replace TBitBtn with a component that accomplishes your goal or switch to using either an image list or TImageCollection and TVirtualImageList. The later would be a better investment of the time required. You may also want to look at High DPI Image List Support.
-
Because every icon in a 1M line project would be affected?
-
BORLNDMM.DLL should only be needed if an EXE or DLL Delphi project has ShareMem in the project's uses clause (in the .dpr file). If that is needed and you are on a recent version of Delphi, replace ShareMem with SimpleShareMem. Related documentation is at https://docwiki.embarcadero.com/RADStudio/Athens/en/Sharing_Memory
-
Or set the options to put debug info in a separate file to be able to use a debugger without having the debug info in the EXE. The image below is Delphi 11.3. The option may be named or placed differently in various versions of Delphi.
-
Which libraries are you referring to? If you mean the Delphi Run Time Library, bundled VCL or FMX components, and third-party components, then Delphi builds a standalone EXE by default. There is an option to use run-time packages, which reduce the size of your EXE but require distributing those packages with your EXE: If you are referring to libraries that are not Delphi/Object Pascal code, then you need to be more specific with your question.
-
I can from Windows 10. I don't have an iOS device to test.
-
Where can I find the official version numbers of the embarcadero products?
JonRobertson replied to Mr. E's topic in General Help
I don't remember the specifics, but there was some legislation in the U.S. that restricted what a publicly owned software company could release as a "patch" or fix versus an update. -
Tool to sort units used in project by dependency
JonRobertson replied to uligerhardt's topic in Delphi IDE and APIs
Unfortunately cnpack causes an AV in rtl*.dll when LiveBindings packages are disabled, and a couple other AVs in the IDE. I had to uninstall cnpack until this issue is resolved: AV after exit RAD Studio 10.2.3 - 12.1 And hopefully this AV in coreide.bpl: Access violation in module 'coreide250.bpl' #170 Access violation in module 'coreide290.bpl' #192 -
Tool to sort units used in project by dependency
JonRobertson replied to uligerhardt's topic in Delphi IDE and APIs
Yes, it is noticeable. My last four projects have been migrating applications from Delphi 7 to 11.3. There were dozens of units referenced that could be either moved to implementation or removed completely. I've been able to get rid of numerous circular dependencies. Although the compile time reduction is not huge, it is noticeable even on a 200K loc project. Sadly, it takes Azure DevOps longer to check out the repo than building the source. -
Tool to sort units used in project by dependency
JonRobertson replied to uligerhardt's topic in Delphi IDE and APIs
Give it a shot and let us know. -
The data shown and potentially edited on a form comes from somewhere. So I populate the controls from the source and update if/when the user makes changes. If this is in the app with the base form and UpdateUIState implementation I described, I am still able to override methods like UpdateUIState for that form, that code doesn't care about a dataset. Another option is to use LiveBinding, although I've avoided LiveBinding myself. Just with Delphi? Do you use other languages with frameworks that provide a cleaner solution? The projects that I currently maintain do this as well. Although I am not a fan of requiring extra mouse clicks. It is easy to detect once a user has changed data and require the user to click Save or Cancel before closing the form.
-
Display a conditional message on data change...
JonRobertson replied to Ian Branch's topic in General Help
One suggestion would be to use a timer that is reset in OnDataChange. I've done something similar when implementing an incremental search, using the OnChange event of a TEdit for example. -
How to debug a Not Responding program element
JonRobertson replied to Willicious's topic in Delphi IDE and APIs
Perhaps it can't without knowledge of the helper class TListHelper. Although you were able to trace back to the point of code where Clear was called and it was shown in your screenshot. -
How to debug a Not Responding program element
JonRobertson replied to Willicious's topic in Delphi IDE and APIs
Thanks Anders. This approach is should be used rather than the one I posted. -
How to debug a Not Responding program element
JonRobertson replied to Willicious's topic in Delphi IDE and APIs
TGadgetAnimations is a TObjectList that holds a list of TGadgetAnimation: TGadgetAnimations = class(TObjectList<TGadgetAnimation>) There are multiple instances of TGadetAnimations created here: constructor TGadgetMetaInfo.Create; var i: Integer; begin inherited; for i := 0 to ALIGNMENT_COUNT-1 do begin fVariableInfo[i].Animations := TGadgetAnimations.Create; The TObjectList.OwnsObjects property defaults to True and is not set to False for any instance of TGadgetAnimations. This means that TGadgetAnimations will call Free on the instances of TGadgetAnimation that it holds (which are added by the call to Add). The TObjectList.Clear method will remove all instances of TGadgetAnimation that were added to that instance of TGadgetAnimations. Since OwnsObjects is True, calling Clear will also call Free on each instance. When AddPrimary is called the first time for the instance, it assigns a reference to TGadgetAnimation to fPrimaryAnimation. procedure TGadgetAnimations.Clone(aSrc: TGadgetAnimations); var i: Integer; NewAnim: TGadgetAnimation; begin Clear; NewAnim := TGadgetAnimation.Create(aSrc.PrimaryAnimation.fMainObjectWidth, aSrc.PrimaryAnimation.fMainObjectHeight); NewAnim.Clone(aSrc.PrimaryAnimation); AddPrimary(NewAnim); <-- This will assign fPrimaryAnimation if it is not assigned. When Clone is called, it calls Clear, which frees the TGadgetAnimation instances that were previously created. But, it does not clear the fPrimaryAnimation reference, which is now pointing to unallocated memory. Use the solution posted by Anders of overriding the Notify method. -
How to debug a Not Responding program element
JonRobertson replied to Willicious's topic in Delphi IDE and APIs
I also did not see any place where those particular object lists are created with Create(False) -
How to debug a Not Responding program element
JonRobertson replied to Willicious's topic in Delphi IDE and APIs
If TGadgetAnimation is not being freed, then it would have a reference to fName and the string would also be a leak. -
How to debug a Not Responding program element
JonRobertson replied to Willicious's topic in Delphi IDE and APIs
GadgetAccessor is assigned by the result of GetInterface. GetInterface creates the TGadgetMetaAccessor and assigns the reference to the FInterfaces array: function TGadgetMetaInfo.GetInterface(Flip, Invert, Rotate: Boolean): TGadgetMetaAccessor; var i: Integer; begin i := GetImageIndex(Flip, Invert, Rotate); if fInterfaces[i] = nil then fInterfaces[i] := TGadgetMetaAccessor.Create(self, Flip, Invert, Rotate); <-- Created reference assigned to fInterfaces Result := fInterfaces[i]; end; TGadgetMetaInfo.Destroy loops through fInterfaces and calls Free on each: destructor TGadgetMetaInfo.Destroy; var i: Integer; begin for i := 0 to ALIGNMENT_COUNT-1 do begin fVariableInfo[i].Animations.Free; fInterfaces[i].Free; end; inherited; end; Despite the misleading names of GetInterface and fInterfaces, these are not Delphi interfaces. TGadgetMetaAccessor is a class derived from TObject.