Jump to content

Anders Melander

Members
  • Content Count

    2561
  • Joined

  • Last visited

  • Days Won

    133

Everything posted by Anders Melander

  1. Anders Melander

    FileOpen dialog not showing all files

    Ah!... Have a look at C:\Windows\SysWOW64\fr-FR instead See it now?
  2. Anders Melander

    Convert Png To ico fmx delphi

    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.
  3. Anders Melander

    FileOpen dialog not showing all files

    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 🙂
  4. Anders Melander

    Convert Png To ico fmx delphi

    Does it work well with FMX? I like cats.
  5. Anders Melander

    Some more fun with ChatGPT and Delphi

    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.
  6. Anders Melander

    Some more fun with ChatGPT and Delphi

    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?
  7. Anders Melander

    Some more fun with ChatGPT and Delphi

    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
  8. Anders Melander

    Skia component and IDE

    I wouldn't be surprised. After all, there was a time when Basic programs ran faster if you used short variable names 🙂
  9. Anders Melander

    Skia component and IDE

    Have you tried resetting the component list?
  10. Anders Melander

    Skia component and IDE

    WHAT? I DON'T UNDERSTAND YOU. SPEAK LOUDER! I'M A BIT DUMB SO YOU'LL HAVE TO SPEAK REALLY, REALLY SLOW - AND LOUD.
  11. Anders Melander

    KeyDown and Shift state

    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.
  12. Anders Melander

    Skia component and IDE

    https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Classes.RegisterComponents https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_the_RegisterComponents_Procedure
  13. Anders Melander

    Convert Png To ico fmx delphi

    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;
  14. Anders Melander

    Convert Png To ico fmx delphi

    I'm guessing you've never had to write code that can read and write icons in all of the supported formats 🙂
  15. Anders Melander

    ANN: Better Translation Manager released

    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?
  16. Anders Melander

    ANN: Better Translation Manager released

    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.
  17. Anders Melander

    How to detect if a Dialog is open/running?

    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;
  18. Anders Melander

    MAP2PDB - Profiling with VTune

    Fixed.
  19. Anders Melander

    MAP2PDB - Profiling with VTune

    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.
  20. Anders Melander

    MAP2PDB - Profiling with VTune

    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.
  21. Anders Melander

    MAP2PDB - Profiling with VTune

    Thanks. I'll get that fixed. https://bitbucket.org/anders_melander/map2pdb/issues/4/segment-index-incorrectly-parsed-as-hex
  22. Anders Melander

    Close application during form create??

    PostQuitMessage
  23. 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.
  24. 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.
×