[Article] Using bean JsplitPane in Servoy
In Servoy there is a great bean called: JsplitPane
This gives the developer the possibilty to have two tabpanels in one view with a horizontal or vertical ruler in the middle. Looks really great.
Here's how you can use it:
- Make a new form and go to Elements and select: Place Bean
- Scroll down and choose: JsplitPane
- Now you see the bean on your form. Drag it a little bit wider, just about your complete form.
- If you select the bean, you will see a lot of properties on the leftside of your screen. Set the name-property to: split
- Set property: orientation to: 0
- Set property: dividerlocation: 200
[image unavailable: Jsplit1]
- Go to Elements and choose: Place tabpanel. Select a related or nonrelated tabpanel, you already have in your solution. Place the tabpanel on on top of the JsplitPane.
- If you select the tabpanel only (not the form!) you see also all kind of properties. Set the name-property to: tabs1
[image unavailable: Jsplit2_1]
- Go to elements and choose: Place tabpanel. Select a related or nonrelated tabpanel, you already have in your solution. Place the tabpanel on on top of the JsplitPane.
- Set the name-property to: tabs2
[image unavailable: Jsplit3]
Does it work already? No, we first have to make a method as follows:
elements.split.orientation = 0 //0 = horizontal split, 1 = vertical split
elements.split.topComponent = elements.tabs1; //assign 1st tabpanel
elements.split.bottomComponent = elements.tabs2; //assign 2nd tabpanel
elements.split.dividerLocation = 300 //set the position of the pane divider
Attach this method to the onShow property of the form
Go from design mode to browse mode and voilah...you have made your first splitPanel, with two different forms in it.
[image unavailable: Jsplit4]