

Mike Torrettinni
Members-
Content Count
1509 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Mike Torrettinni
-
Rules for changing cursor to HourGlass and back
Mike Torrettinni replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
OK, good questions... not sure how to answer, yet. -
Rules for changing cursor to HourGlass and back
Mike Torrettinni replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
Interesting, although I only change cursor to HourGlass and back. That Try.. finally looks odd, being used just for the cursor. -
Recommendations on visual design
Mike Torrettinni posted a topic in Tips / Blogs / Tutorials / Videos
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! -
Recommendations on visual design
Mike Torrettinni replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
Thanks, will look into it! -
Recommendations on visual design
Mike Torrettinni replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
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! -
Should I keep class alive (global) or not?
Mike Torrettinni posted a topic in Algorithms, Data Structures and Class Design
Not sure how to ask this, but I'm not sure how to 'properly' use class information: do I keep class alive in memory to access data at any time (global), or create and free class on demand and save data to variables (global)? Here is example of Check for translation file update example - I have 3 units: - Main Form with Check button - Check Form - CheckForTranslation class So, from Main Form I call Check form which creates local CheckForTranslation class variable in FormShow, uses class methods to check and display information if any new translation files are available. Check Form gives me option to download file, if I want to. Now I would to keep info if new translation file is available, so I don't need to keep checking (until next project restart). So, the options I see: 1) Create CheckForTranslation in Main Form global variable and use it when needed (in Check form). This allows me to always access results from checking, and just keep all data available at any time, any where. But, is global class variable, which I try to avoid, if possible. 2) Only create CheckForTranslation in methods as needed ( and free class at the end of method) and save status in global variables so that status is always available - this option only saves a status variables (maybe 2 - gNewTranlsationFileAvailabe: boolean and gNewTranlsationFileDownloadLink: string). So, some information I will definitely need to keep around, a class or simple status variables. I'm not sure what is good approach to create such class, when to free it and how to use the information from it. Any advice would be helpful! -
Should I keep class alive (global) or not?
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
I see, it makes sense. -
Good practices with nested methods
Mike Torrettinni replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
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. -
Good practices with nested methods
Mike Torrettinni replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
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. -
Should I keep class alive (global) or not?
Mike Torrettinni replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
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 -
Good practices with nested methods
Mike Torrettinni replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
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. -
Running the IDE in a VM on Mac Book Pro?
Mike Torrettinni replied to PeterPanettone's topic in General Help
This is interesting, I've never heard this argument, and I think you are on to something. I never thought that developers are reselling their PCs/MACs - except for gaming community. I also never heard that software developers buy refurbished computers. I always buy new computer when it's time, every few years (2-6, based on budget, needs, etc...), and any other software developer I know. The old one is usually given away. So, if there is a big community of developers that have same experience as you, I'm completely oblivious to it 🙂 -
Using Delphi in Virtual machine for a month
Mike Torrettinni replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
Yes, 3 physical monitors - I have these options when in Full screen mode: Same performance in any layout. -
Using Delphi in Virtual machine for a month
Mike Torrettinni replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
I did, and it seems a bit smoother experience with Windows overall ( I assume due to RDP Experience setting: Detect connection quality automatically), but no difference in Delphi experience. I didn't know you can actually RDP to local VM, quite interesting! -
Using Delphi in Virtual machine for a month
Mike Torrettinni replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
I can extend my VM to 3 monitors and no change in performance, still annoying little delays, but no worse than on 1 monitor. -
Using Delphi in Virtual machine for a month
Mike Torrettinni replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
Thank you, great tips! Will try some and see how it goes. Oh, yes, thank you for pointing it out: I don't use any AV in VM, and I excluded the VM file disk folder from anti malware sw and Defender monitoring. Same for Shared folders, excluded from monitoring. -
I'm trying to resolve unit dependencies, cycling. I have a global unit where in some cases I need to reference Form Control - so I need the Form units used in uses: TranslatorUnit - custom translation unit that translates all forms, controls, message... I run TranslateProject method that has this: FormsList[0] := MainForm; // <- REFERENCE TO FORM FormsList[1] := CustomDialog; // <- REFERENCE TO FORM ... for i:= 0 to High(FormsList) do begin if FormsList[i] = MainForm then // <- REFERENCE TO MAINFORM begin for j := 0 to FormsList[i].ComponentCount - 1 do if FormsList[i].Components[j] = CustomButton then // <- REFERENCE TO CONTROL ... end else // common translation of Form and Controls end; I know I can loop Forms in Application and refer them by 'MainForm' name and same for Controls, I can refer to them by name like FindComponent('CustomButton'), but I don't like it since it doesn't validate names, like compiler does when I refer to them as objects. Is there any way I can refer to Forms and Form Controls without using the units in uses, but will still give me some way to verify I don't misspell the names or when I change a name that translation will still work as needed? Any suggestion how to solve this?
-
Refer to Form Control without using the Form unit?
Mike Torrettinni replied to Mike Torrettinni's topic in VCL
I know this is one option, but then it's not all in one Translator unit. But good suggestion, thanks! -
Refer to Form Control without using the Form unit?
Mike Torrettinni replied to Mike Torrettinni's topic in VCL
No, just forms and only a few customized controls - where translation is customized. I don't have many situations like these. The ones where I do, I specifically control the creation of such forms and also translation at that point. -
How to reliably know if there is data selected in TVirtualStringTree
Mike Torrettinni posted a topic in VCL
I hope someone can help me clear up this part of my refactoring process: I have many VSTs (TVirtualStringTree) and many handlers OnClick, OnMouseup, OnPaintText and others. Usually shows detail info or executes actions based on selected line in this VST. One of the areas I want to refactor/clean up is the beginning of these methods, where I make sure there is actual selected data in VST, and I have many different implementations that are any one of these statements or combination of them. The purpose of all these conditions is to stop processing methods if there is no data selected - empty VST is clicked on; uses clicks on edge margins which don't actually select line;.. or to prevent any anomalies where line data is not there: // in some methods I only have this if TVirtualStringTree(Sender).FocusedNode = nil then Exit; // and in others I have any of these or combination of them: TVirtualStringTree(Sender).FocusedNode = nil not TVirtualStringTree(Sender).Visible TVirtualStringTree(Sender).GetFirst <> nil Sender = nil TVirtualStringTree(Sender) = nil if any of these are True = Exit; And after this I usually have this: Data := TVirtualStringTree(Sender).GetNodeData(TVirtualStringTree(Sender).FocusedNode); if Data = nil then Exit; in some cases I have this: Node := TBaseVirtualTree(Sender).GetFirstSelected; if Node = nil then Exit; Is there a better, simpler way than having all these conditions? Thank you! -
How to reliably know if there is data selected in TVirtualStringTree
Mike Torrettinni replied to Mike Torrettinni's topic in VCL
These are various checks throughout the methods and they go back many years, when I might have called the method without Sender, but you are right is not valid anymore. Thanks! -
How to reliably know if there is data selected in TVirtualStringTree
Mike Torrettinni replied to Mike Torrettinni's topic in VCL
Thanks, I do have this, not at the beginning, but later on in some cases for clicked Column #. Will try to put it as the first thing. -
Generic Command Line Parser for Delphi 10.3.x
Mike Torrettinni replied to Lars Fosdal's topic in I made this
I have my own parsing solution, works exactly as I need it to, but it's not as robust as I would like it to be. I will try this one as soon as I have some time! -
Refer to Form Control without using the Form unit?
Mike Torrettinni replied to Mike Torrettinni's topic in VCL
Good option, 'Self.QualifiedClassName' shows 'Unit1.TForm1' - should be unique. -
Refer to Form Control without using the Form unit?
Mike Torrettinni replied to Mike Torrettinni's topic in VCL
Thanks @Lars Fosdal, interesting solution. That works because you only deal with a few of different ClassNames, right? If you needed 'navigation' through multiple Forms, that have same ClassName, this would be more tricky... or not, you could then go by another Form identificator... OK.