Hi,
I change settings of my TAdvSmoothTimeLine runtime.
New Indicators are drawn, but Sections aren't.
I tried to use Invalidate or Repaint with no success. When I resize this control by dragging form border runtime it draws Sections too then.
Do you have more details on what exact runtime changes you do?
Code snippet? Sample source? ... so we have information to start to investigate / reproduce
I am not sure if my code snippet will suffice, but here it comes:
I have got initially set TimeLine and this is only runtime code. I had to add manually changing Width at the end to force redraw.
function TDM.GetDataToTimeline(NieruchomoscNumer : Integer;
TType : Char;
_Y : Integer;
_M : Integer;
var tl : TAdvSmoothTimeLine): Integer;
begin
tl.TimeLineSections.Clear;
tl.TimeLineIndicators.Clear;
if UpperCase(TType) = 'Y' then
begin
tl.SetTimeLineRange( EncodeDate(_Y, _M, 1), EncodeDate(_Y+1, _M, 1) -1 );
tl.RangeAppearance.DivisionFormat := 'yyyy-mm';
tl.RangeAppearance.ShowSubDivisionValue := False;
tl.Range.DivisionType := dtMonth;
tl.Range.AutoSubDivisions := True;
end;
if UpperCase(TType) = 'M' then
begin
tl.SetTimeLineRange( EncodeDate(_Y, _M, 1) , EncodeDate(_Y, _M+1, 1) );
tl.RangeAppearance.DivisionFormat := 'yyyy-mm';
tl.RangeAppearance.SubDivisionFormat := 'dd';
tl.RangeAppearance.ShowSubDivisionValue := True;
tl.Range.SubDivisions := DaysInAMonth(_Y, _M);
tl.Range.DivisionType := dtFixedNumber;
tl.Range.AutoSubDivisions := False;
end;
with TMyQuery.Create(nil) do
begin
Connection := DM.mc;
SQL.Add('CALL GetDataToTimeline(:nn, :ttype, :y, :m)');
ParamByName('nn').AsInteger := NieruchomoscNumer;
ParamByName('ttype').AsString := TType;
ParamByName('y').AsInteger := _Y;
ParamByName('m').AsInteger := _M;
Open;
Result := RecordCount;
if RecordCount > 0 then
begin
First;
while not eof do
begin
if FieldByName('IType').AsString = 'RAMKA' then
begin
with tl.TimeLineSections.Add do
begin
EndTime := FieldByName('DFinish').AsDateTime;
StartTime := FieldByName('DStart').AsDateTime;
FixedSize := True;
FixedPosition := True;
end;
end;
if FieldByName('IType').AsString = 'ODCZYT' then
begin
with tl.TimeLineIndicators.Add do
begin
Position := FieldByName('DStart').AsDateTime;
Opacity := 50;
OpacityTo := 100;
Fixed := True;
Hint := 'Wodomierzy: ' + FieldByName('Wodomierzy').AsString + sLineBreak +
'Odczytano: ' + FieldByName('Odczytano').AsString + sLineBreak +
'Data odczytu: ' + FieldByName('DStart').AsString + sLineBreak +
'Odczytujący: ' + FieldByName('Inkasent').AsString;
// all read by radio
if (FieldByName('Wodomierzy').AsInteger = FieldByName('Odczytano').AsInteger) and
(FieldByName('Recznie').AsInteger = 0) then
begin
Color := clGreen;
ColorTo := clTeal;
end;
// all read but some manually
if (FieldByName('Wodomierzy').AsInteger = FieldByName('Odczytano').AsInteger) and
(FieldByName('Recznie').AsInteger > 0) then
begin
Color := clYellow;
ColorTo := clRed;
end;
// some read
if FieldByName('Wodomierzy').AsInteger > FieldByName('Odczytano').AsInteger then
begin
Color := clRed;
ColorTo := clFuchsia;
end;
end;
end;
Next;
end;
end;
Close;
Free;
end;
tl.Width := tl.Width - 1;
tl.Width := tl.Width + 1;
end;
Please use BeginUpdate and EndUpdate to update the timeline