Segmented control problem

Two questions:

Is there no way to make a button look like a button?
I dont care that Apple think it should look like a label: I want something that has a boundary and an obvious ‘click here’ ness about it.

Second, in an attempt to do that, I have been using segmented controls.
Works well in most situations
However, when used in a custom cell, a segmented control with one segment displays on all rows as a segmented control with 2 segments, labelled 1 / 2
then refreshes as a single segment with the correct label.
Looks shoddy
So the second question is : why does a segmented control with one segment appear with 2 then ‘sorts itself out’
(I only have an opened event to play with and nothing I do there makes a difference)

Did you try iOSdesignExtensions?
It has many features to change the look and feel of a button such as

Adjust font size to fit width
Backdrop
Background color
Border color
Border width
Button insets
Button tiled background
Corner radius
Image insets
Image
Line break
Number of lines
Role (iOS14+)
Text alignment
Title edge insets

Thanks Jeremy.
At first sight, this looked very promising.

However, for reasons I cannot work out, neither the Opening event of a MobileButton or the Opening even of the customcell it lives within, ever get called when the list is displayed.

I have a custom cell with some labels and a MobileButton
It is created and displayed in an iOS MobileTable (there doesnt seem to be a ‘MobileTable’ object)

At no time is the Opening event of the customcell called,
and at no time is the opening event of the Mobile Button called.

I don’t know if the Opening event of a CustomCell is ever called. I have worked around this issue in some other way the past 5 years.

A project is worth a 1000 words :wink:
Download project

Have you tried playing with bevel buttons and its various available shapes?
(I don’t use Big Sur, but I can’t believe all shapes have gone)

There are no bevel buttons on iOS.

Sorry, I didn’t noticed the section this thread was in; I assumed “on MacOS”.

Thanks Jeremie.
The sample code confused me as I could not work out how you were filling the list - I have a dataset, I didnt know you could do it programatically like that.

Anyway, what that means is that I dont need any of the delgates and callbacks.

I can use the code directly in the ROWDATA method of my dataset:


customcell.button1.SetBackgroundColorXC(&c00e0e0)
customcell.button1.SetCornerRadiusXC(8)
customcell.button1.CaptionColor = &cFF0000

And this works well. Thank you!

(Has anyone reported that the Opening event doesnt work?)

ps: although this post is the ‘solution’, I marked your post as such since it is your code I used.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.