RTC Forums
November 25, 2024, 03:10:50 AM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
Problem with handling result
Pages: [
1
]
« previous
next »
Print
Author
Topic: Problem with handling result (Read 7316 times)
Ronald van Tour
RTC License++
Posts: 37
Problem with handling result
«
on:
June 21, 2010, 09:13:07 AM »
We have a strange error with handling a result.
We have a component that splits the data in the rtcresult. When I try to put one of these datafiels inside of a standard label I get a problem.
Sometimes it works for one label, some for all and sometimes delphi just ignores all of my Tcaptions.
If I put the data inside of a Tmemo it works.
procedure TForm1.RtcResult_GetFileReturn(Sender: TRtcConnection; Data,
Result: TRtcValue);
var x:Tstringlist;
begin
if (result.asstring<>'Inbox in use') and (result.asstring<>'Access denied') and (result.asString<>'File not found')then
begin
x:=Tstringlist.create;
x.text:=result.asstring;
bestand:='From '+listbox7.items[listbox7.itemindex];
IFile:=listbox2.items[listbox2.itemindex];
IFolder:=listbox7.items[listbox7.itemindex];
Statusbar1.panels[0].Text:=bestand;
Form1.RTData_RawData.ReadDefinition;
Form1.RTData_RawData.LoadRecord(x,false);
//this works
memo1.Lines.Add(RTData_RawData.ReadData('C_INFO'));
memo1.Lines.Add(RTData_RawData.ReadData('H_INFO'));
memo1.Lines.Add(RTData_RawData.ReadData('N_INFO'));
//this does not works but sometimes it does ( at random)
Label_N_Info.caption:=RTData_RawData.ReadData('N_INFO');
Label_C_Info.caption:=RTData_RawData.ReadData('C_INFO');
Label_H_Info.caption:=RTData_RawData.ReadData('H_INFO');
x.free;
end;
end;
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: Problem with handling result
«
Reply #1 on:
June 21, 2010, 09:33:10 AM »
Provided you are using "RtcHttpClient.MultiThreaded:=FALSE" or "RtcClientModule.AutoSyncEvents:=TRUE" to make sure the code of your OnResult event (below) is executed from the Main thread , my wild guess is that there are limitations to what you can put inside a Caption of a TLabel.
Best Regards,
Danijel Tkalcec
Logged
Ronald van Tour
RTC License++
Posts: 37
Re: Problem with handling result
«
Reply #2 on:
June 21, 2010, 09:42:44 AM »
AutoSyncEvents:=True did work verry well for me!
Thank you
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: Problem with handling result
«
Reply #3 on:
June 21, 2010, 10:09:04 AM »
I'm glad the solution was so simple.
I guess you were using the RtcHttpClient component with "MultiThreaded:=True" and RtcClientModule with "AutoSyncEvents:=False", so that RTC events of your RtcClientModule and RtcResult components were executed from background threads.
Please note that the "AutoSyncEvents" property only affects events on the "TRtcClientModule" component (where the property is available) and TRtcResult components used to receive results from remote function calls made using that TRtcClientModule component. If you have events directly on the TRtcHttpClient component (which does NOT have the AutoSyncEvents property) and these events are also accessing the GUI (visual components), you should use the following construct to make sure these events are also executed from the main thread ...
procedure TMyForm.ThisIsMyEvent(Sender:TRtcConnection);
begin
if NOT Sender.inMainThread then
Sender.Sync(ThisIsMyEvent)
else
begin
// here comes your event code which needs to access the GUI
end;
end;
There are several overloaded versions of the "Sync" method, one for each event type supported by the RTC SDK, the example above is for most standard events on the TRtcHttpClient and TRtcHttpServer components.
Best Regards,
Danijel Tkalcec
Logged
kavetu
Newbie
Posts: 20
Re: Problem with handling result
«
Reply #4 on:
June 21, 2010, 04:00:01 PM »
May be we can make AutoSyncEvents:=True the default
in the RTC SDK.
Manfredt kavetu
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: Problem with handling result
«
Reply #5 on:
June 21, 2010, 04:44:23 PM »
If you want to do this in your local RTC SDK copy, be my guest. But making changes in the standard RTC SDK version which would have such rigorous effects on already existing Projects based on the RTC SDK is simply out of the question.
Best Regards,
Danijel Tkalcec
Logged
kavetu
Newbie
Posts: 20
Re: Problem with handling result
«
Reply #6 on:
June 22, 2010, 08:03:38 PM »
>If you want to do this in your local RTC SDK copy, be my guest. But making changes in the standard RTC >SDK version which would have such rigorous effects on already existing Projects based on the RTC SDK is >simply out of the question.
Yes that is true, that slipped me sorry.
Manfredt Kavetu
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...