TheDelphiCoder 2 Posted June 9, 2022 Hi, is there an option to convert a local variable of a method to a field of the current class or record? I can only find AddField, and the context menu option "Conversion -> convert to Field" is disabled... Share this post Link to post
Uwe Raabe 2064 Posted June 9, 2022 AFAIK, that is not implemented. Local variables are no items in the explorer tree (like fields, methods or properties) and the Convert to Field action can handle only explorer items. This means that implementing such a functionality is not trivial. A workaround would be place the cursor at the first assignment of the local variable and use <Strg>-<Alt>-F to add a new field. In most cases the type is automatically detected. Either before or after that just delete the local variable manually. Share this post Link to post