Title: Problem with handling result Post by: Ronald van Tour 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; Title: Re: Problem with handling result Post by: D.Tkalcec (RTC) 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 Title: Re: Problem with handling result Post by: Ronald van Tour on June 21, 2010, 09:42:44 AM AutoSyncEvents:=True did work verry well for me!
Thank you Title: Re: Problem with handling result Post by: D.Tkalcec (RTC) 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 Title: Re: Problem with handling result Post by: kavetu on June 21, 2010, 04:00:01 PM May be we can make AutoSyncEvents:=True the default
in the RTC SDK. Manfredt kavetu Title: Re: Problem with handling result Post by: D.Tkalcec (RTC) 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 Title: Re: Problem with handling result Post by: kavetu 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 |