dukke / FXRibbon

Ribbon control for Java, created in JavaFX
http://www.pixelduke.com/fxribbon
244 stars 46 forks source link

Horizontal scrolling for ribbon groups inside ribbon tab #11

Closed joaowiciuk closed 6 years ago

joaowiciuk commented 6 years ago

Some ribbon groups and ribbon itens get cropped when the stage size is less than the total ribbon tab size. Horizontal scrolling gives users an easy way for accessing that elements without resizing the application window.

dukke commented 6 years ago

Hi Joao!

First of all thank you very much for your contribution. This is what I want: more people joining the team to build this library :)

Regarding your issue this is not how I wanted to solve this problem. Can you check this microsoft documentation page on ribbon resizing, please: https://msdn.microsoft.com/en-us/library/ff701790(v=vs.110).aspx This is how I would want to have this fixed. Take a look at how the ribbon groups collapse into a button (when there is no space) that when clicked show the content in a dialog.

Thanks! Best regards,

joaowiciuk commented 6 years ago

Hello, Dukke!

I'm happy for helping.

About the ribbon resizing, I think it is a lot of work to do, but I also think its a better approach and its good to have such a design guideline. Sorry for not asking for it before.

Thanks!

dukke commented 6 years ago

Sure, I'm glad to help in whatever way I can.. Thanks!

joaowiciuk commented 6 years ago

Hey, @dukke, any idea on how to achieve this? I have done a search and could not find some framework or library we can use properly here. I have found FlexBoxFX but its not well suited for this case. Also have read the Node, Labeled and Region JavaFX docs to find how to detect when the Bounds of an element are out of Scene, but it does not seem easy to do this.

As a test, I have written

content.boundsInLocalProperty().addListener((observable, oldBounds, newBounds) -> { System.out.println(newBounds); });

For the RibbonTab HBox content, but the width of the BoundingBox is no less than 410, wich is the prefWidth of the BorderPane setted in the FXML resource of the AdvancedRibbon2FXML example.

Any thoughts?

dukke commented 6 years ago

What if you convert the bounds of the HBox to scene coordinates with the localToScene methods, then check against the Scene bounds by getting the Scene of the Node then retrieving its bounds. If the bounds of the HBox fall outside the Scene bounds then the HBox is outside the Scene and you should "collapse it"