Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Control's SetName() #1669

Open
tomaszkax86 opened this issue May 12, 2024 · 0 comments
Open

Refactor Control's SetName() #1669

tomaszkax86 opened this issue May 12, 2024 · 0 comments

Comments

@tomaszkax86
Copy link
Contributor

Control's method, SetName(), has very confusing and error-prone behavior.

SetName() accepts two parameters; a string name and a defaulted boolean argument bTooltip that specified additional behavior related to tooltips.

If bTooltip is true, which is the default value, then name is treated as an optionally combined "name\tooltip" string. If the tooltip part exists, it is extracted and set as control's tooltip and name part is what is set as control's name. If the tooltip part is not present or bTooltip is false, name is not extracted and is set as-is but the tooltip is not updated.

GetName() only returns the name part, making copying the raw name with control2->SetName(control1->GetName()) incorrect if the name was set with bTooltip previously set false.

Control's name is used for some unintuitive things, like Window's title and Label's text. It also remains completely unused in some other controls, like Group. It should be refactored in a way that makes it sensible within the right context and not strictly depend on merged "name\tooltip" string specification.

Name property itself might be removed entirely from Control if it is found not needed for anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant