jahlxx Posted April 30, 2021 Share Posted April 30, 2021 Hi. How can I detect when the selected row changes? I mean, when I am in a row, I move to the prior or next row for example. Thanks. Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted April 30, 2021 Share Posted April 30, 2021 1 hour ago, jahlxx said: Hi. How can I detect when the selected row changes? I mean, when I am in a row, I move to the prior or next row for example. Thanks. Hi AfterScroll event of dataset? 1 Quote Link to comment Share on other sites More sharing options...
jahlxx Posted May 1, 2021 Author Share Posted May 1, 2021 Yes. Now I have in that way, but since I don't kow what update, when close a form that contains that event in some dataset. the application raises an error. I use UniDAC, but opened a case with them, and they say that it's not a UniDAC bug, is some thing in the application that raises the dataset event. I have tested the same with a VCL application, and works OK, but not with UniGUI. In UniGUI, closing a form, raises the afterscroll event of the dataset, and raises an error. So I was thinking about change the afterscroll event for other similar event of other element, for example, the dbgrid. Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted May 1, 2021 Share Posted May 1, 2021 2 hours ago, jahlxx said: Yes. Now I have in that way, but since I don't kow what update, when close a form that contains that event in some dataset. the application raises an error. I use UniDAC, but opened a case with them, and they say that it's not a UniDAC bug, is some thing in the application that raises the dataset event. I have tested the same with a VCL application, and works OK, but not with UniGUI. In UniGUI, closing a form, raises the afterscroll event of the dataset, and raises an error. So I was thinking about change the afterscroll event for other similar event of other element, for example, the dbgrid. Hi Can you please create a test case? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 1, 2021 Share Posted May 1, 2021 3 hours ago, jahlxx said: So I was thinking about change the afterscroll event for other similar event of other element, for example, the dbgrid. Hello, UniDBGrid -> OnSelectionChange event for example. Quote Link to comment Share on other sites More sharing options...
jahlxx Posted May 3, 2021 Author Share Posted May 3, 2021 On 5/1/2021 at 2:00 PM, Sherzod said: Hello, UniDBGrid -> OnSelectionChange event for example. Thanks, but it seems to be slower than afterscroll, andd raises the event even changing column. I need only when changing row. Quote Link to comment Share on other sites More sharing options...
irigsoft Posted May 3, 2021 Share Posted May 3, 2021 On 5/1/2021 at 11:52 AM, jahlxx said: . In UniGUI, closing a form, raises the afterscroll event of the dataset, and raises an error. Hello, when Form is closed, all components are destroyed if FreeOnClose is Enabled. How is in Your application ? Quote Link to comment Share on other sites More sharing options...
jahlxx Posted May 3, 2021 Author Share Posted May 3, 2021 Hi. Is set to true Quote Link to comment Share on other sites More sharing options...
irigsoft Posted May 3, 2021 Share Posted May 3, 2021 Just now, jahlxx said: Hi. Is set to true can You try it to set to False and look if then fire a event when closing form ? Quote Link to comment Share on other sites More sharing options...
jahlxx Posted May 3, 2021 Author Share Posted May 3, 2021 Same error Quote Link to comment Share on other sites More sharing options...
irigsoft Posted May 3, 2021 Share Posted May 3, 2021 4 minutes ago, jahlxx said: Same error So, try to this: Create uniMainModule variable like: FormIsClosed : Boolean; When Close Form then set it True. Add In AfterScroll: If not FormIsClosed then begin //You logic here end; This is not a solution to the global problem, but it can help you work around the error message Quote Link to comment Share on other sites More sharing options...
jahlxx Posted May 3, 2021 Author Share Posted May 3, 2021 Yes, it works, thanks. But is strange this behaviour. In older versions worked fine. Thanks. Quote Link to comment Share on other sites More sharing options...
irigsoft Posted May 3, 2021 Share Posted May 3, 2021 8 minutes ago, jahlxx said: Yes, it works, thanks. But is strange this behaviour. In older versions worked fine. Thanks. If this work, maybe You problem is here: 1. Where are the components of your query / table, who is the owner? 2. It is created dinamically or it's created in form creation ? Quote Link to comment Share on other sites More sharing options...
jahlxx Posted May 3, 2021 Author Share Posted May 3, 2021 Hi. The components are created in design time, they are in the form, and the owner is the same form. Quote Link to comment Share on other sites More sharing options...
irigsoft Posted May 3, 2021 Share Posted May 3, 2021 1 minute ago, jahlxx said: Hi. The components are created in design time, they are in the form, and the owner is the same form. How do You create component, any example ? I use this, but create it in Mainmodule: //add AdoQueryServerUses // search adoquery if Exist UniMainModule.FormAdoQuery := TAdoQuery (FindComponentEx ('AdoQueryServerUses_' + MainForm.Name)); If UniMainModule.FormAdoQuery = nil then begin UniMainModule.FormAdoQuery := TAdoQuery.Create (uniMainModule);//TuniForm (MainForm)); UniMainModule.FormAdoQuery.Name := 'AdoQueryServerUses_' + MainForm.Name; end; Quote Link to comment Share on other sites More sharing options...
Wilton Ergon Posted May 4, 2021 Share Posted May 4, 2021 for x:=0 to self.components.count-1 do begin if self.components[x] is tuniquery then begin tuniquery(self.components[x]).afterscroll :=nil; tuniquery(self.components[x]).close; end; end this will disable afterscroll from all your queries, and close them. Quote Link to comment Share on other sites More sharing options...
jahlxx Posted May 4, 2021 Author Share Posted May 4, 2021 8 hours ago, wilton_rad said: tuniquery(self.components[x]).afterscroll Ok. This almost works. I tried something like this some weeks ago, and the problem is the same. Works when you close the form, but dont work when you close the application. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.