This code places two Elementary panes widgets on a window, one of them displayed vertically and the other horizontally, to exemplify a part of the widget's API.
Also, all the signals emitted by this widget will be covered.
Let's start adding a panes to our window:
Now we will set a content (a simple button) to the left side of our panes widget:
The content of the right side will be something a bit more elaborated, we'll place another panes, displayed vertically (it's displayed horizontally by default):
When populating a panes displayed vertically, remember that left content will be placed at top, and right content will place at bottom. Next we will add two buttons to exemplify that:
Panes widgets emits 4 different signals, depending on users interaction with the draggable bar. We'll add a callback function for each of them.
"clicked" signal
:
Callback function that just print "Clicked" to stdin:
Also, add callback function to the panes:
"press" signal
:
Callback function that just print "Pressed" to stdin:
Also, add callback function to the panes:
Now, let's try to make our callback functions a bit more useful:
"unpress" signal
:
Suppose we want to know the size proportion of left content after user drags the bar. We need to listen for unpress
signal, and get this size from our panes widget. It's done on the following function:
Adding the callback function to the panes:
"clicked,double" signal
:
Now, a interesting feature that could be addded to panes widget. Hide a content when user double click the draggable bar. It's done using a variable to store size and content left size getter and setter on the following function:
Adding the callback function to the panes:
See the full example, whose window should look like this picture: