Added a Tool for use in the Delphi IDE for converting field definitions into properties as a simple alternative to Class Completion. Can rebuild from source using Delphi 5 through D10Seattle. #Delphi10Seattle #opensource #MITLicense I use this tool all the time and it's a time saver. (I also use Class Completion but mainly just for methods.)

Added a Tool for use in the Delphi IDE for converting field definitions into properties as a simple alternative to Class Completion. Can rebuild from source using Delphi 5 through D10Seattle. #Delphi10Seattle #opensource #MITLicense I use this tool all the time and it's a time saver. (I also use Class Completion but mainly just for methods.)
https://github.com/darianmiller/dxIDETool_FieldsToProperties
ModelMaker Code Explorer has had this (and many other) refactoring for years in a more context sensitive way. Supports the same rang of Delphi versions.
ReplyDeleteI have been using a keyboard macro for this for years. But nice idea anyway.
ReplyDeleteWhy I have to use the clipboard? Cant my selected Text be used?
ReplyDeleteYou can already use delphi templates ( CTRL + J, "propf", ENTER, "name", TAB, "type", TAB ) to create a new property with fields.
ReplyDeleteFabian S. Biehn hence my comment.
ReplyDeleteAnother vote for ModelMaker Code Explorer!
ReplyDeleteOn the readme page of the repo, I already have stated "Likely the best tool which offers this functionality (as just one of its many features) is ModelMaker Code Explorer" However, if you don't want to spend the money, or if it's too overkill, then this simple tool works well for one simple task. There are other options, including class completion/templates. I just find the templates awkward to use.
ReplyDeleteFabian S. Biehn it's not based on ToolsAPI, it's just a simple exe that you can add to the tools menu. A real IDE integration would be better if someone would like to do it that way. This is something you can easily use, it won't cause any issues with your IDE, and it works with any version of Delphi with a Tools menu - (at least since Delphi 3.)
ReplyDeleteNote - less than two months ago I purchased a 10-user license for MM Code Explorer for all the devs here, but I still use this little tool as I haven't fully embraced MM into the process yet.
ReplyDeleteOn Delphi 7 tool give me an error 2.
ReplyDeleteSingle step the procedure it work.
Weird One source it works another give me an error
ReplyDeleteshlomo abuisak DOS Error 2 is "File not found" so I assume the "Program" configuration of the tool is not the correct full path to the executable.
ReplyDeleteDarian Miller Weird Onnnnnnne source it works annnnnnother give me an error has nothing to do with configuration since it works on some source !!!!
ReplyDeleteI've used this simple Copy/Paste tool for a long time before posting it here. ToolsAPI was mentioned in comments so it got me wondering how custom keybindings work...so, there's now a new package in GitHub with identical functionality as this tool, but it's built on ToolsAPI which allows you to select the text in the editor and hit Alt-P, Alt-F to generate Property definitions from Field definitions. With the old Tool, you copied and then selected where to paste the results so placement of the output wasn't an issue. For this new package, I take a stab at placing the new property definitions at the end of the class or before other property definitions (No source parser.) It's faster than the old way and less keystrokes, so it might help me break a 10+ year habit...
ReplyDeletehttps://github.com/darianmiller/dxIDEPackage_CustomKeyBindings