Jump to content

Mike Torrettinni

Members
  • Content Count

    239
  • Joined

  • Last visited

Community Reputation

18 Good

Recent Profile Visitors

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

  1. Mike Torrettinni

    TArray vs TList with VirtualStringTree

    5 months later I had to come back to this to understand how to use direct access to record in TList<T>. Thanks again!
  2. Mike Torrettinni

    Rules for changing cursor to HourGlass and back

    I don't have experience with interfaces, but does this actually mean what it says: you just call SetTempCursor that creates Interface and when LongRun procedure is done, it will destroy interface automatically and re-set cursor? No need for local variable, no need for Interface=nil or something similar at the end of LongRun procedure that will trigger Destroy method?
  3. Mike Torrettinni

    Rules for changing cursor to HourGlass and back

    Wow, some complex implementation of cursor... when I changed to my simple 2 methods, I thought it is overkill 🙂 I'm not used to using try in my control handlers, usually 1 or 2 calls to methods and ShowMessage when needed. But it makes sense, of course using it for this case.
  4. Mike Torrettinni

    Rules for changing cursor to HourGlass and back

    OK, good questions... not sure how to answer, yet.
  5. Mike Torrettinni

    Rules for changing cursor to HourGlass and back

    Interesting, although I only change cursor to HourGlass and back. That Try.. finally looks odd, being used just for the cursor.
  6. My projects sometimes work with large files, read, parse, write, export to csv, process... sometimes action can take a few seconds, so I like to change the cursor to crHourGlass at the beginning and then back to crDefault. While refactoring, I had occasions when I created common methods that had the change of cursor while processing. The problem is when I use button to call this method, and I already change cursor in buttons' OnClick. So, a mess. Now I have a rule only to change cursor in control handlers, not in any methods, anymore. This is working good, so far. I have 2 methods that I use instead of remembering exact syntax: procedure SetCursorBegin(Cursor: TCursor = crHourGlass); begin Screen.Cursor := Cursor; end; procedure SetCursorEnd; begin Screen.Cursor := crDefault; end; I only develop for Windows. I was just wondering if anybody has different experience and has any good tips on how to deal with cursor changing, or maybe sees a ticking time bomb in my approach to this. Thank you!
  7. Mike Torrettinni

    Recommendations on visual design

    Thanks, will look into it!
  8. Mike Torrettinni

    Recommendations on visual design

    When it comes to unique design requests, inquiries, I never had much luck with the official support - sometimes I wish I wouldn't care about the UI at all, and just have all default Delphi controls + VirtualTreeview. So, maybe someone has gone through the steps of discovering hidden gems in source code of those controls, to create similar look. Any pointers would be welcome!
  9. I'm designing new feature that will have a lot of data on the screen. So, I'm looking at design like Visual Studio Code IDE or similar and here I have example of Jetbrains Rider IDE, or similar for Chrome/Firefox developer tools. And it has a lot of toolbars, side bars, navigations, page controls, tabs... and everything looks good, is smooth, docking just works, no flickers even when a lot of information is on the screen. I highlighted some of the controls they have and they just work together, each can open a new set of information, new page control... and this is simple example. If anybody had done anything similar with so many controls on the same screen, that they fit together well, is smooth, any recommendations on such controls would be much appreciated. I have TMS and DevExpress controls, and access to others, if needed. Thank you!
  10. Mike Torrettinni

    Should I keep class alive (global) or not?

    I see, it makes sense.
  11. Mike Torrettinni

    Good practices with nested methods

    Aha, yes, I see what you mean. Yes, the scope is whole unit then. It's annoying when I create new class and I need to set Types above the class - these definitions immediately become global types - adding complexity to the code completion and error insight mess.
  12. Mike Torrettinni

    Good practices with nested methods

    I think I prefer implementation section vs class private section because of Type definitions... they fit into implementation section much neater than in class private section - it's the visual/alignment thing.
  13. Mike Torrettinni

    Should I keep class alive (global) or not?

    Don't you need more info than just simple boolean variable? Like: - new version number - change log - maybe that new version is available but maintenance has expired for this customer - download link or link for change log
  14. Mike Torrettinni

    Good practices with nested methods

    Yes, I was using this approach, but it got messy when I needed J var in both scopes, so as long as I define all iteration vars after all nested methods, all is good.
  15. I often use nested methods, mostly when a method needs 'helper' methods that are only applicable to it's logic. Here is how I usually setup my nested methods: procedure MainMethod(aParam: integer); // definitions can be accessed also from nested methods type TLocalUsed1 = record Field1: integer; end; var vArray: TArray<TLocalUsed1>; // nested methods procedure LocalMethod_WorkOnArray; var i: integer; begin for i := Low(vArray) to High(vArray) do // work on array end; function GetDataFromArray: integer; var i: integer; ab: TLocalUsed1; begin for i := Low(vArray) to High(vArray) do // work on array end; // definitions only accessible from main method type TLocalUsed2 = record Field1: integer; end; var i: integer; ab: TLocalUsed2; begin // use local vars and nested methods //... end; I used to have var i defined on top of all nested methods and I had issues with using i in main and nested methods, until I figured out the difference in scope of definitions. This works for me, but I was just thinking if there are any tips and tricks that can be used with nested methods, or some unique ways that you figure out how to use nested methods. Any feedback on using (or not using) nested methods is appreciated! Thanks!
×