-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
PickerDelegate::selected_index_changed
(#12059)
Adds the ability to have some effect run when a selection changes in a picker. If the `PickerDelegate` implements something other than `None` for `selected_index_changed` then each time the selection changes it will run that effect. For example: ```rs impl PickerDelegate for PromptManagerDelegate { //... fn selected_index_changed( &self, ix: usize, cx: &mut ViewContext<Picker<Self>>, ) -> Option<Box<dyn Fn(&mut WindowContext) + 'static>> { Some(self.prompt_manager.set_active_prompt(ix, cx)) } //... } ``` This isn't currently used in any picker, but I'm adding this to allow the functionality we intended for the prompt library, we're changing selections, activates a preview in the right column. This will be useful for building any sort of UI where there's a picker on the left and a preview on the right, such as a UI like them telescope. Release Notes: - N/A
- Loading branch information
1 parent
7db85b0
commit 0970323
Showing
1 changed file
with
33 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters