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

Add PagerControl #3327

Merged

Conversation

marcelwgn
Copy link
Collaborator

@marcelwgn marcelwgn commented Sep 24, 2020

Description

This PR removes the prototype Pager and adds the new C++ PagerControl. The specification for this control can be found here.

Motivation and Context

How Has This Been Tested?

New tests and a lot of experimenting.

Screenshots (if appropriate):

Light theme, normal styles:

image

image

image

image

image

image

image

image

For fun, customization through available API:

image

High contrast:
image

Open questions

  • If you set the FirstPageButton to Visible, but the PreviousPageButton to HiddenOnEdge should the PreviousPageButton still take up space to prevent the control jumping around?

  • Current implementation of ComboBox infinity mode is to render 100 items, or if the last NumberOfPages was greater than 100, to stay at that. What would the best way for "infinity mode combobox" be?

  • Is "infinity mode" a good name?

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Sep 24, 2020
@marcelwgn marcelwgn changed the title Adding PagerControl Add PagerControl Sep 24, 2020
m_lastPageButtonClickRevoker = lastPageButton.Click(winrt::auto_revoke, { this, &PagerControl::LastButtonClicked });
}

if (const auto comboBox = GetTemplateChildT<winrt::ComboBox>(c_comboBoxName, *this))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetTemplateChildT [](start = 30, length = 17)

With this method, if a new template is applied after the initial template, which removed this named template part, we would keep the pointer to the old template's part which would likely crash. I would use a lambda here to limit the scope of the local variable while assigning the value of get template child to m_combobox event if the return value is null.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good point, updated that section now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method you chose to do this requires an extra call to m_combobox.get(), which isn't free, which is why i suggested a lambda (since it also scope limits. However this does function.


In reply to: 494660076 [](ancestors = 494660076)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using lamdas now for the combobox and numberbox.

@StephenLPeters
Copy link
Contributor

@chingucoding forgot to at you for my last comment as well.

@marcelwgn
Copy link
Collaborator Author

No idea why I added that, since it doesn't make a difference, I removed that now. Thank you for the ping and help in investigating these crashes!

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@marcelwgn
Copy link
Collaborator Author

Looks like tests were not run because helix timed out.

@Felix-Dev
Copy link
Contributor

Felix-Dev commented Oct 9, 2020

I definitely did not think about that, I've added an empty PagerControl to the test page now and fixed the bug so we can find detect this if it regresses.

@chingucoding If we want to have a regression test, how about writing an API test instead? Then we have an explicit test for that scenario instead of opening the TestUI where a crash could happen due to multipe reasons in theory and not just caused by the PagerControl instance with no properties explicitly set (crash reason easier locatable then).

@marcelwgn
Copy link
Collaborator Author

Great idea @Felix-Dev ! Switch to an API test now.

@StephenLPeters
Copy link
Contributor

@chingucoding are you able to look at these test failures? it looks like we are maybe missing a wait for idle.

@marcelwgn
Copy link
Collaborator Author

Taking a look now, thanks for the ping!

@marcelwgn
Copy link
Collaborator Author

This is probably an issue with the selection logic used in the interaction test to select a page through the ComboBox. Strangely, not all tests that rely on this logic seem to fail and even more strangely, if a test succeeded, it succeeded in attempt 3. Unfortunately, I wasn't able to repro this on my machine, so the latest commit is just a guess here.

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@StephenLPeters
Copy link
Contributor

@chingucoding can you please merge master into this branch to pick up the pipeline stability change that went in today? (also if you would do the same for your other PR's that would be great)

@marcelwgn
Copy link
Collaborator Author

Updated all my PRs (except the Progressbar one which still has a passed CI build) to have the latest fixes from master.

@ranjeshj
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Pager team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants