Android Question [SOLVED] B4XDialog - possible to have scrollbar?

mfstuart

Active Member
Licensed User
Longtime User
I'm using the B4XDialog to display a "Color Picker" and I'd like to have a scrollbar added to it, as I want to add more colors to pick from than the vertical size of the B4XDialog.
There are 4 shades of a color across and there will be many more colors vertically.
I need a dialog that is cross platform and will allow the user to scroll vertically to pick a color.
The user touches on a color to select it. The dialog should then close after selecting a color.

I have a layout with 24 Labels on it.

What is the best way to do this?
the B4XDialog is loaded like this...
B4X:
Dim rs As ResumableSub = dg.ShowCustom(ListOfColorsPanel,"","","CANCEL")

Thanx,
Mark Stuart

My Color Picker - B4XDialog:
B4XDialog_Color Picker.jpg
 
Solution
Paul, thanx for posting both of the Pick a Color apps. Much appreciated!
Loading the CLV is the key thing in your changes that I was struggling with, so kudos to you!

I changed some scripts, colors, and layouts in my (Default) app...
Commented out the 4 subs: lbl_Click.
If you change the Event Name on each of the labels in the clvitem_layout.bal to "PickColor", then you only need 1 _Click event - PickColor_Click. See the app for this.

I've attached my app changes.

Thanx all for your suggestions. I think I'm going with what Paul put together.

Mark Stuart

EDIT: I've updated the demo app - PickAColor1.zip - code and many more colors.

Mahares

Expert
Licensed User
Longtime User
CLV is the key thing in your changes that I was struggling with
Too bad you were not given sound advice to at least consider modifying your code to accommodate more than a list divisible by 4, because sooner or later, you will encounter situations where the list of items is not divisible by 4 if you have 4 columns and wonder what happens to the missing items. It is not limited to just color palettes, but any objects of a different type. The main thing is you got what you want for now.
 
Upvote 0
Top