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 216 by tony, Wed Mar 14 12:48:51 2018 UTC vs.
Revision 217 by tony, Fri Mar 16 10:27:26 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 +  {$IF FPC_FULLVERSION >= 30002}
235    else
236 +  with FTimer do
237    begin
238 <    FTimer.Interval := FDelayTimerValue;
239 <    FTimer.StartTimer;
240 <  end;
238 >    CheckSynchronize; {Ensure not waiting on Synchronize}
239 >    if Enabled then
240 >    begin
241 >      StopTimer;
242 >      StartTimer;
243 >    end
244 >    else
245 >      Enabled := true;
246 >  end
247 >  {$IFEND}
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