Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 10/09/23 in all areas

  1. Dalija Prasnikar

    Using inline variables inside loops

    This is expected behavior. There is only single address behind inline variable declaration, not multiple ones. Also captured variables are not stored in the stack, but on a heap. Anonymous methods are basically defined as interfaces with a single method - Invoke - implemented by a hidden reference counted class, and captured variables are stored as fields of that class. When an anonymous method is accessed, an instance of that class is constructed behind the scenes, and it is kept alive through reference counting for as long as is required by the anonymous method it wraps. Because you have a loop you will only see the last value in that captured LKey variable because there is only one anonymous method instance created which you are adding to the list again and again with only one captured LKey field.
  2. Renate Schaaf

    Bitmaps2Video for Windows Media Foundation

    Do you mean to Jpeg or Png? A video-format would not make any sense for a single image. NVidea-chips can apparently do that, but I don't know of any Windows-API which supports that. If you want to encode to Png or Jpeg a bit faster than with TPngImage or TJpegImage use a TWicImage. Look at this nice post on Stackoveflow for a way to set the compression quality for Jpeg using TWicImage: https://stackoverflow.com/questions/42225924/twicimage-how-to-set-jpeg-compression-quality
  3. Renate Schaaf

    Bitmaps2Video for Windows Media Foundation

    I'll see what I can do. Stream might be tricky, I would need to learn more about this.
  4. David Schwartz

    Anon methods passed as event handlers?

    FWIW, I found this on SO: This is not possible. You have to make the event handler be a method type rather than an anonymous method. You'll need to wrap your anonymous method in a method. Either an instance method (of a record or a class), or a class method. For instance: https://stackoverflow.com/questions/8025481/vcl-events-with-anonymous-methods-what-do-you-think-about-this-implementation https://stackoverflow.com/questions/11491593/tproctobject-to-tnotifyevent
  5. David Schwartz

    Anon methods passed as event handlers?

    So can you add the Self param explicitly? Or is there just no way to do it? I'd think that this might work, but it doesn't. FScript.AfterExecute := procedure (Sender: TObject; SQL: string) of object begin // end;
  6. Uwe Raabe

    Anon methods passed as event handlers?

    An event is always declared as procedure(...) of object, which carry an invisible self parameter. This allows object methods, but excludes global procedure(...) and reference to procedure(...) declarations as well as anonymous methods, because they all lack that self parameter.
×