Change colour of TLabel in FireMonkey iOS app, and add items to TStringGrid?
I managed to get Xcode (running as a VM under Windows) pushing an XE2 build FireMonkey iOS HD app to my (jailbroken) iPhone after XE-script-prep (creating the Xcode folder), with a valid company certificate.
Anyway, faking the native cocoa controls seems a little seedy, but sticking a TToolbar (panel with standard iPhone gradient), a couple of TSpeedButtons (which h开发者_Python百科ave this curious V slope thing going on), and a TStringGrid and you're almost in the realms of basic iPhone app design.
Drop a TLabel on the TToolbar for a caption and straight away you'll want to change the colour, which there doesnt appear to be a property for. Yeah but it's all style (TLayout) driven now I hear you say, which is what I thought, but the style editor doesnt have a colour (color!?) property within TLayout or TText aspects of the Style Designer.
Shoe-horning a second question which is just as quick, I dropped a TStringGrid on there and thought I'd dynamically set the rows, so I created a string column, set the RowCount to 6, then set the
Cells[1, n] := 'Row ' + IntToStr(iLoop);
...with no effect (I also tried Cells[0, n], in case it was a zero-based list).
Am I going mad?
Still stumped on connectivity (how do you talk to anything outside the iPhone!?), and the performance of spinning a 48x48 image with a TFloatAnimation on an iPhone 4 was quite frankly appalling. But I'm optimistic, we've got this far!
This works fine for me.
procedure TForm3.Button1Click(Sender: TObject);
var
i: Integer;
begin
for i:= 0 to 6 do
begin
StringGrid1.Cells[0,i] := 'Row:' + IntToStr(i);
end;
end;
I noticed you had both n
and iLoop
wich one was the loop variable?
As to the color setting Roberts answer works designtime, if you want to set it in code you can do Label1.FontFill.Color := TAlphaColorRec.Beige;
better way.
Label1.ApplyStyleLookup;
Label1.FontFill.Color := TAlphaColorRec.White;
But I think the correct approach would be to give FontFill a setter function like:
function GetFontFill: TBrush;
begin
if FNeedStyleLookup then ApplyStyleLookup;
Result := FFontFill;
end;
To change the color of a Label you need to use the Style.
Right Click on the Component and select Edit|Custom Style...
Then expand the Tlayout to find and select the TText
Then adjust the Fill
Property to change the color.
精彩评论