

PeterBelow
-
Content Count
560 -
Joined
-
Last visited
-
Days Won
13
Posts posted by PeterBelow
-
-
54 minutes ago, softtouch said:Delphi 12.2, I installed LockBox 3 via GetIt. So far so good.
I try to generate public and private keys, but I get all the time a range check error.
Here is the example code:
CryptoLib := TCryptographicLibrary.Create(nil); CodecRSA := TCodec.Create(nil); Signatory := TSignatory.Create(nil); CodecRSA.CryptoLibrary := CryptoLib; CodecRSA.StreamCipherId := 'native.RSA'; CodecRSA.AsymetricKeySizeInBits := 1024; Signatory.Codec := CodecRSA; Signatory.GenerateKeys; // <== Range Check Error Signatory.Free; CodecRSA.Free; CryptoLib.Free;
What am I doing wrong?
Probably nothing :). The default setting for range checking changed to "on" and the Lockbox version in GetIt may not reflect that yet. Try to use the latest version from github instead: https://github.com/TurboPack/LockBox3
-
Well, you have to make sure the program is build with debug information (check the project options) and also check the IDE debugger settings in the Tools -> Options dialog, under Debugger -> Embarcadero Debuggers. There you find two lists for exceptions the debugger was told to ignore.
-
13 hours ago, alogrep said:HI.
I receive this error (delphi 12,3):
F2051 Unit VCLTee.TeeProcs was compiled with a different version of Vcl.Menus.TPopupMenu
I searched for Vcl.Menus.TPopupMenu.* but nothing exists on the PC.
I searched all the VCLTee.TeeProcs.dcu on the PC (attached file (tee.txt)
The only menus file I got is Vcl.Menus.pas, which I included in the app.
I tried various combinations of the vcltee in the search path, but none seems to work.
By the way, in
C:\Program Files (x86)\Embarcadero\Studio\23.0\lib\win32\release
C:\Program Files (x86)\Embarcadero\Studio\23.0\lib\win64\debug
what the win32/win64 refer to? The O.S. or the app developed (in 32 bit or 64bit)?
Also. i should use the dcu from the debug folder in 23.0 if i am compiling my app
in debug mode and the one from the release folder in 23.0 if i am compiling in release mode?
You usually get these "different version" errors if you have several versions of Delphi/RADStudio installed and try to move an older project to the newer version. Some path setting in the project options then may refer to a folder holding dcus from the older Delphi version and that results in this error when compiling. So check the project options, or delete the project's DPROJ file and open the corresponding DPR in the IDE to make it generate a new DPROJ.
Oh, and the lib subfolders hold the dcus needed if you build a program for either the Win32 or Win64 target platform, they have nothing to do with the OS version you are running on.
-
Check the blog for the patch, I think it mentions that you have to redeploy the new paserver executable manually.
-
Oh, I forgot: we have C++Builder section in this forum, perhaps someone there has the old demos available.
-
For RADStudio versions before 10 the demos were part of the installation package, if memory serves, If you have not done so and are desparate enough 8-) look what is available for you on my.embarcadero.com, download older ISOs and check their content for the demos.
-
-
11 hours ago, Mark Williams said:I'm working on a component derived from a TTabControl. I want to manipulate the individual tabs in various ways. To do so I need to override the DrawTab event. This works well until you activate a theme and then the DrawTab event doesn't fire unless you disable seClient for styleElements., which I don't wish to do as I don't want to have to try and draw the body.
If I add a TTabControl to a form and then access its OnDrawTab event, I can override the themed drawing of the tab with a theme active even though seClient styleElements is true.
That seems a bit odd to me.
I have tried catching various paint messages and tab drawing messages, but nothing seems to fire in my custom control with seClient set to true.
Is there a way of doing this?
Try to add a class constructor and destructor to your custom control, like
class constructor TMyTabControl.Create; begin TCustomStyleEngine.RegisterStyleHook(TMyTabControl, TTabControlStyleHook); end; class destructor TMyTabControl.Destroy; begin TCustomStyleEngine.UnRegisterStyleHook(TMyTabControl, TTabControlStyleHook); end;
Of course you need to use your component class name instead of TMyTabControl.
-
1
-
1
-
-
7 hours ago, PiotrCh said:When TStringGrid or TDrawGrid is read only (goEditing off), than I see issues with the keyboard.
If there is somewhere e.g. label with Caption="&Word Wrap", than
when grid is focused and I press "W", the action Alt+W is triggered without me pressing Alt.
This is super easy to replicate, can someone comment what is going on? And how to fix it or mitigate?
Reagrds,
Piotr
It has worked this way for many Windows versions: if the control with focus is not editable a shortcut will be triggered if the matching character key is pressed even if Alt is not held down. The VCL just adheres to that Microsoft UI design choice. You can add a handler for the parent form's OnShortcut event (or override the virtual IsShortcut method) to change the default behaviour.
If you want to learn more about key handling in a VCL app here is a link to an old article of mine on the subject (Delphi 7 vintage).
-
1 hour ago, MarkShark said:S := 'Testing: ' + V;
The error message indicates that the compiler is not evaluating the right-hand side expression as you expect. Instead of converting V to a string and concatenating the result to the string literal it is trying to convert the literal to a variant containing a TBcd, adding the two numbers, and then convert the result to a string. If you have a masochistic streak put a breakpoint on the statement, run to it, call up the disassembly view and F7 through the generated code (debug dcus need to be enabled).
I would not call that a bug, just unexpected behaviour. But as you know, in programming the compiler is always right... 🙂
-
3
-
-
OK, I would not do it this way, but your problem is probably a missing FormType node in the DPROJ file. Look for nodes "DCCReference Include" and see how a "uninherited" datamodule is defined there. Compare with one of your derived datamodules.
-
To make the inheritance work for designer classes like a data module your
TBaseDataModule
has to have a DFM-file, even if it is practically empty, but it must contain a valid Name property. The simplest way to get one is to create a new data module in the IDE and change its Name property to BaseDataModule, then save the unit under the name you want. You can now change the inheritance of your
TMainDataModule
in the editor, but you also have to switch the designer for that module to the dfm view and there change the first "object" keyword to "inherited". And make sure your TBaseDatamodule is not in the list of autocreated items! You can delete the BaseDataModule variable the IDE created for you, it is not needed.
-
Microsoft has released several versions of the richedit control over the decades, TRichedit in the current Delphi version (since 11.0 if memory serves) is based on version 4
(the latest and most feature-rich). The Jedi version may be based on an older version. The divers versions are implemented in separate DLLs with different names and use different window class names, so they can coexist on a given Windows system. Different versions may explain the behaviour you see.
-
Won't the MS Store sign the package for you when you upload it? I dimly remember some mention about this (also for Google and Apple app stores) in a webinar i watched recently.
-
-
1 hour ago, GabrielMoraru said:So, I have a program that uses the precompiled units of a library.
This:
- Allows me to keep the Search Paths totally empty (as they should be)
- Prevents the compiler from keep recompiling the files of the library unnecessarily, saving compilation time.
But if the library has DFM files, the compiler will throw that famous "where are my DFM files?" error message.
The "solution" (well, it is not a real solution, but rather a dirty trick) is to (manually or by script) copy the DFM files to the DCU folder of that library.
Four output DCU paths, four copies. What a nasty "solution"...
So, did anyone found a more elegant way to solve this?
I see in some old DProj files an entry called <DCC_ResourcePath>, but there is no page in "Project options" or in IDE's "Tools -> Options" to set that path.I just add the "library" foms to the project that needs them, this way the required path is in the dpr file uses clause.
Btw.: I think this DCC_RessourcePath is for the resource compiler and you can set it under that node in the Options dialog. Never needed that myself, though.
-
1 hour ago, mikerabat said:Note that we do not know in beforehand how long the hints are shown - sometimes it takes long (depeding on the amount of data transferred) sometimes it is fast...
Then why don't you delegate the hint showing to a task running in a secondary thread? The task can wait for a short interval and if it is cancelled before that interval has elepsed the hint will not be shown at all...
-
Just now, dormky said:I've tried calling Application.ProcessMessages from a thread, that didn't work. Had to try it lol.
My goal is to have a loading gif playing while the work is ongoing. The work cannot be moved out of the main thread, as this would require rewriting multiple thousands of lines of code, which is sure to create bugs (especially as this deals with COM ports).
Any ideas ?
The answer is no since the update would have to be triggered somewhere from inside the work code.
But you can create and show a window from a secondary thread, it is just a bit cumbersome to do since the visual part of the VCL is not thread-safe. The secondary thread needs a message loop that will process all messages for the window, including timers and paint messages. The simplest way to get that loop is to show the window modally. And the safest way to do such stuff is to not use a Delphi form but do it all the API way (hence the cumbersome part above 8-)).
If you want to use a Delphi form the important points to mind are:
- Do not autocreate the form!
- Create the form inside the Execute method of the secondary thread, using Nil as owner. Use a try finally block to make sure the form is destroyed. Use a field of the thread class to store the form reference.
- ShowModal the form.
- Add a public method to the thread class the main thread can call to get the form to close once the work is done. The method should set the form's ModalResult to mrCancel to allow the modal loop to exit normally.
-
Try to set the KeyValue property to the ID you want to look up.
-
A Windows service should to all of its work in a secondary thread started in the OnStart event (and terminated in OnStop, perhaps also paused and resumed if possible in the corresponding events). The main thread should only process commands received from the service manager, which TService handles internally.
That aside: from a look at the source TServiceApplication actually starts any services in a secondary thread and, after launching that, goes into a simple loop (actually it calls Vcl.TApplication.Run) which does the normal Idle processing, including the CheckSynchronize call that handles queued or synchronized tasks from background threads. So your construct will probably work, but I would not go this way in a service application. If the queued call blocks for some reason that would prevent the service app from terminating.
-
1 hour ago, Squall_FF8 said:Hi guys,
I use TDateTimePicker, but I cant find a method to "nullify" it. The value will be passed to SQL query, so I would like to be able to pass Null.
P.S. I have 2 pickers, one for date and one for time. They both should be able to pass "no value" (null).
The control has a ShowCheckbox property. This gives the user a checkbox to check or uncheck to indicate a NULL or NOT NULL state. The Checked property then tells you the user's descision. A bit cumbersome but the Windows common control behind TDatetimepicker has no concept of an "empty" state.
-
3 hours ago, skyzoframe[hun] said:Greetings everyone,
I want to sort a tList with some kind of record parameter. Somehow I need to use pointers to get to the record without using the name of the record.
In this example I am using the name "Rec.x". However, in the future I would like to use "Rec.y", "Rec.z","Rec.ID" or any other record value in the sort. // See below
In fact, I have never used pointers before.
"function Foo.BubbleSort(AList: dmA00; SomeParameterHere:IsSomething ;out Error: String): Boolean;"
...
" if jRec.SomeParameterHere > j1Rec.SomeParameterHere then"
kind regards Zoltan.K
A TList<T> has a constructor overload that takes a comparer (IComparer<T> instance) to use for sorting and searching the list by default. The Sort method also has such an overload. You use
TComparer<T>.Construct()
to fabricate a suitable comparer on the fly, providing an anonymous method that does the actual comparison of two items in the way you want the sort to go. This anonymous method has to "know" the record type in question, so you can directly refer to the fields of the two items passed to it.
Forget about pointers, you do not need them to work with generics.
-
2
-
-
25 minutes ago, Squall_FF8 said:Hi guys,
I want to save/load the main window position, size, state so every time you reopen it, it looks the it was when you close it.
So the snippet bellow. It works ,... almost. When I close the app with a maximized window, after relaunch it is maximized, If I click the button to make it Normal, it doesnt go where I left it previously before maximizing.
Can you help me? What I'm missing?P.S. If it matters, I use Delphi 12.2, on Win 10.
Set the DefaultMonitor property of the form to dmDesktop, this way the form left and top do not depend on the monitor the form is on and will restore the form to the monitor it was on before (unless the user rearranges his desktop configuration). For the necessary code see the PB.Winset unit in the attached archive.
-
On 3/5/2025 at 1:18 PM, DaveB said:Hi everyone,
I am pretty much a newbie in Delphi (learnt a bit of Pascal and Delphi 20 years ago, but coming back to it in 2025 and everything feels very new to me). My intention is to start developping an app to handle chemistry operations. There are several nice toolkits around, for instance:
- EPAM's Indigo toolkit https://lifescience.opensource.epam.com/indigo/ (with pre-existing wrappers for C/C++/C#/Java/Python)
- Greg Landrum's RDKit https://www.rdkit.org/ (Python and C++ wrappers exist, as well as a MinimalLib CFFI https://greglandrum.github.io/rdkit-blog/posts/2021-05-01-rdkit-cffi-part1.html)
- the Chemistry Development Kit https://cdk.github.io/ (with tutorials to interface it in Java)
and probably others. However, I could not find any Delphi wrapper for any of them, nor any example case where someone would have been interfacing them in a Delphi app.
Well, well, has been some years since somebody asked about chemistry here 8-)...
As it happens I am a (retired) organic chemist and have worked for more than 30 years for a german (later french) pharma company in research. I wrote a lot of software working with chemical information, mostly from chemical databases. While the core of my library depended on MDL (later Accelrys) ISIS (long dead) and their Oracle chemistry package I tried during my last year at the company to get rid of the ISIS dependency by creating a Delphi wrapper for the Indigo library. Unfortunately I did not have enough time to complete and test the wrapper, and it is based on the 2017 32-bit Indigo DLLs, but perhaps you can find something of use in the mess. I also included some other units related to chemistry in the attached archive without ISIS dependencies.
Have fun ;).
-
1
-
Has the toolbar problem been fixed?
in Delphi IDE and APIs
Posted
Are you aware that the IDE uses different layouts for design and debugging modes? Just arrange the IDE once as you want it to show while debugging, save this layout under a name of your choice, and define it as the debug layout to use. See https://docwiki.embarcadero.com/RADStudio/Athens/en/Desktop_and_Layout