Jump to content

Anders Melander

Members
  • Content Count

    2850
  • Joined

  • Last visited

  • Days Won

    156

Everything posted by Anders Melander

  1. Anders Melander

    Is it possible to implement floating/fully custom Dropdown Menus?

    It took me a good while to spot the difference between the two screenshots but I get your meaning. AFAIK it's possible to control DevExpress' skinning of standard VCL controls to some degree. See TdxSkinController.OnSkinControl The dependencies though 😕
  2. Anders Melander

    Is it possible to implement floating/fully custom Dropdown Menus?

    The easiest way is probably to just use a TForm as the poup. You need to: Display the form with ShowWindow(SW_SHOWNA). Handle WM_NCACTIVATE to avoid the form activating when clicked. In CreateParams: Set Params.WndParent to the parent form. Add WS_POPUP and WS_CLIPCHILDREN to Params.Style and exclude WS_CHILD. Add WS_EX_TOPMOST and WS_EX_TOOLWINDOW to Params.ExStyle. If you will be implementing the form shape with alpha blending then you also need to add WS_EX_LAYERED. Shape the form either with alpha blending (WS_EX_LAYERED and SetLayeredWindowAttributes) or with regions (I can't remember the APIs for that OTOH). I'm sure that if you search github for the above (with lang:pascal) that you can find some Delphi examples. See also: http://melander.dk/articles/alphasplash/ ...or you could just throw some $$$ at DevExpress and use their TdxCalloutPopup control:
  3. Oh - You meant what version of RAD Studio is installed on the local system. I think the InstalledUpdates registry key is the closest you can get. There's no guarantee that it's valid though since it's only informational.
  4. GetRTLVersion would be my guess. The actual values appears to be undocumented though - but here's an unofficial list to get you started: https://delphidabbler.com/notes/version-numbers
  5. Anders Melander

    Bitmaps to Video for Mediafoundation

    "Not thread-safe" in this case doesn't mean crash and burn. It just means that if one thread modifies the global FormatSettings then it will affect all other threads also using it. Hardly a problem - even if you did output floating point values in the exception message.
  6. Anders Melander

    Bitmaps to Video for Mediafoundation

    Likely because Renate is using a newer version of Delphi. As far as I can tell the faulty code was contributed by someone else.
  7. Anders Melander

    Bitmaps to Video for Mediafoundation

    🙂 No, of course that doesn't work A dynamic array is initialized to an empty array so there needs to be a SetLength first.
  8. Anders Melander

    Bitmaps to Video for Mediafoundation

    FWIW & FYI: Newer versions of Delphi have IntToHex overloads for NativeInt to match the size of a pointer. I think it got introduced in Delphi 10. TArray<T>, being a dynamic array, is a manages type and string too, so TArray<string> should be initialized automatically. Probably a compiler bug.
  9. Anders Melander

    Bitmaps to Video for Mediafoundation

    If only there was some magic key you could press in the editor to display help about various relevant topics... 🙂 I only ever use %s %d, %n and %x - and I use those a lot so that helps but I sometime need to consult that magic key when it comes to the precision or index specifiers.
  10. Anders Melander

    Bitmaps to Video for Mediafoundation

    There's not even a need for try..finally since there no resources to protect; Get rid of hr, assign the results to Result directly and just exit. Also, instead of: raise Exception.Create('Fail in call nr. ' + IntToStr(Count) + ' of ' + ProcName + ' with result $' + IntToHex(hr)); I would use: raise Exception.CreateFmt('Fail in call no. %d of %s with result %x', [Count, ProcName, hr]); for readability.
  11. Anders Melander

    Creating webp files with Skia fails

    I'm pretty sure Skia's BMP handling isn't bug-free but it's way more likely that this problem is caused by the Delphi side of things; The alpha handling in VCL's TBitmap is such a horrible mess that it should be deprecated and reimplemented from scratch. See also:
  12. Anders Melander

    Creating webp files with Skia fails

    FWIW, this is what it looks like in Firefox, so not totally broken:
  13. Anders Melander

    What .PAS file does a form use?

    I'm working on a project like that; New units are named consistently after strict rules so we can easily locate the relevant unit. Old units are named after whatever the developer had time to type (and apparently he was always in a rush). So I introduced a "magic" key that when pressed at run-time displays the name of the active form/frame. It's basically just a TApplicationEvents.OnShortCut on the main form: procedure TFormAnynymizedToProtectTheGuilty.ApplicationEventsShortCut(var Message: TWMKey; var Handled: Boolean); begin {$ifdef DEBUG} if (Menus.ShortCutFromMessage(Message) = ShortCut(VK_F1, [ssAlt])) then begin if (Screen.ActiveCustomForm <> nil) then begin var Msg := ''; // Find frames in the form var Control := Screen.ActiveControl; while (Control <> nil) and (Control <> Screen.ActiveCustomForm) do begin if (Control is TFrame) then Msg := Msg + Format('Embedded frame: %s in %s.pas', [Control.ClassName, Control.UnitName]) + #13 else if (Control is TForm) then Msg := Msg + Format('Embedded form: %s in %s.pas', [Control.ClassName, Control.UnitName]) + #13; Control := Control.Parent; end; Msg := Msg + Format('Active form: %s in %s.pas', [Screen.ActiveCustomForm.ClassName, Screen.ActiveCustomForm.UnitName]); TaskMessageDlg('YOU ARE IN A MAZE OF TWISTY LITTLE PASSAGES, ALL ALIKE.', Msg, mtInformation, [mbOK], 0); end; Handled := True; end; {$endif DEBUG} end;
  14. Anders Melander

    64bit RTL patches with Intel OneApi and TBB

    AFAIR a lock-free FIFO queue can be implemented with just TInterlocked.CompareExchange (i.e. InterlockedCompareExchange).
  15. Anders Melander

    Physically reduce jpeg image size??

    StretchDraw? That's a horrible solution - to a 4 year old problem.
  16. Anders Melander

    How do I assert a single ?

    I would argue that the type of Epsilon depends on the use case; For one an absolute explicit Epsilon is suitable (SameValue(Value, Epsilon)), for another an absolute implicit Epsilon will make sense (SameValue(Value) but with some better defaults), and for yet another a relative magnitude Epsilon would be desirable (let's call it KasObSameValue(Value, Epsilon) since we don't have it in the RTL). FWIW, the same discussion could be had about IsZero. I mostly use it to avoid division by zero and overflow errors caused by division by a very small number. I'm not really comfortable doing it but the alternative is the gazillion sporadic exceptions we had in the old application I'm working on, before we began using it.
  17. Anders Melander

    Why does my external manifest work only sometimes?

    Google "manifest cache"
  18. Anders Melander

    How do I assert a single ?

    No argument there.
  19. Anders Melander

    How do I assert a single ?

    I think you are missing my point. I'm saying that SameValue, with Epsilon specified, is documented to work in the way it does now. If it didn't then that would be a bug. You can argue that it would be better if it worked in another way (e.g. Epsilon relative to the magnitude of value) but that is not how it is documented to work, it is also subjective, and it depends on how one intends to use it. It's like arguing that the right way to index strings is zero based.
  20. Anders Melander

    How do I assert a single ?

    Should? As far as I can tell the current implementation matches the documented behavior. Yours doesn't. You might prefer another behavior, which is perfectly reasonable, but it doesn't make the current one wrong. I agree that SameValue without the Epsilon parameter is at best problematic but, with regard to the choice of default Epsilon, we don't know what the criteria was for the values they chose (because it isn't documented) so I can't see how we can say that they are wrong. Again; We might prefer other values but that doesn't make the current values wrong.
  21. Anders Melander

    How do I assert a single ?

    Only if you don't specify a tolerance. I can't see anything wrong with it if you specify a tolerance.
  22. Anders Melander

    How do I assert a single ?

    Multiply by a 10^"number of decimals", Trunc to convert to integer, Assert on the integer value
  23. Anders Melander

    GoogleMaps Policy changes in EU

    As far as I can tell they've been forced to replace their proprietary APIs with standard APIs (in order to avoid vendor lock-in) and to allow competing third party applications access to their map data. Did I understand that right? It seems Google has few friends in the map business; They aren't allowed to link to Google Maps from their Google search results - or even from the search page (which is pretty stupid and doesn't do the users any good), while the same restrictions doesn't apply to Bing. Could it be that Bing map data is provided by Tom-Tom?
  24. Anders Melander

    Poor mans HA

    Alright then. So you are going to violate the license and don't want that aspect discussed. That's between you, Microsoft, and whatever unfortunate user/client, if any, this involves but maybe you shouldn't ask us to help you do it.
  25. Anders Melander

    Poor mans HA

    You mean you are "installing the software on a device for use only by remote users"?
×