ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/nongui/IBTable.pas
(Generate patch)

Comparing ibx/trunk/runtime/nongui/IBTable.pas (file contents):
Revision 209 by tony, Wed Mar 14 12:48:51 2018 UTC vs.
Revision 220 by tony, Fri Mar 16 11:37:59 2018 UTC

# Line 197 | Line 197 | type
197      FDelayTimerValue: integer;
198      FTimer: TFPTimer;
199      procedure HandleRefreshTimer(Sender: TObject);
200 +    procedure SetDelayTimerValue(AValue: integer);
201    protected
202      procedure DoMasterChange; override;
203    public
204      constructor Create(ADataSet: TDataSet); override;
205      destructor Destroy; override;
206      property DelayTimerValue: integer {in Milliseconds}
207 <            read FDelayTimerValue write FDelayTimerValue;
207 >            read FDelayTimerValue write SetDelayTimerValue;
208    end;
209  
210   { TIBMasterDataLink }
211  
212   procedure TIBMasterDataLink.HandleRefreshTimer(Sender: TObject);
213   begin
214 <  FTimer.Interval := 0;
215 <  inherited DoMasterChange;
214 >  FTimer.Enabled := false;
215 >  if GetDetailDataSet.Active then
216 >    inherited DoMasterChange;
217 > end;
218 >
219 > procedure TIBMasterDataLink.SetDelayTimerValue(AValue: integer);
220 > begin
221 >  if FDelayTimerValue = AValue then Exit;
222 >  FDelayTimerValue := AValue;
223 >  {$IF FPC_FULLVERSION >= 30002}
224 >  if (AValue > 0) and not IsMultiThread then
225 >    IBError(ibxMultiThreadRequired,['TIBTable MasterDetailDelay']);
226 >  FTimer.Interval := FDelayTimerValue;
227 >  {$IFEND}
228   end;
229  
230   procedure TIBMasterDataLink.DoMasterChange;
231   begin
232 <  if FDelayTimerValue = 0 then
233 <    inherited DoMasterChange
234 <  else
232 >  {$IF FPC_FULLVERSION >= 30002}
233 >  if FDelayTimerValue > 0 then
234 >  with FTimer do
235    begin
236 <    FTimer.Interval := FDelayTimerValue;
237 <    FTimer.StartTimer;
238 <  end;
236 >    CheckSynchronize; {Ensure not waiting on Synchronize}
237 >    if Enabled then
238 >    begin
239 >      StopTimer;
240 >      StartTimer;
241 >    end
242 >    else
243 >      Enabled := true;
244 >  end
245 >  else
246 >  {$IFEND}
247 >    inherited DoMasterChange
248   end;
249  
250   constructor TIBMasterDataLink.Create(ADataSet: TDataSet);
251   begin
252    inherited Create(ADataSet);
253    FTimer := TFPTimer.Create(nil);
254 <  FTimer.Enabled := true;
254 >  FTimer.Enabled := false;
255    FTimer.Interval := 0;
256    FTimer.OnTimer := HandleRefreshTimer;
257    FDelayTimerValue := 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines