-
Content Count
2561 -
Joined
-
Last visited
-
Days Won
133
Everything posted by Anders Melander
-
Ah!... Have a look at C:\Windows\SysWOW64\fr-FR instead See it now?
-
Sorry, I should have been more clear in my sarcasm. I probably haven't had enough coffee yet. What I meant to "say" was that external tools are irrelevant in this context. The OP asked for a Delphi solution for use with FMX.
-
Reproduced. Not only does the file open dialog not show all files. It refuses to accept the names of the files it doesn't show. I have reproduced with both Delphi applications ** and notepad++ (which presumably isn't written in Delphi). Notepad.exe can see the files. Intriguing... **) Resource Editor 🙂
-
Does it work well with FMX? I like cats.
-
Some more fun with ChatGPT and Delphi
Anders Melander replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
Sure; It's a nice party trick. But it gets old. Exactly. Most of the examples I have seen so far of ChatGPT magically writing code usually involves the operator coaching it through iterations of incorrect answers toward the known correct answer. ChatGPT's linguistic abilities are very impressive. The rest, not so much. -
Some more fun with ChatGPT and Delphi
Anders Melander replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
Um... An explanation of why it's interesting for example. As far as I can tell it performed just as one could expect. Is that interesting? -
Some more fun with ChatGPT and Delphi
Anders Melander replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
I think you're assuming that I find the answers interesting, which I do not. I'm asking why he thinks they're "quite interesting". From a socio-psychological viewpoint, I think people's view of ChatGPT is "quite interesting". Beyond that, from what I've seen so far, the only practical use for ChatGPT is to waste everybody's time. YMMV -
Some more fun with ChatGPT and Delphi
Anders Melander replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
How so? -
I wouldn't be surprised. After all, there was a time when Basic programs ran faster if you used short variable names 🙂
-
Have you tried resetting the component list?
-
WHAT? I DON'T UNDERSTAND YOU. SPEAK LOUDER! I'M A BIT DUMB SO YOU'LL HAVE TO SPEAK REALLY, REALLY SLOW - AND LOUD.
-
You can see from the method signature that Key can be modified (it's passed by reference; as a "var") and that Shift cannot (it's passed by value). We cannot tell if it's "the best way" since you haven't really explained what problem you're solving (see XY problem) - And we cannot predict your future. One thing to be aware of is that keyboard events are read from the message queue in the order in which they occurred. Keybd_Event will append to this queue so you might end up with a key sequence that doesn't correspond to what actually occurred.
-
https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Classes.RegisterComponents https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_the_RegisterComponents_Procedure
-
Actually, IME, the PNG sub-format is the least troublesome; It just has a PNG file instead of the regular BMP pixel data. No, it's the non-alpha formats, and in particular, the 1 bpp format, that is the worst. If the task here is to convert a PNG to an ICO I would just create an ICO header with a single 32bpp PNG sub-image and then simply use the PNG as-is for the sub-image. Something like this (not tested): const RES_ICON = 1; RES_CURSOR = 2; type TIconDirectoryHeader = packed record Reserved: Word; // Reserved; must be zero. ResType: Word; // Specifies the resource type. This member must // have one of the following values: // RES_ICON Icon resource type. // RES_CURSOR Cursor resource type. ResCount: Word; // Specifies the number of icon or cursor // components in the resource group. end; TIconDirectoryEntry = packed record Width: Byte; Height: Byte; ColorCount: Byte; Reserved: Byte; ResInfo: packed record case byte of RES_ICON: ( IconPlanes: Word; IconBitCount: Word); RES_CURSOR: ( CursorHotspotX: Word; CursorHotspotY: Word); end; BytesInRes: DWORD; ImageOffset: DWORD; end; TColorDepth = 1..32; // Bits per pixel. Not bits per plane. function ColorDepthToColors(ColorDepth: TColorDepth): cardinal; begin Result := 1; while (ColorDepth > 0) do begin Result := Result shl 1; dec(ColorDepth); end; end; // PngStream: A stream containing the PNG // IcoStream: The outout stream // AWidth: Width of the PNG // AHeight: Height of the PNG // AColorDepth: Color depth of the PNG procedure SavePngStreamToIcoStream(PngStream, IcoStream: TStream; AWidth, AHeight: integer; AColorDepth: TColorDepth = 32); begin var IconDirectoryHeader: TIconDirectoryHeader := Default(TIconDirectoryHeader); var IconDirectoryEntry: TIconDirectoryEntry := Default(TIconDirectoryEntry); IconDirectoryHeader.ResType := RES_ICON; IconDirectoryHeader.ResCount := 1; IcoStream.Write(IconDirectoryHeader, SizeOf(IconDirectoryHeader)); // Note : 256x256 icon sets Width&Height to 0 (according to docs) or to 255 (according to .NET) IconDirectoryEntry.Width := AWidth and $FF; IconDirectoryEntry.Height := AHeight and $FF; var BitCount := 0; var ColorCount := 0; case AColorDepth of 1, 4: ColorCount := ColorDepthToColors(AColorDepth); else BitCount := AColorDepth; end; IconDirectoryEntry.BytesInRes := PngStream.Size; IconDirectoryEntry.ImageOffset := SizeOf(IconDirectoryHeader) + SizeOf(IconDirectoryEntry); IconDirectoryEntry.ResInfo.IconPlanes := 1; IconDirectoryEntry.ResInfo.IconBitCount := BitCount; IconDirectoryEntry.ColorCount := ColorCount; IcoStream.Write(IconDirectoryEntry, SizeOf(IconDirectoryEntry)); IcoStream.CopyFrom(PngStream, 0); end;
-
I'm guessing you've never had to write code that can read and write icons in all of the supported formats 🙂
-
ANN: Better Translation Manager released
Anders Melander replied to Anders Melander's topic in Delphi Third-Party
No. I'm guessing you want it to update the project with any changes made to the EXE, right? But why? What problem are you trying to solve? -
ANN: Better Translation Manager released
Anders Melander replied to Anders Melander's topic in Delphi Third-Party
Good idea. Optimally I'd like to have a dialog that shows exactly (in a grid that can be sorted grouped and searched) what changed. There are several cases where it would be much better to use a custom form instead of a standard message dialog, but it's just so much faster (in terms of implementing it) to just display a message dialog. Yes 🙂 Not very intuitive. I'll see if I can differentiate between the three cases: Added, Unused and Re-added. -
How to detect if a Dialog is open/running?
Anders Melander replied to Ian Branch's topic in General Help
I'm not sure I understand your description, but you might: Check Application.ModalLevel to determine if a (Delphi) modal dialog is active. Check Screen.ActiveForm to determine exactly which form is currently active. or simply avoid the problem altogether by not executing the timer code while a modal dialog is active: procedure TMyForm.TimerAlertMessageTimer(Sender: TObject); begin TTimer(Sender).Enabled := False; try var FormAlertMessage := TFormAlertMessage.Create(Self); try FormAlertMessage.ShowModal; finally FormAlertMessage.Free; end; finally TTimer(Sender).Enabled := True; end; end; or procedure TMyForm.TimerAlertMessageTimer(Sender: TObject); begin if (Application.ModalLevel > 0) then exit; // Modal dialog is active; Punt! var FormAlertMessage := TFormAlertMessage.Create(Self); try FormAlertMessage.ShowModal; finally FormAlertMessage.Free; end; end; -
MAP2PDB - Profiling with VTune
Anders Melander replied to Anders Melander's topic in Delphi Third-Party
Fixed. -
MAP2PDB - Profiling with VTune
Anders Melander replied to Anders Melander's topic in Delphi Third-Party
Yes, it is - but I like the spirit of Gitlab. I need to get some real-life experience with it anyway because I also plan to switch the company from BitBucket to Gitlab at some point. Github is way too expensive for enterprise use. I've had a Gitlab account for quite some time. AFAIR I didn't need to "apply". I think I just checked a box somewhere. -
MAP2PDB - Profiling with VTune
Anders Melander replied to Anders Melander's topic in Delphi Third-Party
Yup. That pretty much sums it up. Like everything else Atlassian touches it only gets worse with time. My plan is to switch everything to Gitlab at some time but other stuff keeps getting in the way. -
MAP2PDB - Profiling with VTune
Anders Melander replied to Anders Melander's topic in Delphi Third-Party
Thanks. I'll get that fixed. https://bitbucket.org/anders_melander/map2pdb/issues/4/segment-index-incorrectly-parsed-as-hex -
Close application during form create??
Anders Melander replied to Ian Branch's topic in General Help
PostQuitMessage -
Is asked ChatGPT: What is Internet Component Suite for Delphi?
Anders Melander replied to FPiette's topic in ICS - Internet Component Suite
I'm sorry but I don't think you understand what ChatGPT is and what it is not. I think you see something that closely mimics a certain aspect of human behavior and interpret that as some level of intelligence. Well, it's not. It just appears that way - which is exactly what it was designed to do. Mission Accomplished. -
Is asked ChatGPT: What is Internet Component Suite for Delphi?
Anders Melander replied to FPiette's topic in ICS - Internet Component Suite
The problem is that you can't use the answers for anything; It's unreliable. While the answers might sound authoritative you can't trust them to be correct and you would have to research the topic in order to determine if they actually were correct. https://www.google.com/search?q=how+tall+can+a+pyramid+get If you can't trust it, what good is it? It's like a fully self-driving car that doesn't kill anyone "most of the time". LOL. A good example of ChatGPT being clueless about the topic it talks about while being very good at talking about it. We got plenty of those already.