Re: [Lazarus] External SIGSEGV (random) when assigning TBookmark
On Mon, 2 Nov 2015, Leonardo M. Ramé wrote: El 01/11/15 a las 09:25, Leonardo M. Ramé escribió: Hi, I don't use data aware controls too often, but as I'm updating a legacy application I have to use them. ... I finally solved this by getting the value of a primary key, then after TSQLQuery.refresh I do a locate for that key, works like a charm. What I don't get is what's the purpouse of TBookmark, I thought it was made for solving the problem I had. Bookmarks are only valid until the dataset closes. I will add this to the documentation. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] External SIGSEGV (random) when assigning TBookmark
El 03/11/15 a les 00:58, Leonardo M. Ramé ha escrit: What I don't get is what's the purpouse of TBookmark, I thought it was made for solving the problem I had. Yes, but only if you leave the dataset open. Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus implementation of TListView etc?
El 02/11/2015 a las 20:32, Bo Berglund escribió: IMHO using lnet or Synapse would be a lot "clearer" than using the overly complex Indy Library. I had already looked at Synapse, but it is blocking. I did not know about lnet (or INet as it is shown when one searches) before but now I have had a look and it seems to fit the bill for me since it is event oriented, like I need for this particular task. Hello, I was following your thread from the beginning and or I do not understand absolutely nothing about your needs or you are focusing the problem in the opposite way. Let me explain me, I think you had inherited a GUI app which you need to transform in a console one and this GUI app uses events to coordinate data flows, so in example the app connects to a server, gets a web page and some event handler process this data and outputs something to a file. The problem was that the event handler also updates information on screen (AKA TListView, ...) which you already removed. That's fine, but my question is why you need event sockets ? I had converted some small apps with events in console ones and using only blocking sockets because I do not need to update screen information in GUI, only in console and as the console (in my case) do not need events from the user like response to keypress I do not need real events, so I wrote your "thread" in the main thread and manually "evented" each reception, something like this in pseudocode: begin Socket.Connect... MyClass.Connect(Socket); Socket.http('x'); while Socket.Connected do begin If Timedout() then break; ReceivedBytes:=Socket.Read(Buffer,0); if ReceivedBytes>=0 then begin ReceivedBytes:=Socket.Read(Buffer,ReceivedBytes); //Now I call the event reception //not a real event, but that's not important. MyClass.Received(Socket,Buffer,ReceivedBytes); end; end; Socket.Close; MyClass.Disconnect(Socket,REASON_GREACEFUL_CLOSE); Socket.Free; end; Of course the same can be done with multiple sockets at a time and call different handlers based in the socket that connects, receive data, etc... Even if you use http transfers its more easy with blocking, something like: Document:=http.get('http://xxx); MyClass.Connect(); MyClass.Receive(Buffer,Length(Buffer)); MyClass.Closed(); Your class do not know if the data comes from an event or from a blocking socket. A different thing is if you need some kind of timing between operations. -- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Another widget
I'm going to revise the getlazarus front page and include a rotating banner linking to a few projects, with the ability to download both window installers and deb packages, as well as the source code. So far I have created a screen grab a color mixer, a screen magnifier, a deb package maker, this cpu graph, and I am finishing my desktop image/video capture and share (through S3). All should work cross platform (still working on this). If anyone wants to test any of these before I finish updating the website, I can post links to deb files. With my last app, a deb package maker ( http://cache.getlazarus.org/images/cpugraph-deb.png) people expressed interest. I posted the debs and haven't heard anything back, so there's that. IF anyone watches the video and has any suggestions, I might be able to implement them before I decide to make the deb files. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus in trunk not working after Rev 50151 on MacOSX
On Thu, 29 Oct 2015 00:55:46 +0100 Michael Ring wrote: > I today realized that current trunk does not work anymore after Rev > 50151, Lazarus starts and when I load a project I get a Range Check > Error and after this I cannot open source files. > > Is this a known issue? What FPC version? What options did you use to compile the IDE? Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Another widget
On Mon, 2 Nov 2015 19:23:28 -0500 Anthony Walter wrote: > I created another Linux utility with Lazarus. Here is my CPU Graph utility: > > http://cache.getlazarus.org/video/widget-cpugraph.mp4 > > It can record up to 1 hour of CPU activity while silently sitting in the > tray. Pressing a hotkey toggles the display of the graph. > > I am probably going to add a few styles the user can choose from as well > individual CPU percentages and core speed stepping (CPU Mhz can change > depending on system load). > > I think the benefit of this over the gnome system monitor is that when the > gnome monitor is closed no CPU activity is recorded. Mine allows you to > change the graph range and rewind through history. It also uses very little > resources when it's not being displayed. Oh and it's easier to open/close > (through a global hotkey). Great. Where can I get it? Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Another widget
I created another Linux utility with Lazarus. Here is my CPU Graph utility: http://cache.getlazarus.org/video/widget-cpugraph.mp4 It can record up to 1 hour of CPU activity while silently sitting in the tray. Pressing a hotkey toggles the display of the graph. I am probably going to add a few styles the user can choose from as well individual CPU percentages and core speed stepping (CPU Mhz can change depending on system load). I think the benefit of this over the gnome system monitor is that when the gnome monitor is closed no CPU activity is recorded. Mine allows you to change the graph range and rewind through history. It also uses very little resources when it's not being displayed. Oh and it's easier to open/close (through a global hotkey). -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] External SIGSEGV (random) when assigning TBookmark
El 01/11/15 a las 09:25, Leonardo M. Ramé escribió: Hi, I don't use data aware controls too often, but as I'm updating a legacy application I have to use them. ... I finally solved this by getting the value of a primary key, then after TSQLQuery.refresh I do a locate for that key, works like a charm. What I don't get is what's the purpouse of TBookmark, I thought it was made for solving the problem I had. Leonardo. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus implementation of TListView etc?
On Mon, 02 Nov 2015 10:24:54 +0100, Michael Schnell wrote: >On 10/31/2015 07:28 PM, Mark Morgan Lloyd wrote: >> Alternatively look at the lnet code that comes with FPC, ... > >IMHO using lnet or Synapse would be a lot "clearer" than using the >overly complex Indy Library. I had already looked at Synapse, but it is blocking. I did not know about lnet (or INet as it is shown when one searches) before but now I have had a look and it seems to fit the bill for me since it is event oriented, like I need for this particular task. Thanks for pointing me in this direction! I am now examining all the files and figuring out what to put into the RPi2 file system. THen I will make some tests with this before I go on threading Indy. BTW: this thread has totally changed content from when it started, the subject is not really valid anymore. So if I need some more input I will create a more appropriate new thread (hmmm, a thread about threads)... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] External SIGSEGV (random) when assigning TBookmark
2015-11-01 13:06 GMT-03:00 Luca Olivetti : > El 01/11/15 a les 13:25, Leonardo M. Ramé ha escrit: > > To me, the code looks correct, but I'm getting a SIGSEGV while assigning >> the bookmark. I must add the error only happens the 2nd or 3rd time this >> method is called: >> > > I suppose that's because the bookmark is only valid while the query is > opened, buy you close it between getting the bookmark and setting it. > > Yes. In TBufDataset, the bookmark references the internal buffer memory. As soon dataset is closed, the memory may change Luiz > Bye > -- > Luca Olivetti > Wetron Automation Technology http://www.wetron.es/ > Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 > > > -- > ___ > Lazarus mailing list > Lazarus@lists.lazarus.freepascal.org > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] How to get real width of grid columns?
Hi All, I want to save and load state(width,visibility,...) of columns. My problem is Width property give back 0 value from invisible columns. FWidth contains the real value. How to access the value? From my POV this is a bug, column width and visibility is two different things. Gabor -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus implementation of TListView etc?
On 11/02/2015 10:21 AM, Michael Schnell wrote: or PostMessage (with a Mainthread Object featuring "Procedure message" ) Maybe I was wrong here this mechanism might use a different mechanism (which supposedly will not work at all without a GUI). -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Increasingly frustrated with DbGrids
On Mon, 2 Nov 2015 13:02:14 +0100 Luca Olivetti wrote: >[...] > > The IDE does not know about your new class. > > You need to unregister the old and register the new. > > it doesn't matter: the ide uses the old class, but the unit (and the > grid) will see the new one. > It's a hack, really, which will probably bite me in the rear somewhere > in the future, but I have to ship the programme now :-( Your 'hack' is totally fine, if you know about it. I merely wanted to point out that 'TComboBox = class(stdctrls.TComboBox)' is not a 'hack' and has no special effect. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Increasingly frustrated with DbGrids
El 02/11/15 a les 12:36, Mattias Gaertner ha escrit: On Mon, 2 Nov 2015 10:52:25 + Tony Whyman wrote: Ah, but then you can't edit it in the IDE. The IDE does not know about your new class. You need to unregister the old and register the new. it doesn't matter: the ide uses the old class, but the unit (and the grid) will see the new one. It's a hack, really, which will probably bite me in the rear somewhere in the future, but I have to ship the programme now :-( Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] External SIGSEGV (random) when assigning TBookmark
On Sun, 1 Nov 2015 17:06:18 +0100, Luca Olivetti wrote: > El 01/11/15 a les 13:25, Leonardo M. Ramé ha escrit: > >> To me, the code looks correct, but I'm getting a SIGSEGV while assigning >> the bookmark. I must add the error only happens the 2nd or 3rd time this >> method is called: > > I suppose that's because the bookmark is only valid while the query is > opened, buy you close it between getting the bookmark and setting it. > Also: in my experience in Delphi closing with DisableControls active is a bad idea. I have seen cases, when components are still referencing old field instances. -- Virgo Pärna virgo.pa...@mail.ee -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Increasingly frustrated with DbGrids
On Mon, 2 Nov 2015 10:52:25 + Tony Whyman wrote: > Ah, but then you can't edit it in the IDE. The IDE does not know about your new class. You need to unregister the old and register the new. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Increasingly frustrated with DbGrids
El 02/11/15 a les 11:24, Tony Whyman ha escrit: Luca, Intercept classes are a very useful technique for overcoming this problem. I recently wanted to have a specialised TComboBox as a TStringGrid Editor and defined an intercept class for this as: Yes, I used similar hacks in the past (just last week I asked here how to remove the border in a TPageControl), and I'll probably follow your advice here, still, I think that if the TDbGrid allows for a custom editor, it should work without this kind of hack. Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Increasingly frustrated with DbGrids
El 02/11/15 a les 11:12, Luca Olivetti ha escrit: Hello, I constantly stumble with the behaviour of the TDBGrid. I understand that it's a complex component, but every time I find an issue an Luiz fixes it, two more pop up (or an older one resurfaces). The latest episode of the saga is the futility of using a custom editor (with OnSelectEditor), since the grids then sets the value of the field using this snippet of code if (FEditor<>nil) and FEditor.Visible then begin Msg.LclMsg.msg:=GM_GETVALUE; Msg.grid:=Self; Msg.Col:=FCol; Msg.Row:=FRow; Msg.Value:=GetCells(FCol, FRow); FEditor.Dispatch(Msg); SetEditText(Msg.Col, Msg.Row, Msg.Value); end; and this only works with the editors defined in Grids.pas, the only ones managing the GM_GETVALUE message. For other kinds of editors the result depends on how you move in the grid: it could either maintain the value the editor set or reset it to an empty string. I think I will file a bug once I can create a simple project, but in the meantime if somebody has an idea on how to solve it, it would be appreciated. Bug created: http://bugs.freepascal.org/view.php?id=28944 Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Increasingly frustrated with DbGrids
Ah, but then you can't edit it in the IDE. OK, intercept classes are a quick and dirty way of avoiding defining a new component - but as long as you are willing to "hold your nose", they do a useful job. On 02/11/15 10:49, Mattias Gaertner wrote: Reintroducing 'TComboBox' can confuse users of your code and has no benefit for grids. This should work as well: TMyComboBox = class(TComboBox) -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Increasingly frustrated with DbGrids
On Mon, 2 Nov 2015 10:24:20 + Tony Whyman wrote: >[...] > Intercept classes are a very useful technique for overcoming this > problem. I recently wanted to have a specialised TComboBox as a > TStringGrid Editor and defined an intercept class for this as: > > TComboBox = class(stdctrls.TComboBox) Reintroducing 'TComboBox' can confuse users of your code and has no benefit for grids. This should work as well: TMyComboBox = class(TComboBox) Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Increasingly frustrated with DbGrids
Luca, Intercept classes are a very useful technique for overcoming this problem. I recently wanted to have a specialised TComboBox as a TStringGrid Editor and defined an intercept class for this as: TComboBox = class(stdctrls.TComboBox) private FGrid: TCustomGrid; FCol,FRow: Integer; protected procedure WndProc(var TheMessage : TLMessage); override; procedure CloseUp; override; procedure KeyDown(var Key : Word; Shift : TShiftState); override; procedure Loaded; override; procedure msg_GetValue(var Msg: TGridMessage); message GM_GETVALUE; procedure msg_SetGrid(var Msg: TGridMessage); message GM_SETGRID; procedure msg_SetValue(var Msg: TGridMessage); message GM_SETVALUE; procedure msg_SetPos(var Msg: TGridMessage); message GM_SETPOS; procedure msg_GetGrid(var Msg: TGridMessage); message GM_GETGRID; public procedure EditingDone; override; property BorderStyle; property OnEditingDone; end; The result was a specialist editor for the stringgrid (and which handles TGridMessage) but which could be placed on the form and edited as a TComboBox.The TStringFrid "OnSelectEditor " event is then used to return the combobox as an editor. Intercept classes can be used to customise just about any component. Just ensure that your intercept class is defined after the parent class. Tony Whyman MWA On 02/11/15 10:12, Luca Olivetti wrote: Hello, I constantly stumble with the behaviour of the TDBGrid. I understand that it's a complex component, but every time I find an issue an Luiz fixes it, two more pop up (or an older one resurfaces). The latest episode of the saga is the futility of using a custom editor (with OnSelectEditor), since the grids then sets the value of the field using this snippet of code if (FEditor<>nil) and FEditor.Visible then begin Msg.LclMsg.msg:=GM_GETVALUE; Msg.grid:=Self; Msg.Col:=FCol; Msg.Row:=FRow; Msg.Value:=GetCells(FCol, FRow); FEditor.Dispatch(Msg); SetEditText(Msg.Col, Msg.Row, Msg.Value); end; and this only works with the editors defined in Grids.pas, the only ones managing the GM_GETVALUE message. For other kinds of editors the result depends on how you move in the grid: it could either maintain the value the editor set or reset it to an empty string. I think I will file a bug once I can create a simple project, but in the meantime if somebody has an idea on how to solve it, it would be appreciated. Oh, and a custom editor has no way of adapting if the dbgrid is scrolled, a column is resized, etc. Again, this only work for the editors defined in Grids.pas. Bye -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Increasingly frustrated with DbGrids
Hello, I constantly stumble with the behaviour of the TDBGrid. I understand that it's a complex component, but every time I find an issue an Luiz fixes it, two more pop up (or an older one resurfaces). The latest episode of the saga is the futility of using a custom editor (with OnSelectEditor), since the grids then sets the value of the field using this snippet of code if (FEditor<>nil) and FEditor.Visible then begin Msg.LclMsg.msg:=GM_GETVALUE; Msg.grid:=Self; Msg.Col:=FCol; Msg.Row:=FRow; Msg.Value:=GetCells(FCol, FRow); FEditor.Dispatch(Msg); SetEditText(Msg.Col, Msg.Row, Msg.Value); end; and this only works with the editors defined in Grids.pas, the only ones managing the GM_GETVALUE message. For other kinds of editors the result depends on how you move in the grid: it could either maintain the value the editor set or reset it to an empty string. I think I will file a bug once I can create a simple project, but in the meantime if somebody has an idea on how to solve it, it would be appreciated. Oh, and a custom editor has no way of adapting if the dbgrid is scrolled, a column is resized, etc. Again, this only work for the editors defined in Grids.pas. Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus implementation of TListView etc?
On 10/31/2015 07:28 PM, Mark Morgan Lloyd wrote: Alternatively look at the lnet code that comes with FPC, ... IMHO using lnet or Synapse would be a lot "clearer" than using the overly complex Indy Library. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus implementation of TListView etc?
On 10/31/2015 06:47 PM, Bo Berglund wrote: Should I add this back now that CheckSynchronize seems to have cured a few "shortcomings"? Only with "CheckSynchronize" your thread can use TThread.Synchronize, TThread.Queue or PostMessage (with a Mainthread Object featuring "Procedure message" ) I don't know if Indy uses some of those. But if it does "CheckSynchronize" is a must. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus implementation of TListView etc?
On 10/31/2015 01:07 PM, Bo Berglund wrote: I had hoped that while executing sleep() statements the main thread would yield to the TCP thread but it seems like it does not... Sleep() indeed puts the running (main) thread to sleep and allows for other threads to run in the mean time. The problem with sleep is not that it would not work as expected, but that it increases the latency. It your Thread fires main thread events (that later are called by "CheckSynchronize()"), with sleep they are not executed immediately (as one would desire) but only with a latency of (up to) the sleeping time. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus implementation of TListView etc?
On 10/31/2015 12:13 AM, Bo Berglund wrote: Bo's precise problem is that he does not want to restructure his code. . And I hesitate to ask more questions here because I feel I am getting flamed for not getting how it should be done. :( I never intended to flame you. On the contrary I am fully with you, as I since years intended to provide a toolbox that allows to easily (i.e. without changing the user code) convert Delphi projects to headless Linux gadgets. Unfortunately this is not as easy as it might be desirable :) -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus