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 291 by tony, Fri Apr 17 10:26:08 2020 UTC

# Line 186 | Line 186 | type
186  
187   implementation
188  
189 < uses FBMessages, fpTimer;
189 > uses IBMessages, IBTypes;
190  
191   type
192  
# Line 195 | Line 195 | type
195    TIBMasterDataLink = class(TMasterDataLink)
196    private
197      FDelayTimerValue: integer;
198 <    FTimer: TFPTimer;
198 >    FTimer: TIBTimerInf;
199      procedure HandleRefreshTimer(Sender: TObject);
200 +    procedure SetDelayTimerValue(AValue: integer);
201    protected
202      procedure DoMasterChange; override;
203    public
204      constructor Create(ADataSet: TDataSet); override;
204    destructor Destroy; override;
205      property DelayTimerValue: integer {in Milliseconds}
206 <            read FDelayTimerValue write FDelayTimerValue;
206 >            read FDelayTimerValue write SetDelayTimerValue;
207    end;
208  
209   { TIBMasterDataLink }
210  
211   procedure TIBMasterDataLink.HandleRefreshTimer(Sender: TObject);
212   begin
213 <  FTimer.Interval := 0;
214 <  inherited DoMasterChange;
213 >  FTimer.Enabled := false;
214 >  if GetDetailDataSet.Active then
215 >    inherited DoMasterChange;
216 > end;
217 >
218 > procedure TIBMasterDataLink.SetDelayTimerValue(AValue: integer);
219 > begin
220 >  if FDelayTimerValue = AValue then Exit;
221 >  if assigned(FTimer) then
222 >    FTimer.Enabled := false;
223 >  FDelayTimerValue := AValue;
224   end;
225  
226   procedure TIBMasterDataLink.DoMasterChange;
227   begin
228 <  if FDelayTimerValue = 0 then
229 <    inherited DoMasterChange
221 <  else
228 >  if assigned(FTimer) and (FDelayTimerValue > 0) then
229 >  with FTimer do
230    begin
231 +    FTimer.Enabled := false;
232      FTimer.Interval := FDelayTimerValue;
233 <    FTimer.StartTimer;
234 <  end;
233 >    FTimer.Enabled := true;
234 >  end
235 >  else
236 >    inherited DoMasterChange
237   end;
238  
239   constructor TIBMasterDataLink.Create(ADataSet: TDataSet);
240   begin
241    inherited Create(ADataSet);
242 <  FTimer := TFPTimer.Create(nil);
243 <  FTimer.Enabled := true;
244 <  FTimer.Interval := 0;
245 <  FTimer.OnTimer := HandleRefreshTimer;
242 >  if assigned(IBGUIInterface) then
243 >  begin
244 >    FTimer := IBGUIInterface.CreateTimer;
245 >    if FTimer <> nil then
246 >    begin
247 >      FTimer.Enabled := false;
248 >      FTimer.Interval := 0;
249 >      FTimer.OnTimer := HandleRefreshTimer;
250 >    end;
251 >  end;
252    FDelayTimerValue := 0;
253   end;
254  
238 destructor TIBMasterDataLink.Destroy;
239 begin
240  if assigned(FTimer) then FTimer.Free;
241  inherited Destroy;
242 end;
243
255   { TIBTable }
256  
257   constructor TIBTable.Create(AOwner: TComponent);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines