Wrap search results in scrollable
This commit is contained in:
parent
da981b7499
commit
e6a39e19c3
2 changed files with 13 additions and 2 deletions
|
|
@ -159,7 +159,7 @@ namespace MatterControlLib
|
|||
// re-use the writer to get real-time updates
|
||||
var searcher = new IndexSearcher(writer.GetReader(applyAllDeletes: true));
|
||||
|
||||
var hits = searcher.Search(query, 20 /* top 20 */).ScoreDocs;
|
||||
var hits = searcher.Search(query, 40 /* top 20 */).ScoreDocs;
|
||||
|
||||
return hits.Select(hit =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -60,6 +60,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
searchButton.BackgroundColor = theme.SectionBackgroundColor;
|
||||
|
||||
GuiWidget searchResults = null;
|
||||
var scrollable = new ScrollableWidget(true)
|
||||
{
|
||||
HAnchor = HAnchor.Stretch,
|
||||
VAnchor = VAnchor.Stretch
|
||||
};
|
||||
|
||||
searchBox = new SearchInputBox(theme)
|
||||
{
|
||||
|
|
@ -95,6 +100,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
searchResults.Border = new BorderDouble(top: 1);
|
||||
// firstChild.Border = firstChild.Border.Clone(top: 1); - doesn't work for some reason, pushing border to parent above
|
||||
}
|
||||
|
||||
scrollable.TopLeftOffset = Vector2.Zero;
|
||||
};
|
||||
searchBox.ResetButton.Click += (s2, e2) =>
|
||||
{
|
||||
|
|
@ -106,12 +113,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
this.AddChild(searchBox);
|
||||
|
||||
scrollable.ScrollArea.HAnchor = HAnchor.Stretch;
|
||||
scrollable.ScrollArea.VAnchor = VAnchor.Fit;
|
||||
|
||||
this.AddChild(scrollable);
|
||||
searchResults = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||
{
|
||||
HAnchor = HAnchor.Stretch,
|
||||
VAnchor = VAnchor.Fit
|
||||
};
|
||||
this.AddChild(searchResults);
|
||||
scrollable.AddChild(searchResults);
|
||||
}
|
||||
|
||||
public override void OnLoad(EventArgs args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue