Menu ▾ ▴

#75 IDE Expert to copy selected components to the clipboard, along with pinned events and their methods

None
closed-fixed
nobody
None
5
12 hours ago
2019-10-17
No

I can see that several people have been looking for something like this on the internet and no tool gives such a possibility.
The point is that with a component selected, e.g. TButton, I would like to have in the clipboard both the component itself and all onClick events and their code. Then I would like to be able to paste them into another form. Of course, the pasted code would not work 100%. But it's about facilitating UI redevelopment.
This would facilitate the reconstruction of UI.

Discussion

  • Thomas Mueller

    Thomas Mueller - 2019-10-19

    I think this would require a custom clipboard format that contains separate sections for

    1. the component definition
    2. the event handlers
      On the paste side, this format must be split and the component definition inserted into the form the event handlers into the source code. This might be quite difficult.
     
  • Thomas Mueller

    Thomas Mueller - 12 hours ago

    Implemented in revisions #5921 and #5925 as two new experts in the Form Designer category, also in the context menu of the form designer:

    • Copy with Event Handlers copies the selected components like the IDE's Copy and adds the code of the event handlers they and their child components are linked to, as it is in the editor, unsaved changes included.
    • Paste with Event Handlers pastes like the IDE's Paste, which drops all event links when pasting into another form, and links the events again. Handlers the target form lacks are created with the copied code. Handlers it already has are linked as they are, and those whose code differs from the copied one are listed afterwards.

    After a plain IDE Copy, Paste with Event Handlers still links the events, creating empty handlers where the form has none.

     
  • Thomas Mueller

    Thomas Mueller - 3 hours ago

    The Clipboard History now keeps the event handler code that Copy with Event Handlers puts on the clipboard (revision #5931). An entry shows the number of event handlers in a column of its own and their code below the text in the preview, and copying the entry back puts the code on the clipboard again, so Paste with Event Handlers also works with an entry from the history.

     

Log in to post a comment.