Jump to content

Mike Torrettinni

Members
  • Content Count

    700
  • Joined

  • Last visited

  • Days Won

    1

Mike Torrettinni last won the day on July 17

Mike Torrettinni had the most liked content!

Community Reputation

71 Excellent

Technical Information

  • Delphi-Version
    Delphi 10.2 Tokyo

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Mike Torrettinni

    How secure is your WordPress installation?

    The description scares me a little bit... almost feels like it sends an assassin to anybody trying to access my website... 🙂 "Our Threat Defense Feed arms Wordfence with the newest firewall rules, malware signatures and malicious IP addresses it needs to keep your website safe. Rounded out by a suite of additional features, Wordfence is the most comprehensive security option available."
  2. Mike Torrettinni

    Common callback functions, or not?

    Correct, well I probably didn't phrase my statement correctly, as I'm not too experienced with anonymous methods. And as @Rollo62 has shown, a few posts prior, there's a lot you can do with anonymous methods.
  3. Mike Torrettinni

    Common callback functions, or not?

    Thanks, good to know.
  4. Mike Torrettinni

    Common callback functions, or not?

    Well, not sure how to answer this, because my understanding is event=callback.
  5. Mike Torrettinni

    Common callback functions, or not?

    I very rarely use anonymous functions, so I assume the limitation (compared to callback) is that it can only be used within already executed code. You can't just assign it to something, because it's anonymous (not defined anywhere). Right?
  6. Mike Torrettinni

    Common callback functions, or not?

    Thanks! I was thinking about this why I made such a big deal about this, the event vs callback, function vs procedure... It's simple, I can use what I need in that situation, as they both have valid use cases.
  7. Mike Torrettinni

    How secure is your WordPress installation?

    I'm not a WP expert, so it's nice to see a blog where the the problem is explained and solution is simple: download plugin+upload+activate. Simple, thanks!
  8. Mike Torrettinni

    Common callback functions, or not?

    Yes, arguments need so to be passed in procedure and function call. That is the same.
  9. Mike Torrettinni

    Common callback functions, or not?

    Oh, of course! I didn't really think about it in that way. It makes sense: assigned vs called, thanks! EDIT: Hm, well thinking about it... function is also assigned and you can use if Assigned(FOnGetSearchTextLine) then FOnGetSearchTextLine; Right? Maybe I'm proving your point, but I'm still little unsure about procedure vs function event.
  10. Mike Torrettinni

    Common callback functions, or not?

    Oh, Ok, I wasn't sure what you are referring to. But you want the purple icon, right? OK, I just 'thanked you'.
  11. Mike Torrettinni

    Common callback functions, or not?

    Where is the "thanks" button?
  12. Mike Torrettinni

    Common callback functions, or not?

    Aha, thanks. Looking through some examples, most of them use TEvent = procedure() of object, I assume TEvent = function(): resulttype of object; is not the normal way, right? Am I just lucky it works for me?
  13. Mike Torrettinni

    Common callback functions, or not?

    Maybe I over-designed it, but this is what I have: MainForm -FrameA -FrameB -FrameC -Frame..N CommonSearchForm each Frame has VirtualTreeview control to display data. CommonSearchForm has Search, SearchNext, SearchPrev, keyboard actions (Ctrl+F/N)... and these actions also control (move next/prev) searched lines in Frame's VirtualTreeView. So, each Frame creates it's own instance of CommonSearchForm and assigns local methods to events so that GetSearchTextLine gets different text from each Frame's local method that returns text line to be searched. Are you suggesting I create all Search features in each Frame?
  14. Mike Torrettinni

    Common callback functions, or not?

    Perhaps I'm using the callback term incorrectly... and these are events? I use these to assign local Frame method to a general Search form, like this: // definition callback/event TGetSearchTextLine = function (aDataIdx: integer) string of object; // method in Frame that returns data line to be searched within function TFrameA.PrepareDataLineForSearch(aDataIdx: integer): string; begin Result := fData[aDataIdx].ProjectName + fData[aDataIdx].ProjectDescription; end; // create Search form and assign/connect methods (callbacks/events) procedure TFrameA.StartSearch; begin ...// create fSearchForm fSearchForm.GetSearchTextLine := PrepareDataLineForSearch; end; // in Search Form I have public variable of type of callback/event public var GetSearchTextLine: TGetSearchTextLine; // and it gets called when Search is executed in Search form procedure TSearchForm.Search; begin fDataLineToSearch := GetSearchTextLine; SearchForText(fDataLineToSearch); end; When used like this, am I using a callback or event? In this case I'm not using Form/Controls methods (like OnClick and others). Do I still need Sender: Object? Is the reason for this so that I know who called the method?
  15. Since I started using Frames, I'm setting up a lot of callback functions. I noticed a lot of them are getting duplicated, especially the simple ones, with simple type parameters. Of course all callbacks are defined and used within the needed scope, not global. Should I create a few common callback functions and have them defined in global scope, like: TIntFunctionWithIntParam = function(aValue: integer): integer of object; TStringFunctionWithIntParam = function(aValue: integer): string of object; TIntFunctionWithStringParam = function(const aStr: string): integer of object; TStringFunctionWithStringParam = function(const aStr: string): string of object; TIntFunction = function: integer of object; TStringFunction = function: string of object; these function can then be used in any Frame. Of course functions that are specific to each Frame, would still be defined in each Frame. Or is this the wrong approach and all callbacks should be defined exactly for the defined purpose, and within defined scope? Any advice is appreciated!
×