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

Untangle creation and deletion methods #995

Open
corranwebster opened this issue Jul 16, 2021 · 0 comments
Open

Untangle creation and deletion methods #995

corranwebster opened this issue Jul 16, 2021 · 0 comments

Comments

@corranwebster
Copy link
Contributor

corranwebster commented Jul 16, 2021

In more recent Widget classes we are finding a pattern that works for creation of:

  • the _create method calls _create_control which creates the main toolkit control, possibly with some minimal configuration and setting of options that always apply and sets the result into the control attribute.
  • in some cases there are method calls to create associated widgets or sub-widgets for complex widgets
  • the _create method calls _initialize_control to configure the initial state of control properties that may vary
  • the _create method calls _add_event_listeners which connects traits observers which need ui dispatch, and binds callbacks for toolkit events (and signals, etc. in Qt).

Some of these should call super() to ensure that creation methods from the superclass get done correctly.

There is a corresponding (although usually simpler) stack of things to be done at widget destruction time.

Many older, particularly Wx, widgets don't follow this pattern. Some effort should be put into standardizing things to facilitate subclassing, etc.

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

No branches or pull requests

1 participant