Hi,
The width of the bulb changes to fit the text, at least id does in iOS. Is there anyway I can fix it's width as I am using it as a counter.
Thanks,
Ken
And adjust the delete buttons width accordingly.
Sorry, I posted the previous post against the wrong topic. Please delete.
Could I please have an answer on the Bulb width? Is there any way of fixing it to a specific size?
Yes, through the OnItemCustomize
Thankk but this doesn't do anything. The width is still calculated based on the content.
Please provide a sample demonstrating this. When using this code, the width is updated correctly, there must be something else you are doing to reset the width.
It is probably due to this code in the FormCreate event:
GamesTableView.NeedStyleLookup;
GamesTableView.ApplyStyleLookup;
with TRectangle(GamesTableView.GetListBackGround) do
begin
Fill.Color:=FillColor;
Stroke.Color:=FillColor;
Fill.Kind:=TBrushKind.Solid;
end;
with GamesTableView.GetHeaderRectangle do
begin
Fill.Color:=FillColor;
Stroke.Color:=FillColor;
Fill.Kind:=TBrushKind.Solid;
end;
with GamesTableView.GetHeaderText do
begin
Margins.Left:=5;
TextSettings.FontColor:=TAlphaColors.White;
TextSettings.HorzAlign:=TTextAlign.Leading;
Text:=rsActiveGames;
end;
with TRectangle(GamesTableView.GetDefaultItem) do
begin
Fill.Color:=FillColor;
Stroke.Color:=FillColor;
Fill.Kind:=TBrushKind.Solid;
end;
with TTMSFMXTableViewItemShape(GamesTableView.GetDefaultItem) do
begin
FillSelected.Color:=DarkerFillColor;
FillSelected.Kind:=TBrushKind.Solid;
StrokeSelected.Color:=DarkerFillColor;
FillSelected.Kind:=TBrushKind.Solid;
ShapeCaption.Color:=TAlphaColors.White;
ShapeDescription.Color:=TAlphaColors.White;
ShapeBulbText.Color:=DarkerFillColor;
ShapeBulbRectangle.Width:=100; // Tried this here but also no change
end;
Hi,
It is because of the line indicated in the following code from unit FMX.TMSTableView:
procedure TTMSFMXTableViewItem.UpdateBulb;
var
shptxt: TTMSFMXHTMLText;
shp: TTMSFMXTableViewBulbShape;
begin
shptxt := ShapeBulbText;
shp := ShapeBulbRectangle;
if Assigned(shp) and Assigned(shptxt) then
begin
shp.Item := Self;
shp.Visible := BulbText <> '';
if shp.Visible then
begin
shptxt.Text := BulbText;
shp.Width := Max(30, shptxt.GetTextWidth + 6); <-------------------------
end;
shp.UpdateControls;
end;
UpdateAlignments;
end;
UpdateBulb is called 3 times, during initialization, after adding a new item, and when changing the bulb-text. In each case, you should be able to initialize the width of the bulb text as the OnItemCustomize is called after UpdateBulb. Please send us a sample demonstrating this issue, so we can investigate what the difference is in initialization.
Please see http://www.estateagentpro.com/TableView.zip - the bulb text width is always variable.
Use a BeginUpdate/EndUpdate