-
Content Count
2561 -
Joined
-
Last visited
-
Days Won
133
Everything posted by Anders Melander
-
Changes in System.sysutils.pas were not reflecting in other unit in Delphi 11
Anders Melander replied to sp0987's topic in General Help
Assuming you have saved sysutils.pas to "C:\Testprojects\SampleApp\system" that part is okay. Now you just need to add the path of all the VCL/RTL units that use that unit so you can avoid "F2051 Unit XXX was compiled with a different version of YYY" - or make sure that you don't modify the interface section. I'm guessing the compiler options used to compile your sysutils copy might also have importance. Maybe someone else knows that. ...or solve the problem in some other way... -
Changes in System.sysutils.pas were not reflecting in other unit in Delphi 11
Anders Melander replied to sp0987's topic in General Help
I've not done any serious FMX development so I can't speak to that, but given how much code I write and the number and size of projects I work on, I do think I have had more than my fair share of problems with almost all areas of the RTL and VCL over the years. Editing the source files has never been an option I would consider. -
Changes in System.sysutils.pas were not reflecting in other unit in Delphi 11
Anders Melander replied to sp0987's topic in General Help
I can't recall when I last had the need for editing the source files. There are almost always other ways to solve a problem. -
ANN HelpNDoc 9.2 is available: AI-Powered Technical Writing, improved documentation import, and more...
Anders Melander replied to HelpNDoc's topic in Delphi Third-Party
While I have your attention 🙂 Have you considered adding functionality, or creating a new product, that solves the same needs as Documentation Insight? I.e. API documentation. I really like the way DI works but it seems like it went into maintenance mode many years ago. Probably because its HTML editor is based on Internet Explorer. Also, I've been waiting a decade for template support which was promised but never delivered.- 7 replies
-
- helpndoc
- help authoring tools
-
(and 1 more)
Tagged with:
-
Changes in System.sysutils.pas were not reflecting in other unit in Delphi 11
Anders Melander replied to sp0987's topic in General Help
The project search path has precedence. Post your .dproj file if you can. ...or you could explain what your end goal is; Why do you need to modify sysutils.pas? We might help you with a better solution. -
ANN HelpNDoc 9.2 is available: AI-Powered Technical Writing, improved documentation import, and more...
Anders Melander replied to HelpNDoc's topic in Delphi Third-Party
...depending on your definition of "smarter"- 7 replies
-
- helpndoc
- help authoring tools
-
(and 1 more)
Tagged with:
-
Changes in System.sysutils.pas were not reflecting in other unit in Delphi 11
Anders Melander replied to sp0987's topic in General Help
Don't do that. Leave Delphi's files and folder alone. This should work. Just make sure that the path to that file is before any other place where the compiler might find sysutils.pas or sysutils.dcu -
Changes in System.sysutils.pas were not reflecting in other unit in Delphi 11
Anders Melander replied to sp0987's topic in General Help
There's no difference between Delphi 7 and 11 with regard to modifying sysutils that I can think of. You have most likely not specified the correct project search path. Where have you placed the modified sysutils.pas ? -
Delphi and "Use only memory safe languages"
Anders Melander replied to Die Holländer's topic in General Help
ISO7185 (anno 1982) would like a word with you about that: There weren't, to my knowledge, any formal standards before this (the ANSI standard came 1983) but strings has been 1-based since the beginning. -
Create a class that implements a DispInterface
Anders Melander replied to michastro's topic in Algorithms, Data Structures and Class Design
Okay, so you are trying to interface to an external COM library. From the name of the interface I'm guessing this is the interface: https://ascom-standards.org/Help/Developer/html/T_ASCOM_DeviceInterface_ITelescopeV3.htm As you can read in the documentation... https://ascom-standards.org/Help/Developer/html/e7734c14-0562-4010-b0c9-ddb5055cd318.htm ...there should be a type library that you can use. The easiest way to use this type library is to have Delphi create a wrapper for you: From the Delphi IDE menu, select Component->Import Component... Select Import a Type Library Find the type library in the list or select Add and find it on your disk. Edit the Unit Dir Name to place the generated wrapper source code in your project source folder. I do not recommend that you select "Generate Component Wrappers". Select Add unit to <name of your project> project. Delphi will now have created a source file containing all the interfaces, dispinterfaces, enums, coclasses, etc. of the type library. In order to communicate with the library you will first have to create an instance of a COM object from it. There should be a function in the generated source that will do that for you but since I don't know the library I can't tell what the name of that function is. If you have some example code, in C, C++ or VB, it should be easy to see from that what you need to do. Post it if you have it and we can take it from there. -
Create a class that implements a DispInterface
Anders Melander replied to michastro's topic in Algorithms, Data Structures and Class Design
dispinterface isn't a keyword; Use interface instead: ITelescopeV3 = interface ['{A007D146-AE3D-4754-98CA-199FEC03CF68}'] . . end; -
Change "FadeOut" code to "FadeIn" code
Anders Melander replied to Willicious's topic in Delphi IDE and APIs
You can't do the fade-in from the constructor because the form isn't visible at that point. So: Create the form. Set MasterAlpha=0 Show the form Fade in I suggest you simply override ShowScreen: procedure TGameBaseScreen.ShowScreen; begin ScreenImg.Bitmap.MasterAlpha := 0; inherited; // Form is made visible here FadeIn; end; And there was an endless loop in the Fade in method. This one works: procedure TGameBaseScreen.FadeIn; var EndTickCount: Cardinal; TickCount: Cardinal; Progress: Integer; Alpha, LastAlpha: integer; const MAX_TIME = 1000; // mS begin ScreenImg.Bitmap.DrawMode := dmBlend; // So MasterAlpha is used to draw the bitmap TickCount := GetTickCount; EndTickCount := TickCount + MAX_TIME; LastAlpha := -1; while (TickCount <= EndTickCount) do begin Progress := Min(TickCount - (EndTickCount - MAX_TIME), MAX_TIME); Alpha := MulDiv(255, Progress, MAX_TIME); if (Alpha <> LastAlpha) then begin ScreenImg.Bitmap.MasterAlpha := Alpha; ScreenImg.Update; LastAlpha := Alpha; end else Sleep(1); TickCount := GetTickCount; end; ScreenImg.Bitmap.MasterAlpha := 255; end; -
ActionList Editor: New Standard Action...
Anders Melander replied to PeterPanettone's topic in General Help
Get a dog. -
Change "FadeOut" code to "FadeIn" code
Anders Melander replied to Willicious's topic in Delphi IDE and APIs
By bad; Change this: Progress := Max(TickCount - EndTickCount - MAX_TIME, MAX_TIME); to this: Progress := Max(TickCount - (EndTickCount - MAX_TIME), MAX_TIME); EndTickCount = StartTickCount + MAX_TIME <=> StartTickCount = EndTickCount - MAX_TIME so Elapsed time = TickCount - StartTickCount <=> Elapsed time = TickCount - (EndTickCount - MAX_TIME) -
Change "FadeOut" code to "FadeIn" code
Anders Melander replied to Willicious's topic in Delphi IDE and APIs
Something like this: procedure TGameBaseScreen.FadeIn; var EndTickCount: Cardinal; TickCount: Cardinal; Progress: Integer; Alpha, LastAlpha: integer; const MAX_TIME = 1000; // mS begin ScreenImg.Bitmap.DrawMode := dmBlend; // So MasterAlpha is used to draw the bitmap TickCount := GetTickCount; EndTickCount := TickCount + MAX_TIME; LastAlpha := -1; while (TickCount <= EndTickCount) do begin Progress := Max(TickCount - EndTickCount - MAX_TIME, MAX_TIME); Alpha := MulDiv(255, Progress, MAX_TIME); if (Alpha = LastAlpha) then begin Sleep(1); continue; end; ScreenImg.Bitmap.MasterAlpha := Alpha; ScreenImg.Update; LastAlpha := Alpha; TickCount := GetTickCount; end; ScreenImg.Bitmap.MasterAlpha := 255; Application.ProcessMessages; end; -
Poor image quality with DrawBitmap when destination is smaller than source
Anders Melander replied to XylemFlow's topic in FMX
True. Luckily nobody does that 🙂 Here's the bitmap resized with TAffineTransformation.Scale(0.1, 0.1) and TKernelResampler with TCubicKernel: So pretty much as bad as yours: But anyway, I think we can conclude that the problem isn't with the cubic filter itself but more with how it's applied. -
Poor image quality with DrawBitmap when destination is smaller than source
Anders Melander replied to XylemFlow's topic in FMX
So: A problem in your implementation - or rather a consequence of the way you have chosen to implement resizing images. Or did I misunderstand what you just wrote? -
Poor image quality with DrawBitmap when destination is smaller than source
Anders Melander replied to XylemFlow's topic in FMX
It looks to me as if there's a problem in your implementation... Here's what I get with a selection of Graphics32 kernels: Box Cubic Linear Cosine Spline Hermite Yes, there are differences but IMO they all look good. Even Spline which shouldn't really be used for down-sampling. Ignore the black line at the top of each image; It's caused by a bug in Firefox's clipboard handling of 32-bit RGBA bitmaps: https://bugzilla.mozilla.org/show_bug.cgi?id=1866655 https://forums.getpaint.net/topic/124628-1-px-line-on-top-of-every-image-pasted-into-firefox-from-paintnet/ https://github.com/graphics32/graphics32/issues/257 -
Record operator overloading, can use undocumented return type
Anders Melander replied to Khorkhe's topic in RTL and Delphi Object Pascal
FWIW, I agree with @Khorkhe; The documentation for the Equal operator appears to be wrong.- 6 replies
-
- record
- operator-overloading
-
(and 1 more)
Tagged with:
-
How to open a .pas file and position the line?
Anders Melander replied to xStingEucliffexxx's topic in Delphi IDE and APIs
Yes, you are going to use IOTA but you really need to read up on this topic until you understand it. The basic steps you must take is something like this (pseudo code; don't try to compile it): // Open the file in the IDE (BorlandIDEServices as IOTAActionServices).OpenFile('my_unit.pas'); // Get the file "module" var Module: IOTAModule := (BorlandIDEServices as IOTAModuleServices).FindModule('my_unit.pas'); // Iterate the module files for var i := 0 to Module.GetModuleFileCount-1 do begin // Get a module file editor var Editor: IOTASourceEditor; if not Supports(Module.GetModuleFileEditor(i), IOTASourceEditor, Editor) then continue; // Make the editor visible Editor.Show // Get an editor view if (Editor.GetEditViewCount = 0) then continue; var EditView: IOTAEditView := Editor.GetEditView(0); // Set the caret position var Position: TOTAEditPos; Position.Col := 1; Position.Line := ... EditView.SetCursorPos(Position); // Scroll to make caret visible and 15 lines down from the top Position.Line := Max(1, Position.Line-15); SetView.SetTopPos(Position); end; -
Does anyone have good routines for parsing ISO8601 date(time) strings
Anders Melander replied to Tommi Prami's topic in RTL and Delphi Object Pascal
There's one in DWScript: https://github.com/EricGrange/DWScript/blob/c3a26f0e68a5010767681ea1f0cd49726cd4af5d/Source/dwsUtils.pas#L3169 I haven't used it though but knowing Eric, it's probably both fast and well tested. Pity about the 3-space indents though; Very French 🙂 Other than that: https://github.com/search?q=lang%3Apascal+iso8601&type=code -
Any example bitmap to grayscale?
Anders Melander replied to Michael Collier's topic in Cross-platform
Please google color quantization and dithering. Because that's exactly what you are doing. -
How do I show a complete list of running processes?
Anders Melander replied to JohnLM's topic in General Help
You probably don't have the privileges to query all processes. Try running the application as administrator or elevate privileges from within your application. https://stackoverflow.com/questions/1435911/c-process-checking https://stackoverflow.com/questions/34511670/sedebugprivilege-and-openprocess-on-another-account- 3 replies
-
- delphi
- task manager
-
(and 3 more)
Tagged with:
-
Sure, I could have sugar coated it better. The point was really that when the expectations turns out not to match reality then one should question the expectations first.
-
- Once you think about it.