Correct.
You can't. So, either store all objects only, or all integers only. Don't mix types. But, if you must, then you'll need to either wrap the integers inside of objects, or add an extra header in front of each value to identify its type, etc.
Check the TImage.Picture.Graphic property:
if (Image1.Picture.Graphic = nil) or Image.Picture.Graphic.Empty then
You can assign nil to the TImage.Picture property:
Image1.Picture := nil;
// same as:
// Image1.Picture.Assign(nil);
Or to its Graphic property:
Image1.Picture.Graphic := nil;
Another option might be to use tagged pointers.
Normally, objects are aligned in memory in such a way that there are certain bits in object pointers that are always unused/zero, which can be repurposed if you are careful.
For instance, if you limit your integer values to 31 bits (x86) or 63 bits (x64), you can use an unused bit in a pointer to flag whether the pointer holds an integer value vs an object address, and just mask off the bit when extracting the value.
dummzeuch replied to dummzeuch's topic in GExperts
I've been asked this question several times before:
Yes I did, no I won't.
Edit: I should have mentioned that this is also answered in the FAQ in the post pinned to this sub forum:
https://en.delphipraxis.net/topic/4123-about-gexperts-some-frequently-asked-questions/
Very important, if you use TForm.OnCreate events and plan to work with Delphi 10 and 12.3 in parallel for a while: They dropped the TForm.OldCreateOrder property. All previous Delphi versions set this value to False when a new form was created in the IDE. But if open an existing project in Delphi 12 and save a dfm file, the OldCreateOrder value will be removed. When you then open it in Delphi 10 OldCreateOrder will get assigned its default value, which is True. So by saving in Delphi 12 and then in Delphi 10 the OldCreateOrder value changes from False to True. Uwe Raabe blogged about the consequences this can have.
On top of that you will likely have much "fun" with Windows per display scaling which is supported by Delphi 12.
Anders Melander replied to CyberPeter's topic in General Help
Source attached.
I use this code in most of my open source/freeware tools.
Features:
Fades image in/out on show/hide.
Can be moved with the mouse.
Automatically hidden when deactivated.
A text can be displayed on top of the image.
Text can be scrolled to create vertical banner.
Can play a audio resource while visible.
Can also be used as an "About box".
Things to note:
Splash does not "stay on top" when running in the debugger. This is by design.
Doesn't handle HighDPI scaling well (image isn't scaled).
SplashDemo.zip