Wish Why is there no Splitter Bar (View) to control panel widths?

Widget

Well-Known Member
Licensed User
Longtime User
I don't know why B4A doesn't have a splitter bar. A splitter bar is similar to a long thin panel that is only a few pixels thick, that separates two regions on the screen.

The splitter bar's orientation can be either
  • Vertical so it separates two regions; one region to the left of the splitter and one region to the right of the splitter
  • Horizontal so it separates two regions; one region above the splitter and one region below the splitter
The regions on each side of the splitter is usually a view like a Panel, ListView, ScrollView etc.

When the mouse (in this case a finger) drags the splitter perpendicular to its orientation, one of the views will expand its screen space and the other will shrink its screen space.

If it is a horizontal splitter (controls the Height of the top view vs the Top of the bottom view), it does this simply by adjusting the top view's Height and the bottom view's Top properties. If if is a vertical splitter then it controls the left view's Width and the right view's Left position.

This will come in very handy in B4A if the screen has say a ListView on the top half of the screen and a ScrollView at the bottom of the screen. The user can choose which View he wants to be larger (show more rows) simply by dragging the splitter.

Is there a reason why B4A doesn't have a splitter view?
Did I overlook something as to why it can't be done?

TIA
 

Cableguy

Expert
Licensed User
Longtime User
It shouldn't be that hard to code a custom view for it...
Give it a go!
 

klaus

Expert
Licensed User
Longtime User
AFAIK there exist no generic splitter bar in Android.
But, as Cableguy already suggested, you can easily do it on your own.
I did this in one of my programs.
A Panel having two ListViews and in the Panel_Touch event you change the position and dimensions of the two child views.
 

Widget

Well-Known Member
Licensed User
Longtime User
AFAIK there exist no generic splitter bar in Android.
But, as Cableguy already suggested, you can easily do it on your own.
I did this in one of my programs.
A Panel having two ListViews and in the Panel_Touch event you change the position and dimensions of the two child views.

After sleeping on it, would it be better (more useful) just to make a regular panel that has one or more sides that are expandable?
It would have 4 properties, TopExpand, LeftExpand, RightExpand, BottomExpand that are Boolean. To expand a ListView/Scrollview, just put it in an expandable Panel.

So when the user touches an edge of an expandable edge and drags it, the panel changes size.

Do you think this panel View be more useful than a splitter bar?
 

Cableguy

Expert
Licensed User
Longtime User
At this point in the IDE development, every view, or almost, has a touch event where the dev can get the xy values and act upon... so frankly I don't see an interest on this.... just my two cents
 

Widget

Well-Known Member
Licensed User
Longtime User
At this point in the IDE development, every view, or almost, has a touch event where the dev can get the xy values and act upon... so frankly I don't see an interest on this.... just my two cents

If your app is only going to have one adjustable panel, then sure it is just as easy to write the code to handle that one instance.
But what if your panel has 10 forms and two panels per form that need to be adjustable, by height or width depending on orientation, are you going to write code to handle each situation? Or would it be easier to just set the panel's property?
 

Cableguy

Expert
Licensed User
Longtime User
you don't need to, use anchors, and they will resize to its parents size automatically... just need to call invalidate
 

klaus

Expert
Licensed User
Longtime User
But what if your panel has 10 forms and two panels per form that need to be adjustable...
For me, this has noting to do with a Splitter Bar. Are you sure that a Splitter Bar will adjust all this ?
Currently there is no SplittBar, even in Android, so you have two possibilies:
- wait until somebodey makes one.
- or do it on your own, that's what I did.
 

Widget

Well-Known Member
Licensed User
Longtime User
For me, this has noting to do with a Splitter Bar. Are you sure that a Splitter Bar will adjust all this ?
Currently there is no SplittBar, even in Android, so you have two possibilies:
- wait until somebodey makes one.
- or do it on your own, that's what I did.

Sure, I will give it a try and write one. I thought I'd bounce the "splitter bar" idea off of the group to see if I was missing something obvious. Maybe it was done before or maybe it is not practical. I've played around with the idea in my head for the past day and I can't see why it can't be achieved. Of course putting pen to paper, or keyboard to screen in this case, may disprove all that. :p

I'll let you know how I make out.
 

Cableguy

Expert
Licensed User
Longtime User
I guess it won't be so pratical on small screen sizes... but, on 8"+ screens it may be of some use...
 
Top