Board index » delphi » How to enable Ctrl + V (... + C, ... + Z, ... + X) on tree node?

How to enable Ctrl + V (... + C, ... + Z, ... + X) on tree node?

When I select node in TreeView control, and then click its name,
it puts itself in edit mode - its name is hilighted, so I can rename it.

While doing it, I may right click, and menu pop-ups with choices like:
Cut, Copy, Paste, Delete. Usualy I do such operations like copying and
pasting by using keys: Ctrl + C, Ctrl + V, etc. These keys combinations
doesn't work while editing node's name.

Does anybody know why, and how to enable these keys combinations?

Thank you in advance for any help

Darek.

 

Re:How to enable Ctrl + V (... + C, ... + Z, ... + X) on tree node?


In article <381A9279.820DF...@netrover.com>, da...@netrover.com says...

Quote

>When I select node in TreeView control, and then click its name,
>it puts itself in edit mode - its name is hilighted, so I can rename it.

>While doing it, I may right click, and menu pop-ups with choices like:
>Cut, Copy, Paste, Delete. Usualy I do such operations like copying and
>pasting by using keys: Ctrl + C, Ctrl + V, etc. These keys combinations
>doesn't work while editing node's name.

>Does anybody know why, and how to enable these keys combinations?

What you want works for TreeView.  However Ctrl+C is most likely being
captured on a higher level.  For example, do you have a Menu item with
edit in it with the shortcut key set to Ctrl+C.  If so, Ctrl+C will be
trapped at that level and now brought down to the control.

I don't know if keypreview will help or not.

-John_Mer...@Brown.EDU

Quote

>Thank you in advance for any help

>Darek.

Re:How to enable Ctrl + V (... + C, ... + Z, ... + X) on tree node?


Quote
Dariusz Dziewialtowski wrote:

> When I select node in TreeView control, and then click its name,
> it puts itself in edit mode - its name is hilighted, so I can rename it.

> While doing it, I may right click, and menu pop-ups with choices like:
> Cut, Copy, Paste, Delete. Usualy I do such operations like copying and
> pasting by using keys: Ctrl + C, Ctrl + V, etc. These keys combinations
> doesn't work while editing node's name.

> Does anybody know why, and how to enable these keys combinations?

> Thank you in advance for any help

> Darek.

Hmmm, I don't remember.  Have you tried capturing them in the
OnMouseDown event?

Re:How to enable Ctrl + V (... + C, ... + Z, ... + X) on tree node?


Thank you for your help.

The case was that "Ctrl+C is most likely being
captured on a higher level".

I have menu item Edit, with subitems: Cut, Copy, Paste.
The subitems have shortcuts: Ctrl + X, Ctrl + C, Ctrl + V.
When I removed these shortcuts, they work fine when editing
the TreeView's node's names!

What's little confusing for me, it's that even when I removed
these shortcuts from the menu items, they still work (menu Edit
relates to RichEdit control) - I still can do copying over the
RichEdit box, pasting etc, using these shortcuts.

Conclusion would be: don't put shortcuts on the menu in this case;
I just wanted to make life easier for my users - not everybody
knows that pressing Ctrl + C means copying etc, so I wanted to display
shortcuts on the menu as a hint, but apparently I wanted too much
(well, now I see that I can display these shortcuts on menus just as
text).

Darek

Other Threads