186 |
|
|
187 |
|
implementation |
188 |
|
|
189 |
< |
uses FBMessages, fpTimer; |
189 |
> |
uses IBMessages, IBTypes; |
190 |
|
|
191 |
|
type |
192 |
|
|
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; |
205 |
– |
destructor Destroy; override; |
205 |
|
property DelayTimerValue: integer {in Milliseconds} |
206 |
|
read FDelayTimerValue write SetDelayTimerValue; |
207 |
|
end; |
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; |
223 |
– |
{$IF FPC_FULLVERSION >= 30002} |
224 |
– |
if (AValue > 0) and not IsMultiThread then |
225 |
– |
IBError(ibxMultiThreadRequired,['TIBTable MasterDetailDelay']); |
226 |
– |
FTimer.Interval := FDelayTimerValue; |
227 |
– |
{$IFEND} |
224 |
|
end; |
225 |
|
|
226 |
|
procedure TIBMasterDataLink.DoMasterChange; |
227 |
|
begin |
228 |
< |
if FDelayTimerValue = 0 then |
233 |
< |
inherited DoMasterChange |
234 |
< |
{$IF FPC_FULLVERSION >= 30002} |
235 |
< |
else |
228 |
> |
if assigned(FTimer) and (FDelayTimerValue > 0) then |
229 |
|
with FTimer do |
230 |
|
begin |
231 |
< |
CheckSynchronize; {Ensure not waiting on Synchronize} |
232 |
< |
if Enabled then |
233 |
< |
begin |
241 |
< |
StopTimer; |
242 |
< |
StartTimer; |
243 |
< |
end |
244 |
< |
else |
245 |
< |
Enabled := true; |
231 |
> |
FTimer.Enabled := false; |
232 |
> |
FTimer.Interval := FDelayTimerValue; |
233 |
> |
FTimer.Enabled := true; |
234 |
|
end |
235 |
< |
{$IFEND} |
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 := false; |
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 |
|
|
260 |
– |
destructor TIBMasterDataLink.Destroy; |
261 |
– |
begin |
262 |
– |
if assigned(FTimer) then FTimer.Free; |
263 |
– |
inherited Destroy; |
264 |
– |
end; |
265 |
– |
|
255 |
|
{ TIBTable } |
256 |
|
|
257 |
|
constructor TIBTable.Create(AOwner: TComponent); |