Mike Torrettinni 198 Posted July 10, 2019 Can GExperts reformat this: procedure VirtualStringTree1GetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: string); into single line: procedure VirtualStringTree1GetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: string); In definition and/or in implementation. I think single line is much more readable, when it's a long unit with lots of methods. Share this post Link to post
Bill Meyer 337 Posted July 10, 2019 (edited) 5 minutes ago, Mike Torrettinni said: Can GExperts reformat this: procedure VirtualStringTree1GetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: string); If you use MMX, with right margin sent to some high value, then edit the routine: Ctrl-E, Enter, the result will be to put the signature all on one line. It will do so in both the interface and implementation sections, in one action. Edited July 10, 2019 by Bill Meyer 2 Share this post Link to post
Mike Torrettinni 198 Posted July 10, 2019 5 minutes ago, Bill Meyer said: If you use MMX, with right margin sent to some high value, then edit the routine: Ctrl-E, Enter, the result will be to put the signature all on one line. It will do so in both the interface and implementation sections, in one action. I do use MMX, well just started. I set right margin high (500). I tried, but I can reproduce the behavior you are describing with CTRL+E, Enter... where exactly should my cursor be to press CTRL+E and then Enter, in code, in MMX? Share this post Link to post
Bill Meyer 337 Posted July 10, 2019 (edited) 21 minutes ago, Mike Torrettinni said: I do use MMX, well just started. I set right margin high (500). I tried, but I can reproduce the behavior you are describing with CTRL+E, Enter... where exactly should my cursor be to press CTRL+E and then Enter, in code, in MMX? Should only need to be in the scope, in other words, the cursor in the signature, or anywhere in the method you wish to affect. (Sorry, I cropped that image a bit. It is the Pascal Editing page.) Edited July 10, 2019 by Bill Meyer Share this post Link to post
Mike Torrettinni 198 Posted July 10, 2019 9 minutes ago, Bill Meyer said: Should only need to be in the scope, in other words, the cursor in the signature, or anywhere in the method you wish to affect. Wrap margin is set to 500. but still it doesn't work - or, I don't know how to use it properly. No matter where my focus is, CTRL+E does not do anything. I even tried selecting the method and CTRL+E and nothing. Share this post Link to post
Bill Meyer 337 Posted July 10, 2019 1 minute ago, Mike Torrettinni said: Wrap margin is set to 500. but still it doesn't work - or, I don't know how to use it properly. No matter where my focus is, CTRL+E does not do anything. I even tried selecting the method and CTRL+E and nothing. Which version are you in? I have seen modules in D2007 IDE which I am unable to Ctrl-E edit. Try creating a small project with a routine which needs to be un-wrapped. If it works, then there is something in the project you are testing now which is giving the IDE fits. Share this post Link to post
Mike Torrettinni 198 Posted July 10, 2019 (edited) Aha, it works on new methods - adding new method will be a 1 line definition, when double clicking method in Object inspector. It doesn't convert old/existing methods. I have D 10.2.3 and MMX 14.0.5 build 2276 Edited July 10, 2019 by Mike Torrettinni more info Share this post Link to post
Bill Meyer 337 Posted July 10, 2019 (edited) 48 minutes ago, Mike Torrettinni said: Aha, it works on new methods - adding new method will be a 1 line definition, when double clicking method in Object inspector. It doesn't convert old/existing methods. I have D 10.2.3 and MMX 14.0.5 build 2276 Actually, it does, or did, convert existing. Just did it in D2007 and in XE7. Will try it later in 10.2.3, to see whether it fails. Obviously, I am not using v14 in those older IDEs. Update: Works as I described in Delphi 10.3.1 with MMX 14.0.5. I do not have 10.2.3 available here at the moment. Edited July 10, 2019 by Bill Meyer Share this post Link to post
Uwe Raabe 2057 Posted July 10, 2019 33 minutes ago, Bill Meyer said: Actually, it does, or did, convert existing. It does. When the cursor is somewhere in that method (declaration or implementation) pressing <Ctrl>-E followed by <Enter> to open, close and accept that dialog will unwrap these lines. Share this post Link to post
Bill Meyer 337 Posted July 10, 2019 Just now, Uwe Raabe said: It does. When the cursor is somewhere in that method (declaration or implementation) pressing <Ctrl>-E followed by <Enter> to open, close and accept that dialog will unwrap these lines. Confirmed here, though I did also see Ctrl-E fail to open the edit dialog in D2007 today. I am assuming it is contextual, as I do routinely use it in D2007. Share this post Link to post
Mike Torrettinni 198 Posted July 10, 2019 It works! I closed and re-opened Delphi, now CTRL+E shows Edit procedure dialog, before it didn't. And just pressing Enter, it reformats definition for that method. Great, thanks! Any way to reformat the whole existing unit at once? Share this post Link to post
Bill Meyer 337 Posted July 10, 2019 (edited) 53 minutes ago, Mike Torrettinni said: It works! I closed and re-opened Delphi, now CTRL+E shows Edit procedure dialog, before it didn't. And just pressing Enter, it reformats definition for that method. Great, thanks! Any way to reformat the whole existing unit at once? Sort the class(es). That will apply the cleaning to all members (I think!). But look first at the sorting options. If you are using source control, think carefully before you leap. 😉 Edited July 10, 2019 by Bill Meyer Share this post Link to post
Uwe Raabe 2057 Posted July 10, 2019 23 minutes ago, Bill Meyer said: Sort the class(es). AFAIK, that won't work. As an alternative you can use the built in Delphi code format feature with <Ctrl>-D. 1 1 Share this post Link to post
Mike Torrettinni 198 Posted July 10, 2019 26 minutes ago, Uwe Raabe said: AFAIK, that won't work. As an alternative you can use the built in Delphi code format feature with <Ctrl>-D. Thanks, I think I have enough to work with, for now. Share this post Link to post
Bill Meyer 337 Posted July 11, 2019 4 hours ago, Uwe Raabe said: AFAIK, that won't work. As an alternative you can use the built in Delphi code format feature with <Ctrl>-D. Oops, my bad! I was doing other things, and unable to confirm before I write that. And then began to think I was wrong. Share this post Link to post
dummzeuch 1505 Posted July 11, 2019 10 hours ago, Mike Torrettinni said: Can GExperts reformat this: procedure VirtualStringTree1GetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: string); into single line: procedure VirtualStringTree1GetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: string); In definition and/or in implementation. I think single line is much more readable, when it's a long unit with lots of methods. No, GExperts can't (because nobody answered that question yet). 2 Share this post Link to post
Uwe Raabe 2057 Posted July 11, 2019 8 hours ago, Bill Meyer said: Sort the class(es). I filed a feature request for a new sort option to normalize the code while sorting. 3 Share this post Link to post
Bill Meyer 337 Posted July 11, 2019 7 hours ago, Uwe Raabe said: I filed a feature request for a new sort option to normalize the code while sorting. A further thought: Perhaps a command to normalize without sorting class(es)? Resorting the classes would make for some source control issues in future. The normalization of signatures, though it would obviously affect source control, would be relatively minor, by comparison. 1 Share this post Link to post