T O P I C R E V I E W |
mzh |
Posted - Jul 30 2020 : 09:25:55 AM Hello,
it would be great to get some kind of auto suggestion and completion for virtual methods in a derived C++ class declaration (and maybe an auto-create-implementation feature) when typing "override" like in Visual Studios C# Editor.
Thank you, Markus
|
7 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Aug 03 2020 : 08:03:39 AM A basic version of this idea came up a while ago, but we have a much better idea of how it might work, so I have updated the feature request:
case=85241
for now, if it helps, have you tried Alt-Shift-G in the white space inside the derived class? Assuming you have "Show symbols from base classes" turned On, you can filter this dialog to search for the virtual method name you want, and use Ctrl-C to copy the method name and then paste it into the class declaration. Alt-G on the function name will then take you to the declaration, allowing you to copy it and then jump back to where you where, so you can paste it in, in place of just the function name.
Not the same, but it should help to simplify doing this manually. |
mzh |
Posted - Aug 03 2020 : 03:55:53 AM Hi feline,
quote: How would a command to trigger a version of the current Implement Methods dialog, with keyboard focus in the filter field, work instead? I am thinking of this working like a listbox, in that you search for the single item you want and accept it. But using the dialog would allow you to search / filter the tree, making it much clearer which base class any given function came from.
that sounds like a good idea instead!
-Markus |
feline |
Posted - Aug 01 2020 : 09:18:41 AM I see more clearly now. Thinking about this a bit more, some people don't use / don't want the override keyword, which is why there is a setting for it:
VA Options -> Code Generation -> Use override keyword for generated C++ methods
so the override keyword is not automatically a reliable indicator that you want this listbox.
How would a command to trigger a version of the current Implement Methods dialog, with keyboard focus in the filter field, work instead? I am thinking of this working like a listbox, in that you search for the single item you want and accept it. But using the dialog would allow you to search / filter the tree, making it much clearer which base class any given function came from.
Then accept the dialog with Enter, and the current function gets declared and implemented in your current location in the header file. |
mzh |
Posted - Jul 31 2020 : 12:42:00 PM Hi feline,
yes I'm getting the suggestion listbox and I'm also getting the parameter suggestion which can be added by pressing TAB again.
Whats missing at the end is the return value which has to be added manually, the "override" keyword (depending on the "Code Generation"-Options of VA) and the method itself has no implementation. (I would create it with the "Create implementation" feature)
-Markus |
feline |
Posted - Jul 31 2020 : 08:29:10 AM That's fair, the dialog is obviously designed with the idea of creating several methods in one go, rather than helping you overload just a single method.
Doing some simple tests here, when I start typing a function name, with or without the overload keyword, I am getting a VA suggestion listbox that picks up the virtual methods I can override quite reliably. Are you seeing something similar?
I am wondering if you are not getting any help at all, or if you are looking for a listbox that you know is only virtual methods that have not yet been implemented, so the dialog content, but in a listbox form.
Looking at what I am seeing in C#, in a class derived from "Form", you need to wait for the tooltip to appear to tell you which base class each item is from. Not a problem if you have an idea of the method you are looking for, but less helpful for hunting down a method when you are less sure of its name.
The idea makes sense, I just want to be clear on what we want to achieve here and why |
mzh |
Posted - Jul 31 2020 : 05:44:25 AM Hello feline,
yes I'am aware of that feature. But it needs many UI interactions to implement a virtual method, usually I'm faster writing it directly than 1. navigating to the classname (which is moving to the top of a (large) class and selecting it) 2. pressing ALT+SHIFt+Q 3. finding (scrolling or typing into searchbox), 4. selecting the (single) member 5. and finally navigating to the implementation (which usually requires navigating to the bottom of a complex class and pressing ALT+G).
In the suggested feature I would remove the scrolling navigation part in class declaration. I just type "override", the first Letters of the desired member, select with arrows in the suggestionbox, press TAB, move back to the just created membername and press ALT+G to get to a created member body.
Thank you, Markus |
feline |
Posted - Jul 30 2020 : 11:29:40 AM Are you aware of the Implement Interface command:
https://support.wholetomato.com/default.asp?W165
this allows you to select which virtual functions you want to implement from the base class, and all of the selected ones will be implemented in one go for you. |
|
|