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

Feature: Dropdown options with callback #826

Merged

Conversation

jeptechnology
Copy link
Contributor

I wanted two things on the dropdown in my application:

  • to pass in an "on changed" callback to a dropdown.
  • to select whether to draw a border.

Can you consider this PR, please?

Thanks 👍

Copy link
Owner

@ArthurSonzogni ArthurSonzogni left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -30,12 +30,12 @@ int main() {

auto layout = Container::Vertical({
Container::Horizontal({
Dropdown(&entries, &selected_1),
Dropdown(&entries, &selected_1, { .on_change = [&] { selected_3 = selected_1; } } ), // Keep in sync with selected_3.
Copy link
Owner

Choose a reason for hiding this comment

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

Thanks!
Could you revert this file change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure - done 👍

@@ -74,7 +74,7 @@ Component Radiobox(ConstStringListRef entries,
int* selected_,
RadioboxOption options = {});

Component Dropdown(ConstStringListRef entries, int* selected);
Component Dropdown(ConstStringListRef entries, int* selected, DropdownOption options = {});
Copy link
Owner

Choose a reason for hiding this comment

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

Could you format?

clang-format

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 👍

@jeptechnology
Copy link
Contributor Author

@ArthurSonzogni Thanks for enhancing the dropdown functionality. I hope you don't mind but I saw the build error and put in a fix to correct it. Let me know if you think this is OK 👍

@ArthurSonzogni ArthurSonzogni merged commit 3c9fa60 into ArthurSonzogni:main Apr 6, 2024
5 of 6 checks passed
@ArthurSonzogni
Copy link
Owner

Thanks for your contribution to FTXUI! 👍

ArthurSonzogni added a commit that referenced this pull request May 13, 2024
A bug was introduced by:
#826

The checkbox label wasn't updated.

Bug:#861
ArthurSonzogni added a commit that referenced this pull request May 14, 2024
A bug was introduced by:
#826

The checkbox label wasn't updated.

Bug:#861
ArthurSonzogni added a commit that referenced this pull request May 15, 2024
A bug was introduced by:
#826

The checkbox label wasn't updated.

Bug:#861
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

Successfully merging this pull request may close these issues.

None yet

2 participants