TColorBox > NoneColorColor (not used?) - c++builder

I am using TColorBox, which has a NoneColorColor property:
Specifies the color displayed in the color box for clNone.
I thought it was used to show the TColorBox when it is set to clNone.
However, when I set Selected to clNone, the color is set to that of the Color property, not to NoneColorColor.
void __fastcall TForm2::FormShow(TObject *Sender)
{
ColorBox1->NoneColorColor = clGreen;
ColorBox1->Selected = clNone;
}
The above code makes the TColorBox white (set in Color), not Green.
Is the NoneColorColor used?

Related

Why the child panel do not assume its color?

Now I am struggling to set the color of a child panel placed on another one.
The goal is to represent fractions of time with certain properties over the whole period, represented by a TPanel on the background(Lime Green).
I do not understand, the code I am using has already worked, but now the child panel keeps the same color of the parent panel.
int IntSize = SecondsBetween( CurrInterrup->TerminoInt, CurrInterrup->InicioInt );
int dura = SecondsBetween( Indisp->DtHoraFim, Indisp->DtHoraIni);
int left = SecondsBetween( Indisp->DtHoraIni, CurrInterrup->InicioInt);
int width = RoundTo(((double)dura /(double) IntSize) *(double) PnGreen->Width, 0);
left = RoundTo(((double)left/(double)IntSize) * (double)PnGreen->Width, 0);
TPanel *pn = new TPanel(this);
pn->ParentColor = false;
pn->BorderStyle = bsSingle;
pn->BevelKind = bkSoft;
pn->Color = clRed;
pn->Left = left;
pn->Width = width;
pn->Height = PnGreen->Height -5;
pn->Parent = PnGreen; // A Panel instantiated at design time of color clLime
pn->Update();
The panel "pn" is shown with the correct properties of left, height and width and position, but the color is clLime instead of clRed.
Is there any error on the code?
Thank you very much.
Kind Regards.
Try setting the panel's ParentBackground property to false.
If ParentBackground is True, the control uses the parent's theme background to draw its own background.
If ParentBackground is False, the control uses its own properties, such as Color, to draw its background.

Text color is not set properly

Every time I want to set the text color, it doesn't work properly. For example, if I have a LazyColumn with some texts that have White color, some of them have white color, and some of them are set to Black.
Sometimes the text color is set properly but it changes by itself when I navigate through screens or when I swipe up or down.
code:
Text(
color = MaterialTheme.colors.textColor,
text = team.uppercase(Locale.getDefault()),
fontSize = 25.sp
)
val Colors.textColor
#Composable
get() = if(isSystemInDarkTheme()) Color.White else Color.DarkGray
Any help?

How to set an icon's color to [default color] in jetpack compose?

An icon has a default color, and it could be different under different themes.
When meet the condition, I hope the icon's color become Color.RED, otherwise it used the default color (example, white on one theme and yellow on another theme)
But I don't know the grammar of how to set to default color. Please help, thanks a lot!
val judge = ... //a mutableStateOf Boolean
...
// how to set [default color]?
Icon(painterResource(R.drawable.ic_baseline_error_outline_24),
contentDescription = null,
tint = if (judge) Color.RED else [default color])
If you go to Icon file you see its value:
tint: Color = LocalContentColor.current.copy(alpha = LocalContentAlpha.current)
You can just set it again

while using ModalBottomSheetLayout, how to make background and status bar transparent in Jetpack compose

I am new to jetpack. My app is having ModalBottomSheetLayout in MainScreen. Now when I click on button of MainScreen, it shows BottomSheet. When bottom sheet is open, the background is transparent but status bar is not. How to make it transparent?
So far, you can use the System UI Controller in the accompanist library to control the statusBar Color and navigationBar color
implementation "com.google.accompanist:accompanist-systemuicontroller:0.18.0"
// Remember a SystemUiController
val systemUiController = rememberSystemUiController()
val useDarkIcons = MaterialTheme.colors.isLight
SideEffect {
// Update all of the system bar colors to be transparent, and use
// dark icons if we're in light theme
systemUiController.setSystemBarsColor(
color = Color.Transparent,
darkIcons = useDarkIcons
)
// setStatusBarsColor() and setNavigationBarsColor() also exist
}

AmCharts 4 tooltip negtive and positive color of single LineSeries

https://www.amcharts.com/demos/date-based-line-chart/
In above have a LineSeries Chart with positive and negative values with different line colors but tooltip have only negative value color.
Can this possible to have positive line have different color of tooltip and negtive have another tooltip color?
Yes, it's totally possible.
Firstly, to adjust the background color of a tooltip, you'll need to kill its default behavior of grabbing color information from the calling object (in this case it gets the fill from the series). That's done via:
series.tooltip.getFillFromObject = false;
Then to adjust the background:
series.tooltip.background.fill = // color here
To switch its background color based on the value it's showing, one way we can do that is use an adapter for the series' tooltipText, because when that triggers we know the tooltip is being shown and/or changing. In there we can detect the current dataItem being sourced, check the value, and adjust the tooltip's background fill accordingly.
Sample code:
series.tooltip.getFillFromObject = false;
series.tooltip.background.fill = "blue";
series.adapter.add("tooltipText", function(tooltipText) {
if (series.tooltipDataItem.dataContext.visits < 0) {
series.tooltip.background.fill = "red";
} else {
series.tooltip.background.fill = "blue";
}
return tooltipText;
});
Demo:
https://codepen.io/team/amcharts/pen/913514e19a189c8779e07ffcae861ce3

Resources