Rubberduck: Using Rename identifier from object view selects parent frame instead of control

Created on 6 Jun 2018  路  2Comments  路  Source: rubberduck-vba/Rubberduck

REPRODUCTION:

  1. In a UserForm there is a Frame
  2. In that Frame there is a TextBox
  3. Right-Click the TextBox and select "RubberDuck > Rename"

You will see a dialog to rename the Frame and not the TextBox.

HYPOTHESIS:
When selecting control items the parent frame appears to be selected in the GUI at all times.
It is not possible to select a control child of a frame without the parent frame also being selected.

SOLUTION BASED ON THAT HYPOTHESIS:
If SelectedItems.Count > 1 Then
' Oh noes
End If

OPTIONS:
We could For Each through the selection
OR
ask the user to clarify which object should be renamed
OR
Display a rename dialog with all of the selected items on different lines with If no change then ignore.

bug feature-refactorings has-workaround refactoring-rename user-interface

Most helpful comment

For info with this issue, renaming the relevant object from the the event handler code, works correctly - it pops a message to ask if you want to rename the control instead of the event handler - so this can be used as a work around for the time being.

All 2 comments

I like the "pop a dialog and prompt to confirm" option, but only if it's not possible to determine the specific deepest non-parent control that's selected. I do think we should be able to recursively locate the actual selected control though.

For info with this issue, renaming the relevant object from the the event handler code, works correctly - it pops a message to ask if you want to rename the control instead of the event handler - so this can be used as a work around for the time being.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eteichm picture eteichm  路  4Comments

bclothier picture bclothier  路  3Comments

Gener4tor picture Gener4tor  路  3Comments

philippetev picture philippetev  路  3Comments

retailcoder picture retailcoder  路  3Comments