Re: [Lazarus] File sync system approach
On 29.07.2015 12:37 carra, Aradeonas wrote: Ok.Now I want to work on file sync part and for that I need to choose a library.Indy,Synapse or ... . What you guys prefer in this case?Synapse is easy to use and I like it but Indy seems larger and more powerful but I didn't work with it. For this case that I need to send and receive files in threads with multi connections it seems I need TCP and there are demos but I want the project stable and no need to rewrite it and maybe there will be need to some p2p connections so I probably I will need to write many things myself and this is not a problem but I want to ask you what library is better in your experience and is there any demos for them in these case or not? Regards, Ara Hi Ara. I'm working with Indy since a long time (Delphi). I've already done such a sync between systems and Lazarus using a multi-threaded approach and mixing platforms like Linux x86, Linux x86_64, Win32, Win64 and WinCE. Indy works on all those platforms, at least, the basic components (WinCE is the smallest one and everything is not implemented). Anyway all this works in Indy way, using synchronous sockets and threads. It uses blocks as well as streams. Because server sockets work in a separated thread per connection, work is easy (just think processinf a sequential file). I agree on that synapse looks easier and it is easier actually. But because I'm used to Indy since years I always use it when TCP/IP connections are needed (ICMP too) just because I can control every step and I can set and control lots of timeouts. Unfortunately I cannot show any sample because all library is owned by my previous employer. But it works very well. Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] systemd
Le 27/06/2015 13:47, A. Fortuny a écrit : Hi Folks. Currently I have some services running in a linux box (OpenSuse 11.2) and they will be moved to an OpenSuse 13.2. I want to move the services from SysV to systemd. I noticed that in the service configuration file (namely /usr/lin/systemd/system/MyService.service) there are some options wich bother me a little bit. The services are programs written using Lazarus and its service framework. Please note that the services run either on Windows or on Linux (some $ifdef help). I wonder what happens on two points: 1. the new service type parameter TYPE in section [Service] should be simple I guess 2. the parameter TimeoutStartSec bothers me. As in the sefvice framework developed using Lazarus units (service project), the program is started by the INIT script in /etc/init.d with the -r runtime switch. The program then responds to the start event of the Daemon unit wich, in turn, starts the main thread and the called start procedure exits as soon as posible. The program keeps running until the exit signal is fired and the main thread is stopped. If it is by the means of the INIT script (service MyService stop) the process is killed either soft or hard. The question is: does a service written in this new method still needs the Lazarus service framework ? What is the signal sent to systemd wich informs it that the sevice has started (read man systemd.service (5) )? The same mechanism as the Lazarus service framework still applies ? I'm not yet ready to use either D-BUS messaging system nor socket based systemd start service mechanism. Thank you for any information. Antonio. Hi All. After a reading thru all documentation spread over there I succeeded to port an Initd service to the new systemd.. Both questions above got their answer: 1. simple is the right type 2. I didn't enven specify avy time out. The most important lesson learned is that the service program written using Lazarus and Fpc does not require ANY change. It woks as is provided that the launch command includes the -r parameter. systemctl enable MyService: OK systemctl start MyService: OK systemctl stop MyService: OK Service file in /etc/systemd/system with minimal options reboot the linux box and the service has been properly stopped and restarted after booting again. Nice and clear, thanks to all Antonio. --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] systemd
Hi Folks. Currently I have some services running in a linux box (OpenSuse 11.2) and they will be moved to an OpenSuse 13.2. I want to move the services from SysV to systemd. I noticed that in the service configuration file (namely /usr/lin/systemd/system/MyService.service) there are some options wich bother me a little bit. The services are programs written using Lazarus and its service framework. Please note that the services run either on Windows or on Linux (some $ifdef help). I wonder what happens on two points: 1. the new service type parameter TYPE in section [Service] should be simple I guess 2. the parameter TimeoutStartSec bothers me. As in the sefvice framework developed using Lazarus units (service project), the program is started by the INIT script in /etc/init.d with the -r runtime switch. The program then responds to the start event of the Daemon unit wich, in turn, starts the main thread and the called start procedure exits as soon as posible. The program keeps running until the exit signal is fired and the main thread is stopped. If it is by the means of the INIT script (service MyService stop) the process is killed either soft or hard. The question is: does a service written in this new method still needs the Lazarus service framework ? What is the signal sent to systemd wich informs it that the sevice has started (read man systemd.service (5) )? The same mechanism as the Lazarus service framework still applies ? I'm not yet ready to use either D-BUS messaging system nor socket based systemd start service mechanism. Thank you for any information. Antonio. --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Windows CE
Le 22/05/2015 08:59, Koenraad Lelong a écrit : Hi, I could be able to purchase a number of second hand intelligent barcode scanners. I have project in mind where I could use such devices. The scanners run Windows CE 5. Is it possible and advisable to develop for these devices using Lazarus ? I know Lazarus has support for Windows CE, but at the moment I don't find which versions are supported. Hi Koenraad. No problem at all. I've been busy until last year with Lazarus and LCL on a Vista workstation, 32bit compiler, cross compiler WinCE. Even Indy 10 compiled (somes little changes though) worked fine. Hardware was hand held computers from Symbol technologies wich became Motorola some time ago. HW MC900 range (Pocket PC) PPT 8800 series (WinCE) All hw equipment was accessible by the means of some specialised DLL's. Antonio. Thanks, Koenraad. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] (no subject)
Le 5/05/2015 22:41, Xirax Xirax a écrit : Hello, Any one know who can I talk about Lazarus graphical interface like logo,splash screen and so on? Hi Guys (not seeing girls over there) After a reading across this post, I wonder how much relevant is, for Lazarus users like me, Xirax Xirax proposal. To be honest I must write that I'm 64 and I know Lazarus and use it for more than 5 years. I also know Delphi from the very first version 1.0 on Windos 3.1 (do some of you remeber what it was ?). As a Lazarus user, I'm absolutely happy on the job the team has achieved so far. As a developer (but non in Lazarus) I like that an IDE gives me as much help as possible to implement the best solution to a given problem. I do not care at all whether the splash screen is either red or grey or maybe the icon representing a component is blue or dark yellow, as long as I SEE that icon at the same place across all new releases. Lazarus and Delphi achieved the same goal. This is, for instance, one of my major blames against Micro$oft. On every new release I've to loose time just to find where those crazy people disguise the well known function in previous version. That's also the major reason why I love Linux. I use the same Linux dialect for almost 10 years and nothing changed (except new features) neither in install process nor in the graphical interface (OpenSuse Xfce). I'm not interested on what the GUI looks like as far as it works fine. Being a Linus and a Wind$ws user and developer, I highly apreciate how close the IDEs are in Linux and Windo$ws. This is also highly productive. Xirax Xirax proposal could maybe lead to have a nice GUI for the IDE: useless for me and development time lost. As a developer I prefer to focus on efficiency rather than on beauty. The last needs guys (or girls) having some artistic skills. I have none. Thanks to you all guys. Antonio. --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Filling ListBox without triggering OnSelectionChange
Le 7/01/2015 07:49, Marc Santhoff a écrit : Hi, it has been a very long time since I've programmed GUIs. I have forgotten how to fill a ListBox without having the event handler OnSelectionChange executed. I've had the same problem for years, until I invented my method: - fill in the two events OnEnter and OnExit for the control - generate the code for the OnSelectionChange event and drop immediately the event in the component explorer - manually fill in the following code in the three envents: TMyForm.MyComponentEnter(Sender: TObject); begin MyComponent.OnSelectionChange := MyComponentSelectionChange; // do the same for all other events you want to drive end TMyForm.MyComponentSlectionChange(Sender: TObject; ...); begin // do whatver to do when the event fires end TMyForm.MyComponentExit(Sender: TObject); begin MyComponent.OnSelectionChange := nil end Of course you can control any firing event using the OnEnter and OnExit events of the control. This allows the program to fire events only when the user enters the control. I think that GUI's lack a control property wich indicates whether the events should always fire or fire only when the user enters the control. Antonio. I have tried (Un)LockSelectionChange on the list, setting ItemIndex to -1, all in the forms create method. I've tried using add() or assign() on the listbox's Items, nothing helps. The wiki on TListBox doesn't say anything on this topic, neither does the LCL help document. How can it be done? --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Indy 10
Le 29/12/2014 11:26, Juha Manninen a écrit : What is the recommended link to download Indy 10 for lazarus? The wiki : http://wiki.freepascal.org/Indy_with_Lazarus#Downloads_.2F_Links tells to use Indy 10 website : http://www.indyproject.org/index.en.aspx This link works and the zip file looks ok. link cid:part1.02030700.07020805@gmail.com Antonio. BTW, happy new year 2015 to all of you which is messy. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Handling Firebird connection
Le [...] 25/08/2014 12:13, Richard Mace a écrit : Hi Antonia, This sequence does not protect against the server disconnection between two consecutive database calls. Would you mind giving me an example of this? What I mean is that the physical TCP/IP connection between the aplication (the client) and the firebird server is not systematically tested on every function call to the library accessing the firebirs server. If you assume the following sequence of operations: MySql.Database := MyDatabase; [...] MyDatabase.Connect; (1) Mysql.Sql.text := 'select any from thedatabase'; MyTransaction.StartTransaction; (2) Mysql.Open: (3) while Mysql.EOF = False do begin // do whatever to do with database records Mysql.Next (4) end; (5) Mysql.close; (6) MyTransaction.Commit; (7) MyDatabase.Connected := False; After each statement noted (1) thru (7) the TCP/IP link initiated by the MyDatabase.Connect can be broken anywhere betwenn (1) and (7) unless you code something to test it. This can be any function looking something like a: telnet host_name(or IP address) 3050 (or whatever firebird port is used in host) issued in in a command line. In a Lazarus program you would need something like Indy ping component (any other is also OK) wich will test the firebird server awakeness. Its is really a heavy workloa anyway. I usually keep going with my former exemple. When the server connection is critical I fill in the except part some code to figure out witch is the failing part using either the exception code or the exception text itself. I can also specialize the different exception sources using the On MyException:Exception do In the top example of code I'll insert try..except's (or finally's if I don't care about exceptions) around the critical places I can't miss. But this depends on the application as well Antonio. Thanks Richard -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Problem rounding values at post
Le 3/06/2014 22:39, Daniel Erles a écrit : Hello. I have this problem: My database (Firebird) has a table with the following fields: ... rTitle DECIMAL(8,4) not null, rDiameter DECIMAL(10,6) not null, ... In my program I have a Form with a a TZTable object (ZEOS) called zData, bound to that table. In a routine I have the following code: zData.Insert; ... zData.FieldByName('rTitle').AsFloat := 0.12; zData.FieldByName('rDiameter').AsFloat := 0.12; ... zData.Post; Then, at the table, I see that the values are stored as follows: rTitle = *0.1199* rDiameter = 0.12 Do not know why rTitle is 0.1199 instead of 0.12 I need the saved values are accurate. I've tried AsFloat, AsCurrency, Value, always with the same result. Any idea? Tks. Daniel. Well it's not easy indeed. In the case of Firebird (it's salso my case) you have to take into account the sql dialect which makes a big difference when interfacing numeric values. With sql dialect 1 all numeric (and decimal) types are output as binary floating point (sirgle or double dependgng on column precision) figures. In sql dialect 3 decimal, numeric, money and dates are output as integer values ranging from single byte to int64 with all integer values in between, all depending on database presions (dates are always output as int64). This means that there are always fixed implied decimal positions. Have a look in http://ibexpert.net/ibe/index.php?n=Doc.SQLDialect . There are some other differences as well. On the other side with Lazarus (even Delphi) the recipent containers are always double or extended depending on the interface used, leading to TFloatField definitions anyway. Sometimes a TBCDField is implemented. In all this stuff I've been used to use the math function RoundTo as the number of decimals is always known (think on accounting computations, invoicing, etc.).. As a matter of fact, In my developments I always use sql dialect 3 in the database along with numeric or decimal types when decimals are needed (read http://www.firebirdfaq.org/faq340/), extended type in Lazarus and Delphi variables and RoundTo (where applicable) for intermediate results. There is also a subtle difference in rounding whether you use bank figures or acconting figures. But that is another story Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] root privileg
Hi Folks. How to gain temporarily root privileges in a pascal program ? I need to 'ping' an IP address and for ping to work (Indy 10) I need to be root. Usage of another TCP component is not an option. Another way is to execute a shell and intertpret the results but I'd to avoid it if possible. It is on Linux system. Thanks --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] root privileg
Le 4/06/2014 17:01, Reinier Olislagers a écrit : On 04/06/2014 16:54, Michael Van Canneyt wrote: On Wed, 4 Jun 2014, A. Fortuny wrote: How to gain temporarily root privileges in a pascal program ? I need to 'ping' an IP address and for ping to work (Indy 10) I need to be root. Why do you need root to ping? You could set up sudo to allow The program I intend to make will be developed as a service pinging on a regular basis remote stations just to see if they are alive. The way that Indy implements ICMP protocol means that pinger socket is available only under root permission. The same test programs which fails under normal user succeeds under root. This is clearly stated in Indy FAQ. Read http://www.indyproject.org/KB/ for this subject and associated questions. Antonio. regular/specific users to ping; perhaps there's something with this new-fangled capabilities thing etc. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] service launch
Le 2/06/2014 16:42, Michael Van Canneyt a écrit : On Mon, 2 Jun 2014, A. Fortuny wrote: Hi Folks. OpenSuse 12.2 Based on the /etc/init.d/skeleton I've made a new service script named service.test replacing all what is needed (binary name, conf file, etc.) When i launch it (using: # service service.test start) it fails to launch. The /var/log/messages displays: Jun 2 11:50:02 aforsrv service.test[26037]: Starting Service test Usage: /home/data2/sources/compiled/service.bin [command] Jun 2 11:50:02 aforsrv service.test[26037]: Where command is one of the following: Jun 2 11:50:02 aforsrv service.test[26037]: -i --install To install the program as a service Jun 2 11:50:02 aforsrv service.test[26037]: -u --uninstall To uninstall the service Jun 2 11:50:02 aforsrv service.test[26037]: -r --run To run the service Jun 2 11:50:02 aforsrv service.test[26037]: An unhandled exception occurred at $0046E48A : Jun 2 11:50:02 aforsrv service.test[26037]: EInOutError : Jun 2 11:50:02 aforsrv service.test[26037]: $0046E48A Jun 2 11:50:02 aforsrv service.test[26037]: $00497C43 line 233 of ../lib/simplelogger.pas Jun 2 11:50:02 aforsrv service.test[26037]: $00473316 line 48 of DaemonMapper.pas Jun 2 11:50:02 aforsrv service.test[26037]: $00471C27 Jun 2 11:50:02 aforsrv startproc: startproc: exit status of parent of /home/data2/sources/compiled/service.bin: 217 Jun 2 11:50:02 aforsrv service.test[26037]: ..failed Jun 2 11:50:02 aforsrv systemd[1]: service.test.service: control process exited, code=exited status=7 Jun 2 11:50:02 aforsrv systemd[1]: Unit service.test.service entered failed state. The program itself is written in FPC using Lazarus and when launched on its own it runs perfectly well: # ./service.bin -r ( the -r parameter tells the program to run as a service). Log file is present and readable, SIGHUP and SIGTERM are trapped and recorded. Everythning runs as expected, the service script excepted. Any ideas ? Does your script add the -r option when running the service ? Yesy it does. AT the same time I have to apologize. After re-creating the service script from the original /etc/init.d/skeleton, - changing the first line as a /bin/bash script - adapt the comments in the INIT INFO about the service name - change the service binary program - change the conf file name - add the -r to the launching of the service binary file everything runs OK; I did forget to register the service (chkconfig) and to reload (systemctl --system daemon-reload) Sorry for the annoyance and thanks anyway. Antonio. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] service launch
Hi Folks. OpenSuse 12.2 Based on the /etc/init.d/skeleton I've made a new service script named service.test replacing all what is needed (binary name, conf file, etc.) When i launch it (using: # service service.test start) it fails to launch. The /var/log/messages displays: Jun 2 11:50:02 aforsrv service.test[26037]: Starting Service test Usage: /home/data2/sources/compiled/service.bin [command] Jun 2 11:50:02 aforsrv service.test[26037]: Where command is one of the following: Jun 2 11:50:02 aforsrv service.test[26037]: -i --install To install the program as a service Jun 2 11:50:02 aforsrv service.test[26037]: -u --uninstall To uninstall the service Jun 2 11:50:02 aforsrv service.test[26037]: -r --run To run the service Jun 2 11:50:02 aforsrv service.test[26037]: An unhandled exception occurred at $0046E48A : Jun 2 11:50:02 aforsrv service.test[26037]: EInOutError : Jun 2 11:50:02 aforsrv service.test[26037]: $0046E48A Jun 2 11:50:02 aforsrv service.test[26037]: $00497C43 line 233 of ../lib/simplelogger.pas Jun 2 11:50:02 aforsrv service.test[26037]: $00473316 line 48 of DaemonMapper.pas Jun 2 11:50:02 aforsrv service.test[26037]: $00471C27 Jun 2 11:50:02 aforsrv startproc: startproc: exit status of parent of /home/data2/sources/compiled/service.bin: 217 Jun 2 11:50:02 aforsrv service.test[26037]: ..failed Jun 2 11:50:02 aforsrv systemd[1]: service.test.service: control process exited, code=exited status=7 Jun 2 11:50:02 aforsrv systemd[1]: Unit service.test.service entered failed state. The program itself is written in FPC using Lazarus and when launched on its own it runs perfectly well: # ./service.bin -r ( the -r parameter tells the program to run as a service). Log file is present and readable, SIGHUP and SIGTERM are trapped and recorded. Everythning runs as expected, the service script excepted. Any ideas ? Thanks in advance, Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Lazarus 1.2
Hi FOlks. I'm testing Lazarus 1.2 on a W7 64bit with cross compilation for Win64 and WinCE as Lazarus is Win32. All three downloaded and installed without problems With a little project, no problems at all, it compiles and runs on all three platforms. So far so good. Now, real projects but packages first: they compile on all platforms and more specifically Indy 10.6.0.1 two projects copied from a Win32 Lazarus 1.0.12 (current production on 2 different platforms one for Win32+WinCE and a second for Win64): On production: compile and run everywhere. This my current production environment Now copy both projects to Lazarus 1.2 machine: project one compiles with Indy on Win32 and Win64 (WinCE is not an option for this project) only adapting the compiler search path - including the Indy package in the required packages fails to find any Indy unit - including the Indy lib in the complier search pat and removing the package name compiles nicely (!!??) project two: (has to run on all three platforms) compilation for Win32 (the 2 other platforms not yet testes) fails with error ...\..\..\..\Lib\uservertcpconnect2.pas(9,3) Fatal: Can't find unit IdTCPClient used by uservertcpconnect2 The unit uservertcpconnect2 is referenced in both projects and .o and ..ppu are in the Indy lib folder and only once in the machine - Naming Indy in the required packages changes nothing - including the Indy lib in the complier search path does not solve the problem neither. I've made a little test project having nothing but a close button. The previous uni is included, - add Indy lib into compiler search path - add the unit in the uses clause The project compiles and runs OK Where could the difference be located ? Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus 1.2
Le 20/03/2014 12:14, Antonio Fortuny a écrit : Hi FOlks. I'm testing Lazarus 1.2 on a W7 64bit with cross compilation for Win64 and WinCE as Lazarus is Win32. All three downloaded and installed without problems With a little project, no problems at all, it compiles and runs on all three platforms. So far so good. Now, real projects but packages first: they compile on all platforms and more specifically Indy 10.6.0.1 two projects copied from a Win32 Lazarus 1.0.12 (current production on 2 different platforms one for Win32+WinCE and a second for Win64): On production: compile and run everywhere. This my current production environment Now copy both projects to Lazarus 1.2 machine: project one compiles with Indy on Win32 and Win64 (WinCE is not an option for this project) only adapting the compiler search path - including the Indy package in the required packages fails to find any Indy unit - including the Indy lib in the complier search pat and removing the package name compiles nicely (!!??) project two: (has to run on all three platforms) compilation for Win32 (the 2 other platforms not yet testes) fails with error ...\..\..\..\Lib\uservertcpconnect2.pas(9,3) Fatal: Can't find unit IdTCPClient used by uservertcpconnect2 The unit uservertcpconnect2 is referenced in both projects and .o and ..ppu are in the Indy lib folder and only once in the machine - Naming Indy in the required packages changes nothing - including the Indy lib in the complier search path does not solve the problem neither. I've made a little test project having nothing but a close button. The previous uni is included, - add Indy lib into compiler search path - add the unit in the uses clause The project compiles and runs OK Where could the difference be located ? Found a workaroud: - make a new application -- adjust search path and all options to what they must be - add in the project uses clause the problematic unit - compile (it workd) - add all needed packages except Indy - add all units of the project in the new project - add all necessary CreateForm (copy paste from original project - make the rest of the project unit identical to the original one - complie: works nicely for Win32 - run: runs nicely as well 8-) I'll make a try with Win64 and WinCE. I'll let you know what happens Antonio. Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus 1.2
Thanks again Mattias. Forget about all trouble. In fact it was a very tiny typing error in the compiler search path revealed by the -vut but invisible otherwise. This solved the problem. 8-) Remaking the project worked too, but it is longer. :-[ This false problem apart, all three platforms produce executables which work in all three platforms. Really nice. Very good job done guys, congratulations. I'm impressed. Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] linux linking
Hi Folks. I've ported a console project from win32 to Linux x86_64, Lazarus 1.0.12 On win32 it compiles and runs OK. On Linux, compilation fails with a linker error: Error: Error while linking and nothing else. Any track to follow ? Is it any way to display more diagnostics ? Thanks, Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] linux linking (Solved)
Le 18/03/2014 14:09, Antonio Fortuny a écrit : Hi Folks. I've ported a console project from win32 to Linux x86_64, Lazarus 1.0.12 On win32 it compiles and runs OK. On Linux, compilation fails with a linker error: Error: Error while linking and nothing else. Any track to follow ? Is it any way to display more diagnostics ? Units missing. Thanks, Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] linux linking (Solved)
Le 18/03/2014 16:38, Fabio Luis Girardi a écrit : Units missing? Which units? ideintfpackage and LCLIntf unit. This solved the compilation error. 2014-03-18 12:23 GMT-03:00 Antonio Fortuny a.fort...@sitasoftware.lu mailto:a.fort...@sitasoftware.lu: Le 18/03/2014 14:09, Antonio Fortuny a écrit : Hi Folks. I've ported a console project from win32 to Linux x86_64, Lazarus 1.0.12 On win32 it compiles and runs OK. On Linux, compilation fails with a linker error: Error: Error while linking and nothing else. Any track to follow ? Is it any way to display more diagnostics ? Units missing. Thanks, Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org mailto:Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org mailto:Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus Wiki
Le 20/01/2014 16:06, Antonio Fortuny a écrit : Hi Folks. I need some help (only once) on how to make a new topic in the Lazarus wiki and link it to whatever page sounds the best to be its ancestor. This concerns a new object I made (TFPTimer based, thread safe and thread independant). I'll embed it into a native Lazarus conventional package and publish some help and hints on howto use the component (and maintaing the pages whenever the component behaviour changes, of course. I'm (almost) natively a french speaker but I can accomodate with English as well which means that I can cope with both languages and their respective wiki pages. That's why I definitely prefer to let someone of you, guys, to choose for me the most relevant page to include the start point of the component page and tell me in a few words how to start. Of course, having a page template would be nice too. Like Lazarus, you know, tell me once and I'll do it as many times as required 8-) BTW, I already have access to modify wiki pages: looks very easy as every page has a Modify tab. Sorry to come back to t his thread but I'm still suck on how to create a new page in the Lazarus Wiki. Nothing found on help on how to create a new page. As soon as it creataed to link it to another page sounds easy. To fill the page, add files, etc., is a piece of cake. Antonio. Thanks, Antonio. http://www.avast.com/ Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection Antivirus avast! http://www.avast.com/ est active. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus Wiki
Le 14/03/2014 13:26, Reinier Olislagers a écrit : On 14/03/2014 12:57, Antonio Fortuny wrote: Le 20/01/2014 16:06, Antonio Fortuny a écrit : Sorry to come back to t his thread but I'm still suck on how to create a new page in the Lazarus Wiki. Nothing found on help on how to create a new page. Have you seen my answer to your original post? Yes Reinier I did. But I'll have to admit that I'm a little bit tired (maybe some more than a little bit ?) O:-) I apologize anyway. Page created http://wiki.lazarus.freepascal.org/Components_and_Code_examples, System, Yet another Running Timer http://wiki.lazarus.freepascal.org/index.php?title=Yet_another_Running_Timeraction=editredlink=1 Thanks, Antonio. If you search for a page on the wiki whose title does not yet exist, you are prompted if you want to create a page with that title which apparently is the way to create new wiki pages (it works, but it took me some getting used to). -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus Wiki
Le 14/03/2014 14:46, Dmitry Boyarintsev a écrit : On Fri, Mar 14, 2014 at 9:14 AM, Reinier Olislagers reinierolislag...@gmail.com mailto:reinierolislag...@gmail.com wrote: Be my guest ;) Here you go: http://postimg.org/image/5z642myqh/ Definitely yes !! This a damned good path explained 8-) , just a little too late for me :-D , as I did find the same way on my own following Reinier's advice Anyway I do really appreciate Dmitry, thanks. I believe that this page should be somewhere in the FPC-Lazarus wiki at the very beginning with as big as possible capital letters for the next newbees. Antonio. Antonio, hope that helps -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus Wiki
Hi all. I would like to thank you all for your help to solve this silly problem. My first real contribution to this very exciting project is on the way. The first page is on http://wiki.lazarus.freepascal.org/Yet_another_Running_Timer It is still under development, so be patient. Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Package
Le 10/03/2014 18:20, Mattias Gaertner a écrit : if Elapsed 5000 then Break; Inc(Elapsed, 50) end; FreeAndNil(FTH); end; inherited; This solves part of the problem. Thanks Mattias. :-) It was to obvious that I guess I was on another planet whent thinking on the problem. Now I still have the problem in the IDE: - dropping the non visual component on a form is OK - running the program with that component dynamically created is OK - when deleting the component from the form, in the IDE, Lazarus crashes with an access violation exception Antonio. end; Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Package
Le 11/03/2014 13:12, Mattias Gaertner a écrit : On Tue, 11 Mar 2014 08:37:14 +0100 Antonio Fortuny a.fort...@sitasoftware.lu wrote: Le 10/03/2014 18:20, Mattias Gaertner a écrit : if Elapsed 5000 then Break; Inc(Elapsed, 50) end; FreeAndNil(FTH); end; inherited; This solves part of the problem. Thanks Mattias. :-) It was to obvious that I guess I was on another planet whent thinking on the problem. Now I still have the problem in the IDE: - dropping the non visual component on a form is OK - running the program with that component dynamically created is OK - when deleting the component from the form, in the IDE, Lazarus crashes with an access violation exception BTW, why does your component start a thread at design time? Yep ! Mattias you are my muse :-D After a careful reading of the code it appears that the internal thread created had this line in the constructor. FreeOnTerminate := True; Aaargh ! :-[ So simple, so obvious, so easy and I missed it. Is was on another planet, defintely. Not it all runs nicely. Thanks, Antonio. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- Antonio Fortuny Senior Software engineer 220, avenue de la Liberté L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection Antivirus avast! est active. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Package
Le 11/03/2014 13:37, Antonio Fortuny a crit: Yep ! Mattias you are my muse :-D After a careful reading of the code it appears that the internal thread created had this line in the constructor. FreeOnTerminate := True; Aaargh ! :-[ So simple, so obvious, so easy and I missed it. Is was on another planet, defintely. I was on ... Not it all runs nicely. Now it all ... Sorry for the garbage. Thanks, Antonio. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- Antonio Fortuny Senior Software engineer 220, avenue de la Libert L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu Ce courrier lectronique ne contient aucun virus ou logiciel malveillant parce que la protection Antivirus avast! est active. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection Antivirus avast! est active. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Qt4
Hi Fols. Last week I started to test QT4 with FPC-Lazarun on a Linux x86_64 : Lazarus 1.0.12, FPC 2.6.2 Now I have to do some changes in an active project and, when compiling, I get the following linker errors: /usr/bin/ld: warning: /home/sources/compiled/link.res contains output sections; did you forget -T? /usr/bin/ld: cannot find -lQt4Pas and these appear with all clean projects when recompiling them !! I din't found anything on options, compiler options. All application *.o and *.ppu have been deleted Even when rebuildoing the IDE same errors appear. Some suggestions on how to get rid of them before reinstalling ? Thanks, Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Qt4
Le 10/03/2014 10:49, Mattias Gaertner a crit: On Mon, 10 Mar 2014 10:23:01 +0100 Antonio Fortuny a.fort...@sitasoftware.lu wrote: Hi Fols. Last week I started to test QT4 with FPC-Lazarun on a Linux x86_64 : Lazarus 1.0.12, FPC 2.6.2 Now I have to do some changes in an active project and, when compiling, I get the following linker errors: /usr/bin/ld: warning: /home/sources/compiled/link.res contains output sections; did you forget -T? /usr/bin/ld: cannot find -lQt4Pas You need to install qt4pas. http://wiki.lazarus.freepascal.org/Qt4_binding#Download_Free_Pascal_Qt4_Binding Yes Mattias, thanks. That's why, almost certainly, my first test with Qt4 failed. Anyway, I got finally rid of the linker error: unistall Qt4 from the system. Now all current projects and the IDE recompile without problems. Next time I will do it on a test virtual machine. It looks safer. Antonio. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- Antonio Fortuny Senior Software engineer 220, avenue de la Libert L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection Antivirus avast! est active. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Package
Hi Folks. I've built my first Lazarus package. When it is dynamically created in a test program, it works as it is supposed to work. When I drop it onto a form and test it with code, looks OK. So far, so good. But when it try to remove the component from the form where it is has been dropped, the IDE crashes with an Access violation exception I wonder if I didn't forget something in the either construcor or the destructor or both. At runtime the program crashes with a segmentation fault constructor TCustomControlTimer.Create(AOwner: TComponent); begin inherited Create(AOwner); FTH := TTimerThread.Create; FTH.FreeOnTerminate := False; end; destructor TCustomControlTimer.Destroy; var Elapsed: Cardinal; begin if Assigned(FTH) then begin if FTH.Active then begin FTH.Terminate; // débloquer la boucle d'attente FTH.EnableEvent.SetEvent; end; Elapsed := 0; while FTH.Active do begin Sleep(50); if Elapsed 5000 then Break; Inc(Elapsed, 50) end; FreeAndNil(FTH); end; end; Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Howto dropdown the calendar of TDateEdit programmatically
Le 07/03/2014 15:07, John Landmesser a écrit : Hi, i want to dropdown the calendar of an DateEdit at start of my app, so the user will see what to do next. There is a DateEdit.Button.Clicḱ procedure and TCustomMaskEdit.DoButtonClick, but they don't show the calendar. Just do DateEdit.Button.Click and the miracle takes place 8-) Antonio. Is it possible to show the calendar by code? thank you for a tipp!! -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Howto dropdown the calendar of TDateEdit programmatically
Le 07/03/2014 16:05, JmLandmesser a crit: DateEdit.Button.Click and the miracle takes place 8-) Antonio. Thats true, the miracle happened, thank you!! You're welcome :-) Well, this is only FPC-Lazarus magic actually. -- Antonio Fortuny Senior Software engineer 220, avenue de la Libert L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection Antivirus avast! est active. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] IDE default font
Hi Folks. If I remember well, a discussion took place some weeks ago about the IDE fonts in Lazarus but I can't find it any more So there is my question: Is it possible to change the default font used by visual controls when they are dropped onto the form ? If answer is yes, how could I change it ? My quesion is not trivial as I develop simultaneously in Win32 and Linux, most of the time, for the same projects (win32/64, GTK for Linux). First steps on Win32, then port to Linux. Afterwards, development and tests go on in parallel. Thanks, Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TSQLQuery.ParamCheck
Le 01/03/2014 20:12, Kapibara Pas a écrit : Hi there! This is my first posting on the mailing list. Thank you for your work on Lazarus!! I have a question: An earlier revision of Lazarus had the ParamCheck property implemented for SQLQuery. In the latest trunk that property is gone and all code removed from SQLdb.pas Could someone fill me in on that, and if it will be back in later versions? Thing is, I created a parameter at designtime from ObjectInspector and assigned a value to it at runtime. That doesnt work for me without ParamCheck:=false. The compiler complains: parameter not found. You could use ParseSQL property instead. Antonio. Perhaps there is a workaround? -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] save the detail record to sqlite
Le 28/02/2014 10:09, Reinier Olislagers a écrit : However, I polished my crystal ball and my guess is that you forgot this step: http://wiki.lazarus.freepascal.org/MasterDetail#Adding_detail_records_with_the_right_foreign_key ... Thanks, Reinier Note: also posted on forum: I guess that your cristal ball brights a lot after polishing it ( how much time: 10 minutes a day maybe ?) 8-) Mine desn't like polishing so I've built a bunch of rules for this kind of situation where updatable datasets are involved: - always assign an OnNewRecord event and dive the default value to all defined fields (TFields list). I know, some DBMS do it for you, but ... on creating the client dataset record, setting the master dataset key is always the first line, process generators, etc. - always explicitely name the used fields in the commanding Sql (any error on connecting to the DB will raise an error) This prevents me to trust my memory too much. Antonio. forum.lazarus.freepascal.org/index.php/topic,23766 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] save the detail record to sqlite
Le 28/02/2014 11:48, Reinier Olislagers a écrit : On 28/02/2014 11:43, Antonio Fortuny wrote: Mine desn't like polishing so I've built a bunch of rules for this kind of situation where updatable datasets are involved: - always assign an OnNewRecord event and dive the default value to all defined fields (TFields list). I know, some DBMS do it for you, but ... on creating the client dataset record, setting the master dataset key is always the first line, process generators, etc. - always explicitely name the used fields in the commanding Sql (any error on connecting to the DB will raise an error) This prevents me to trust my memory too much. Hi Antonio, If you want to change/update/improve the tutorial article, be my guest ;) I'd be happy to write some advices as far as you could consider them as some improvement to the DataSet processing. I guess you mean the wiki page http://wiki.lazarus.freepascal.org/MasterDetail#Adding_detail_records_with_the_right_foreign_key These are not specifically addressed to the master-detail relationship but specifically to the DataSet itself in a more general way. I can then give the exhaustive list of rules I follow since years. You could give some ideas on where to write tese rules. As a first approach I can point the SQLDB implementation chapter. Antonio. Thanks, Reinier -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] What GetChildParent does in designer and reader?
Voilà, Tous les fichiers troisième génération sont en place selo les noms: pays_job.csv (2007 pour la France) Les nombres de lignes par fichier correspond à la seconde version J'ai sondé quelques fichiers: ils sont identiques entre versions 2 et 3. et sauf la Belgique job 2548 déjà mis. A. Fortuny --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] TRTLCriticalSection
Hi Folks. Lazarus 1.0.2, FPC 2.6.2, Win32 and Linux x86_64 Something goes wrong with TRTRCriticalSection. There is a difference between Windows and Linux. In a program which will run on Win32 and Linux x86_64, using threads and all this stuff I need to protect some code from multi-threading access. One critical section looks enough to do the job. So i code this in Win32 and Linux: Interface uses clause is: uses {$IFDEF LINUX} CThreads, {$ENDIF} syncobjs, {$IFDEF MSWINDOWS} windows, {$ENDIF} {$IFDEF LINUX} LCLIntf, {$ENDIF} Classes, IdContext, uSimplelogger, sitacom, MessageQ, autoupdateTCPthread, sqldb, SysUtils; FIniCriticalSection: TRTLCriticalSection; ... InitializeCriticalSection(FIniCriticalSection); - compilation error ... EnterCriticalSection(FIniCriticalSection); try ... do a lot of things finally LeaveCriticalSection(FIniCriticalSection); end ... On the above line marked as compilation error the compiler complains with the message autoupdateserverthread.pas(255,48) Error: Call by var for arg no. 1 has to match exactly: Got TRTLCriticalSection expected QWord *winapi.inc*(650,11) Hint: Found declaration: InitializeCriticalSection(var QWord); winapi ??? Why on Linux ? No way to get rid of this compilation error In Win32 the program compiles and runs without errors. Some help would be appreciated. Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TRTLCriticalSection
Le 25/02/2014 12:04, Sven Barth a écrit : Am 25.02.2014 11:22, schrieb Antonio Fortuny: Hi Folks. Lazarus 1.0.2, FPC 2.6.2, Win32 and Linux x86_64 Something goes wrong with TRTRCriticalSection. There is a difference between Windows and Linux. In a program which will run on Win32 and Linux x86_64, using threads and all this stuff I need to protect some code from multi-threading access. One critical section looks enough to do the job. So i code this in Win32 and Linux: [snip] On the above line marked as compilation error the compiler complains with the message autoupdateserverthread.pas(255,48) Error: Call by var for arg no. 1 has to match exactly: Got TRTLCriticalSection expected QWord *winapi.inc*(650,11) Hint: Found declaration: InitializeCriticalSection(var QWord); winapi ??? Why on Linux ? No way to get rid of this compilation error In Win32 the program compiles and runs without errors. Some help would be appreciated. The function for initializing a TRTLCriticalSection is InitCriticalSection, not InitializeCriticalSection. If you wouldn't use the Windows unit you'd have seen this error on Windows as well. The windows unit is used in the Win32 box (look at the conditional uses clause) Antonio; @Michael: maybe we should add a seealso for the Init-/Enter-/Leave-/DoneCriticalSection functions to the documentation of the TRTLCriticalSection type. Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TRTLCriticalSection
Now I get it working on both platforms. Use InitCriticalSection and DoneCriticalsection (thanks Mattias) Using system.EnterCriticalSection and system.LeaveCriticalSection solves all the compilation problems and runs (thanks all) Thanks again Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] View Graphic File
Le 20/02/2014 07:43, Allan E. Registos a écrit : Hi all, A noob question, I have trouble trying to port an existing vb.net snippet to pascal. Can anyone provide a code snippet where we can download and view a file from a Database? A binary(jpeg/pdf file) was uploaded to a database table. The code will just download the file uploaded and view it. In vb.net this can be done: / if conn.State = ConnectionState.Closed Then conn.Open()// //sql = Select binfile from graphicfiles WHERE id= id// // //cmd = New NpgsqlCommand(sql, conn)// // //Dim fileData As Byte() = DirectCast(cmd.ExecuteScalar(), Byte())// // //Dim sTempFileName As String = Path.GetTempPath \ sFileName// // //If Not fileData Is Nothing Then// // //'Read image data into a file stream // //Using fs As New FileStream(sTempFileName, FileMode.OpenOrCreate, FileAccess.Write)// //fs.Write(fileData, 0, fileData.Length)// //'Set image variable value using memory stream. // //fs.Flush()// //fs.Close()// //End Using// // //Process.Start(sTempFileName) 'Open file// // //End If// / Sounds quite easy to translate: 1. install the sqldblaz package if not yet done 2. onto a form or a datamodule drop a connection named DB (correcpondig to your DB) and a transaction named TR; link them 3. drop a TSqlQuery, link it to the connection and the transacton just dropped (name Q) 4. fill in the Sql property/. /I assume that the column binfile is a binay blob ... var fs: TMemoryStream; begin ... fs := TMemoryStream.Create; try DB.DatabaseName := 'whatever connection could be'; DB..UserName := 'sysdba'; DB.Password := 'your password'; DB.Connected := True; Q.Sql.Text := Format('Select binfile from graphicfiles WHERE id=%d/'/, [id]);/// assuming id is an integer, adapt the format otherwise/ TR.StartTransaction; Q.Prepare; Q.Open; if Q.Eof = False then begin fs.Position := 0; TBlobField(Q.FieldByName('binfile')).SaveToStream(fs); ... fs.Position := 0; // reset position to beginning of stream do whatever you need to do with the stream fs use stream length by fs.Size fs.SaveToFile('any file name'); // for an image dropped onto a form: Image.Picture.LoadFromStream(fs); ... etc... ... end; Q.Close; finally TR.Commit fs.Free end This should work as it is a code snippet used in one of my programs (cleaned and simplified). In my case the DBMS is Firebird but this should work with any other supported by SqlDbLaz package. Antonio. Thanks,, Allan -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Detecting new connection
Le 31/01/2014 11:40, Santiago A. a écrit : Hello: I have a program on Laptop that when network is active (there is a WIFI, ie) must do some tasks (in fact check for updates). Is there any standard way to do so, without continuously pooling if it can connect to Internet? A standard way to check this I don't know any. I don't even know if an appication can catch events sent by the OS when a network connection raises.. I've made an application wich polls the network for a TCP/IP target : once at the application load and then on a regular basis. to have it as a standard as possible (from my point of view), I'built a service which runs on Win32, Win64, Linux x86_64 and WinCE. It is almost standard for all platforms as it uses Indy sockets and potocols on both sides: update server and targets. The only exception is the WinCE application wich connects to a local server to check for a new version. But all TCP/IP prorocol is coded in one FPC unit and compiled using Lazarus in all applications that need it. Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus Wiki
Le 21/01/2014 20:52, Johannes W. Dietrich a écrit : You could begin with http://wiki.lazarus.freepascal.org/Components_and_Code_examples#Packages.2FPrograms_for_FPC.2FLazarus_.28not_hosted_here.29 Yeah, right. But, hem, how to create a new page into the wiki ? :-[ Antonio J. W. D. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Dr. Johannes W. Dietrich, M.D. -- Laboratory XU44, Endocrine Research -- Medical Hospital I, Bergmannsheil University Hospitals -- Ruhr University of Bochum -- Buerkle-de-la-Camp-Platz 1, D-44789 Bochum, NRW, Germany -- Phone: +49:234:302-6400, Fax: +49:234:302-6403 -- eMail: j.w.dietr...@medical-cybernetics.de mailto:j.w.dietr...@medical-cybernetics.de -- WWW: http://medical-cybernetics.de -- WWW: http://www.bergmannsheil.de -- Researcher ID: C-3498-2009 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Lazarus Wiki
Hi Folks. I need some help (only once) on how to make a new topic in the Lazarus wiki and link it to whatever page sounds the best to be its ancestor. This concerns a new object I made (TFPTimer based, thread safe and thread independant). I'll embed it into a native Lazarus conventional package and publish some help and hints on howto use the component (and maintaing the pages whenever the component behaviour changes, of course. I'm (almost) natively a french speaker but I can accomodate with English as well which means that I can cope with both languages and their respective wiki pages. That's why I definitely prefer to let someone of you, guys, to choose for me the most relevant page to include the start point of the component page and tell me in a few words how to start. Of course, having a page template would be nice too. Like Lazarus, you know, tell me once and I'll do it as many times as required 8-) BTW, I already have access to modify wiki pages: looks very easy as every page has a Modify tab. Thanks, Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Threads and Libraries (dll and so)
Le 17/01/2014 12:53, Michael Van Canneyt a écrit : On Fri, 17 Jan 2014, Antonio Fortuny wrote: Hi All. Maybe not a Lazarus/FPC specific question but development whill be done using Lazarus/FPC. I wonder if I can build an application (service) having multiple threads running (Indy TCP/IP server, multiple connections) and every thread calls some functions in a library (dll on Windows, .so on Linux) I can imagine that if every thread loads dynamically the library it should work as I assume that a library shares its code among all callers (processes ?) but each instance has its own data segment tied tp the calling process (thread ?). The data segment is tied to the process, not to the thread. So global variables in the DLL are shared by all threads of the calling process. If you define threadvars in the DLL, they will normally be specific to threads of the calling program (just as they would be if the library created the thread). Ok, got it. The library has to be made thread safe as well. This was already in my mind. Tnaks Michael. Antonio. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] File Download using INDY 10 with Lazarus with Progress bar
Le 17/01/2014 13:21, sanmiolade a écrit : Hello Guys , I need sample lazarus code using INDY to download a File from the internet Have a look at http://wiki.freepascal.org/Indy_with_Lazarus Indy SVN server: http://www.indyproject.org/sockets/download/svn.en.aspx I also want to show a progress bar, show file Size and download size See events in IoHandler Antonio. Thanks. -- View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/File-Download-using-INDY-10-with-Lazarus-with-Progress-bar-tp4035448.html Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Threads and Libraries (dll and so)
Vrey interesting indeed. I agree with Marcos on his last remark. I'm concerned with multi-threading from a long time now and I'm used to avoid global vars in any case. Reading your answers I'm more strongly convinced that this position should be the master rule when dealing with threads. But one should also know who does what. This is the origin of may quenstion Thank you all again for your pertinent comments. Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TFPTimer, Linux
DaemonApp works using threads. TFPTimer is not usable in threads other than the main thread. Right. So I made my own Timer based on the TFPTimer. Almost the same code except that the Synchronize(@EventProc) disapeared in my code and the EventProc is called immediately. Another little feature is that the high level enable disable sequences do not kill the thread: using a TEvent and some lines of cole solves this problem whithout requiqring lots of CPU processing time. Even in in the worst case the thread will respond within 500 ms Yes, I know, but what if more than one thread calls the same procedure ? Well, it is not even protected by a critical section because based on a single rule: one Timer one procedure, nothing less nothing more. As a consequence I consider that the event procedure is part of the Timer object but only connected at runtime. In a test GUI application, my timer runs perfect in a multi-threaded environment (one timer, one thread embedded into an object). My only little disappointment is that the timer precision goes from -5 to +5 ms. But this doesn't bother me as my timers deal with tens (and more hundreds) of ms. So I consider that this little error isn't worth writing of code to get rid of it. I don't think that the world will stop turning around itself because a lack of 5 ms. Antonio; Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TFPTimer, Linux
Le 17/01/2014 16:02, Lukasz Sokol a crit: Hello Antonio, Do you care (enough) to share ? :) Absolutely not: I'm just thinking that some FPC specialists over there could even enhance it. Just tell me how and where (I already have an access to the wiki pages on update) You could maybe prepare the page layout and I'll fill in details, code and explanations. I'm not (yet) a specialist on page publications but I guess I'll become one in a short period of time. timer code [even if it's just a recipe] Full code, no problem. and [minimal] example? Maybe on the wiki ? OK Antonio. -L Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- Antonio Fortuny Senior Software engineer 220, avenue de la Libert L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection Antivirus avast! est active. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Linker errors
Hi Folks. In a TDaemon project running nicely since beginning of last year, I have added a TTimer to execute periodically an internal control procedure. I then added a TTimer component, the unit ExtCtrls in the uses clause, the code of the TTimer event, compile and ... nothing: linker fails with a lot of errors like these: /usr/bin/ld: warning: /home/sources/compiled/link.res contains output sections; did you forget -T? /home/sita/.lazarus/lib/LCLBase/units/x86_64-linux/wsimglist.o: In function `WSIMGLIST_REGISTERCUSTOMIMAGELIST': wsimglist.pp:(.text+0x99f): undefined reference to `WSRegisterCustomImageList' /home/sita/.lazarus/lib/LCLBase/units/x86_64-linux/wsmenus.o: In function `WSMENUS_REGISTERMENUITEM': wsmenus.pp:(.text+0x167): undefined reference to `WSRegisterMenuItem' /home/sita/.lazarus/lib/LCLBase/units/x86_64-linux/wsmenus.o: In function `WSMENUS_REGISTERMENU': wsmenus.pp:(.text+0x187): undefined reference to `WSRegisterMenu' /home/sita/.lazarus/lib/LCLBase/units/x86_64-linux/wsmenus.o: In function `WSMENUS_REGISTERMAINMENU': wsmenus.pp:(.text+0x1a7): undefined reference to `WSRegisterMainMenu' As you can read the linker references a lot of units located into the local user home directory. I wonder why. The IDE has been rebuilt without problems Installation is a Linux Opensuse 12.2 x86_64, Lazarus 1.0.12, fpc 2.6.2 installed out of rpm's. When I embed all TTimer references into conditional code, no more problem. The daemon compiles and runs as before. BTW, the same project compiles and runs under Win32 with the TTimer (Lazarus 1.0.12 and FPC 2.2.6, same external componets). I think to a workaround solution based on another thread sleeping for the required period of timet this adds some extra useless overhead Any explanation ? Antonio; --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Linker errors
I forgot to be more precise: embedding the same TDaemon code into a normal application using a front end display the code compiles without problems Of courese in this case, the daemon register procedures are conditionally surrounded by IFDEFs and are not compiled under the gui application. Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Linker errors
Le 15/01/2014 10:08, leledumbo a crit: Whenever you have `undefined reference to WSRegisterXXX`, you're missing Interfaces unit in the .lpr. Sometimes package that registers custom components (such as RichMemo) in its package main file is also required to be added to .lpr's uses clause. Great, it works !! 8-) Thanks a lot and, hum, I look so stupid. :-[ Maybe one more question: is it true if I assume that when using any cocntrol from the "ExtCtrls" unit, the Interfaces unit is required even when the components used are not visible ? Antonio. -- View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Linker-errors-tp4035393p4035395.html Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- Antonio Fortuny Senior Software engineer 220, avenue de la Libert L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection Antivirus avast! est active. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Linker errors
Le 15/01/2014 10:26, Michael Van Canneyt a écrit : On Wed, 15 Jan 2014, Antonio Fortuny wrote: Le 15/01/2014 10:08, leledumbo a écrit : Whenever you have `undefined reference to WSRegisterXXX`, you're missing Interfaces unit in the .lpr. Sometimes package that registers custom components (such as RichMemo) in its package main file is also required to be added to .lpr's uses clause. Great, it works !! 8-) Thanks a lot and, hum, I look so stupid.:-[ Maybe one more question: is it true if I assume that when using any cocntrol from the ExtCtrls unit, the Interfaces unit is required even when the components used are not visible ? Yes. Sounds clear. But you should not use an LCL timer. It will not work anyway in a daemon app since it does not use the LCL application event loop. (unless the lazarus team used some black magic to implement it) I don't know whether the Lazarus team used some magic or not but it works on WIn32 with the service. I'll port it now on Linux and I'll report the results. Antonio. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Linker errors
Le 15/01/2014 10:26, Michael Van Canneyt a écrit : On Wed, 15 Jan 2014, Antonio Fortuny wrote: Le 15/01/2014 10:08, leledumbo a écrit : Whenever you have `undefined reference to WSRegisterXXX`, you're missing Interfaces unit in the .lpr. Sometimes package that registers custom components (such as RichMemo) in its package main file is also required to be added to .lpr's uses clause. Great, it works !! 8-) Thanks a lot and, hum, I look so stupid.:-[ Maybe one more question: is it true if I assume that when using any cocntrol from the ExtCtrls unit, the Interfaces unit is required even when the components used are not visible ? Yes. But you should not use an LCL timer. It will not work anyway in a daemon app since it does not use the LCL application event loop. (unless the lazarus team used some black magic to implement it) Obviously, Lazarus team magic works on Win32 but not on Linux. When starting the service I get the message (IpService:22520): Gtk-WARNING **: cannot open display: into the messages file and the service is killed. When I launch the service by hand (MyProgram -r ), this time it runs (the console seems enough for GTK) but, you are rigth the timer event does not fire. I'm a little bit disappointed. Do you have, by any chance, some trick to get around this ? Antonio. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Linker errors
Le 15/01/2014 10:26, Michael Van Canneyt a écrit : On Wed, 15 Jan 2014, Antonio Fortuny wrote: Le 15/01/2014 10:08, leledumbo a écrit : Whenever you have `undefined reference to WSRegisterXXX`, you're missing Interfaces unit in the .lpr. Sometimes package that registers custom components (such as RichMemo) in its package main file is also required to be added to .lpr's uses clause. Great, it works !! 8-) Thanks a lot and, hum, I look so stupid.:-[ Maybe one more question: is it true if I assume that when using any cocntrol from the ExtCtrls unit, the Interfaces unit is required even when the components used are not visible ? Yes. But you should not use an LCL timer. It will not work anyway in a daemon app since it does not use the LCL application event loop. (unless the lazarus team used some black magic to implement it) I guess that TFPTimer should do it (please be clement with me and don't think I'm looking stupid again) Antonio. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] TFPTimer, Linux
Hi Folks. Following a Michael advice I changed a TTimer by an TFPTime component in a Linux daemon application but the latter doesn't work. There is the code snippet of the TFPTime OnTimer event: procedure TDaemon1.ThreadControlTimerTimer(Sender: TObject); var Res: Boolean; begin // se réveille toutes les 10 secondes pour vérifier l'état du thread FLog.Add(9, '1', esError); try FLog.Add(9, '2', esError); except on E: Exception do begin FLog.Error(Format('+++ error on log control thread:%s', [E.Message])); Res := False; end; end; FLog.Add(9, '3', esError); try FLog.Add(9, '4', esError); - this line appears into the log file ThreadControlTimer.Enabled := False; FLog.Add(9, '5', esError); === this line is never reached Res := DoThreadControl; FLog.Add(9, '6', esError); except on E: Exception do begin FLog.Error(Format('+++ error on control thread:%s', [E.Message])); Res := False; end; end; if Res then begin FLog.Add(9, '7 True', esError); ThreadControlTimer.Enabled := True; end else begin FLog.Add(9, '8 False', esError); end; end; It looks like the Enabled property doesn't work and blocks the TFPTimer in some way. The event is fired on time, but only once and never more. I'dl be glad to know what happens. Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Win services
Le 11/12/2013 16:23, Reinier Olislagers a écrit : On 11/12/2013 16:17, Antonio Fortuny wrote: Maybe the wiki page (http://wiki.freepascal.org/ServiceManager) could be adapted to be more precise. Looking forward to *your* updates. (hint, HINT, *HINT*!) rantAll well and good that only a select few persons ever take the trouble to ever write documentation in whatever form - be it text, fpdoc or wiki, these ridiculous maybe somebody else should update the documentation remarks after getting a lot of help are just... ridiculous./rant Just done Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Win services
Hi Folks. I'am in trouble when attempting to stop a Windows service using the TServiceManager component. The program runs into a Vista-32 box, the Lazarus IDE runs in an administrator user console: it has been started as d:...\Lazarus my_project.lpi When I run the program and do a step by step execution all looks good until the StopService line is reachad: The service name should be the display name, right ? SMgr := TServiceManager.Create(nil); try SMgr.Access := SC_MANAGER_ALL_ACCESS; SMgr.Connect; *SMgr.StopService(SERVICE_NAME, False); *// there are no dependants finally SMgr.Free end The pointed line fails with the Windows error exception: *6 invalid handle* as if the procedure couldn't catch a valid hendle for the service. When, in the same admin cosole I type: net stop *SERVICE_NAME *the service stopsimmediately without error Any idea ? Antonio. ** --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Win services
Le 11/12/2013 14:38, Michael Van Canneyt a écrit : On Wed, 11 Dec 2013, Antonio Fortuny wrote: Hi Folks. I'am in trouble when attempting to stop a Windows service using the TServiceManager component. The program runs into a Vista-32 box, the Lazarus IDE runs in an administrator user console: it has been started as d:...\Lazarus my_project.lpi When I run the program and do a step by step execution all looks good until the StopService line is reachad: The service name should be the display name, right ? SMgr := TServiceManager.Create(nil); try SMgr.Access := SC_MANAGER_ALL_ACCESS; You should set refreshonconnect:=true (or something similar). Ok Michael, works up to there (SMgr.Refresh works too) but when doing: h := SMgr.GetServiceHandle(SERVICE_NAME, SERVICE_ALL_ACCESS); I get the windows exception 1006 !!? I do not use the IDE anymore but I launch the program in an administrator command line window SMgr.Connect; Or call refresh here. Refresh will re-fetch the list of services from the windows service manager. It needs this list for the next call: *SMgr.StopService(SERVICE_NAME, False); *// there are no dependants now I get error 1060: Which fails if you do not refresh the list of services. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Win services
Sorry all, it is my fault. In fact, when I use the commande net start servicenape servicenape stands for the display name and it works every day. This time I tried: sc stop my_service with the same name and I receive a Windows error telling me that service has not been started, but I'm pretty sure it is (that's what services.msc tells me) Until, making a typing error I typed sc stop _service which did work In fact, what sc and the TServiceCompoent expect as the service name to be is the NAME property of the item in the DataModule of the daemon mapper (_service in this case) and not its display name. That's it. Maybe the wiki page (http://wiki.freepascal.org/ServiceManager) could be adapted to be more precise. Now my program works fine with the services manager. I guess it will much easier to manage all this in Linux. Thanks anyway. Antonio. --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Win services
Le 11/12/2013 16:23, Reinier Olislagers a crit: On 11/12/2013 16:17, Antonio Fortuny wrote: Maybe the wiki page (http://wiki.freepascal.org/ServiceManager) could be adapted to be more precise. Looking forward to *your* updates. (hint, HINT, *HINT*!) rantAll well and good that only a select few persons ever take the trouble to ever write documentation in whatever form - be it text, fpdoc or wiki, these ridiculous "maybe somebody else should update the documentation" remarks after getting a lot of help are just... ridiculous./rant I'd be glad to post some comments into the wiki page if you could take some time to explain to me how to proceed. This only takes time once. I guess that someone should read tha changes before they are published. In a more general way I'd also be glad to help maintaining Lazarus FPC as far as I get the "how to proceed" from some of you. Visiting another page could be helpfull as well. Antonio. -- Antonio Fortuny Senior Software engineer 220, avenue de la Libert L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection Antivirus avast! est active. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Linux service
Hi Folks. I have created a service which has to run into Windows and Linux servers. The program runs OK on both OS and the service runs nicely in Windows (32 and 64). I'm only a little bit stuck onto an UBUNTU platform. I've managed to launch and stop the service on an OpenSuse platform (thanks to Michael) using the standard tools startproc and killproc which do correctly teir job inside the service script when using the correct parameters. I'm trying to do the same in an UBUNTU script using this time start-stop-daemon. No problem to start the service but when stopping I still see the program running (simple ps -ef). Besides this, into the log produced by the service I read that the stop command has been caught and the program definitely reached the last line of the code. Buth the program still hangs somewhere as if the unload action didn't wok. The run parameter -r has been given in the command which launches the program inside the script. Finally I need a kill -9 to get the program out. Maybe is this a normal behaviour but I guess not. Another question: should I do something else in the code to have the service unloaded when stop is complete ? Thanks, Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Linux service
Le 27/11/2013 15:06, Michael Van Canneyt a écrit : On Wed, 27 Nov 2013, Patrick Chevalley wrote: Hi, To enable your program to react to signal you need to use fpSigAction. See here for usage: http://www.freepascal.org/docs-html/rtl/baseunix/fpsigaction.html Instead of SigUsr1 in the example you can register a procedure for SIGTerm to handle a termination request. You can also add a procedure for SIGHUP if you want to implement a service .. reload action. The complete list of signal is in rtl/linux/signal.inc That is exactly what the daemon code does. Procedure DoShutDown(Sig : Longint; Info : PSigInfo; Context : PSigContext); cdecl; begin Application.StopDaemons(True); Application.Terminate; end; Procedure SysInitDaemonApp; Var old,new : SigactionRec; begin New.sa_handler:=@DoShutDown; fpSigaction(SIGQUIT,@New,@Old); fpSigaction(SIGTERM,@New,@Old); fpSigaction(SIGINT,@New,@Old); end; Well, all this is already running. I managed to trap SIGTERM and SIGHUP to start the program shutdow an the config reload respectively and it works (# ./my_program -r in background). My only trouble was that the program looked like to be hung after it completely finished with its task (seen in the log file). Now, thanks to some misterious power (maybe the Force ?) doing: # bash -x my_service_script start launches the service: new log started, all init tasks done, responds to requests and ... waits for jobs # bash -x my_service_script stop oh miracle, runs as well: the log file reflects all the tasks done on closing, the pidfile has gone and the process too ! (BTW, if you know some other good god who responds so fast that I could invoke, please let me know 8-) no Michael, not your turn yet) I suspect that I wrote (or delete) something in the script that made it to work. Last step, install a normal service into the UBUNTU box: this should be a piece of cake Thanks anyway. Antonio; Michael. -- ___ 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
Re: [Lazarus] TForm.ModalResult := mrOk problem
Le 25/11/2013 16:33, FreeMan a écrit : on /lazarus/lcl/forms.pp line 662: property ModalResult : TModalResult read FModalResult write FModalResult; TCustomForm class property. its just variable on virtualbox system: I add TButton on form and TButton.ModalResult set to MrOk. and click to Button then similar work TForm.ModalResult := MrOk. I don't wanna use tbutton, How to run My code F.ModalResult := MrOk. I can reasonably suspect that the code ran from another form will not have any impact on the form to be closed. In a normal way the form to be closed responds first to any event (windows local event queue). When the event code which has been fired finishes with something like [Self.]ModalResult := mrCancel the forms manager does its job an does whatever has to be done with the ModalResult. Most of the time the form is closed when called with ShowModal. Without ShowModal the form still displays. So when you execute (in FormMain): TFormMain.SomeProcedure; begin OtherForm.ModalResult := mrOK end; nothing happens with OtherForm as no event was running. If you need the form itself to close follonwing a ShowModal, you have to create an internal event like the one a timer fires. This is my way to proceed when I need to manage a timeout on a form but always under the range of a previous ShoModal. Hope this hepls to understand. Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie question: tsqlquery; primarykey; insert.
Le 26/11/2013 16:02, Kovács László a écrit : Hi dear list members. I'm new here. Approximately 17 years ago I worked as a sysadmin, gave every day support for 70 peoples how to use their computers. I also made numerous small apps, to help the work of the firm. That time I did it with Delphi 1, used DBase and Paradox tables. I did this job for a few years, then the life pushed me away from programming, but not too far away from computers. Now I'm here, and seem to come back. My friend wants me to create a database app, because the task is just too complicated to do by himself in MS Access. I put my cents on Lazarus, as I can't afford any Delphi (and like) available today. I choosed Firebird (a very cost effective solution as well) as database engine, started with embedded, but later when as development progresses need move to real client-server. So, I created my database, that wasn't too hard with IBExpert personal (I had to look for something to substitute Database desktop). I also managed to create my autoinc fields, using Firebirds triggers and generators. Each of my tables has its own counters. But I'm stuck with getting the newly inserted rows ID. How do you get it? Create as many sequences (new name for generators) as you need In the application when you need a new value for a sequence (an insert for instance) I execute the next query just before: */select next value for my_generator_name as column_name_i_want from rdb$database/* and I get the value with the query which executed the query (some TQuery component, using FieldByName('column_name_i_want).AsInteger or better AsLargeInt) The unique ID has been definitely reserved and the I can use it into any other update or insert with other tables. This is my way but it not the only one but because I want to control everything which reports to database, i'm used to this method Antonio. Or if you generate the ID on the client side, how do you make absolutely sure, no other user can get the same ID. That's easy: it is guaranteed by Firebirdwhatever way you choose Is there a way to ask Firebird about the next value of a generator? And then I could use that ID upon an insert, and would deactivate the triggers. yes, read above, no need to deactivate or reactivate triggers If I'm on a wrong way with this ID thing, any other Best practices are welcome. ;) I highly appreciate every help word! Thank you very much in advance Laszlo Kovacs -- ___ 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
Re: [Lazarus] Program version
Hi again. I succeeded to make one source unit which when used into any Lazarus unit, gives the version of any file as far as the file : - has been compiled whith Lazarus or Delphi - version information is in the resource data ad hoc (as Lazarus and Delphi provide) The file to analyze can be any executable file provided that the standard OS signatures are at the beginning of the file: - 'MZ' as the first two chars of the file for any windows program (inclusive WinCE) - #127+'ELF' as the first four chars of a Linux executable file The unit can be compiled by Lazarus (or FPC I guess) on Win32, Win64, Linux x86_64 (I guess i386 too) Targets can be Win32, WinCE, Win64, Linux x86_64 A program using the version unit runs on Win32, win64, winCE, Linux x86_64 Whatever the target can be, there is no need to change anything. Same source runs on all named platforms. In case of trouble, the unit is supposed not to blow up. It gives a blank version intead.µ See th source unit as attachment. As I'm not perfect, so I suppose that my code could easily be changed, adapted or made better in any way. Feel free to comment for improvements There are not very much comments as code is almost self explanatory but there improvements can be made as well. Antonio. unit uProgramVersion; { Author: Antonio Fortuny (a(DOT)fortuny(AT)sitasoftawre(DOT)lu ) Date: nov/2013 Company: Sita Software Location: Luxembourg www.sita.lu } interface uses Classes, {$IFNDEF LINUX} windows, {$ENDIF} SysUtils; type TVersion = record Major, Minor, Release, Build: Integer; end; PTVersion = ^TVersion; {$IFDEF WINCE} function ReadVersionInfo(const sProgram: WideString; Out vv: PTVersion) :Boolean; function ProgramVersion(const sProgram: WideString) : WideString; function ProgramVersionOnly(const sProgram: WideString) : WideString; function ProgramFullVersion(const sProgram: WideString) : WideString; function AnyProgramVersion(const sProgram: WideString): WideString; overload; function AnyProgramVersion(const sProgram: string; Out vv: PTVersion) :Boolean; overload; {$ELSE} function ReadVersionInfo(const sProgram: string; Out vv: PTVersion) :Boolean; function ProgramVersion(const sProgram: string) : string; function ProgramVersionOnly(const sProgram: string) : string; function ProgramFullVersion(const sProgram: string) : string; function AnyProgramVersion(const sProgram: string): String; overload; function AnyProgramVersion(const sProgram: string; Out vv: PTVersion) :Boolean; overload; {$ENDIF} function CurrentProgramVersion(const sProgram: string; const ExecType: char='W'): String; implementation uses elfreader, winpeimagereader, resource, versionresource; {$IFDEF WINCE} function ReadVersionInfo(const sProgram: WideString; Out vv: PTVersion): Boolean; {$ELSE} function ReadVersionInfo(const sProgram: string; Out vv: PTVersion) :Boolean; {$ENDIF} begin if AnyProgramVersion(sProgram, vv) then Result := True else begin Result := False; vv := New(PTVersion); vv^.Major := 0; vv^.Minor := 0; vv^.Release := 0; vv^.Build := 0; end; end; {$IFDEF WINCE} function ProgramVersionOnly(const sProgram: WideString) : WideString; {$ELSE} function ProgramVersionOnly(const sProgram: string): string; {$ENDIF} var vver: PTVersion=nil; begin try Result := '0.0.0.0'; if ReadVersionInfo(sProgram, vver) then begin //VersionProgramme := Format('%d.%d.%d.%d', [vver.Major, vver.Minor, vver.Release, vver.Build]); Result := Format('%d.%d.%d.%d', [vver^.Major, vver^.Minor, vver^.Release, vver^.Build]); end; finally if Assigned(vver) then Dispose(vver); end; end; {$IFDEF WINCE} function ProgramFullVersion(const sProgram: WideString) : WideString; {$ELSE} function ProgramFullVersion(const sProgram: string) : string; {$ENDIF} var vver: PTVersion=nil; begin // Initialisation de l'application: try Result := '000.000.000.000'; if sProgram = EmptyStr then Exit; if ReadVersionInfo(sProgram, vver) then begin //VersionProgramme := Format('%d.%d.%d.%d', [vver.Major, vver.Minor, vver.Release, vver.Build]); Result := Format('%.3d.%.3d.%.3d.%.3d', [vver^.Major, vver^.Minor, vver^.Release, vver^.Build]); end; finally if Assigned(vver) then Dispose(vver); end; end; function CurrentProgramVersion(const sProgram: string; const ExecType: char='W'): String; var RS : TResources; E : TWinPEImageResourceReader=nil; EL : TElfResourceReader=nil; VR : TVersionResource; I : Integer; wProgram: String; ar: array[0..4] of byte; begin { Msg := CurrentProgramVersion(ParamStr(0)); DoLog(Format('version ce programme %s', [Msg])); Msg := CurrentProgramVersion('D:\Compiled\Lazarus\i386-win32\ipconsole.exe'); DoLog(Format('version lazarus win32 D:\Compiled\Lazarus\i386-win32\ipconsole.exe %s', [Msg])); Msg := CurrentProgramVersion('D:\Compiled\BackupClient.exe'); DoLog(Format('version Delphi win32 D:\Compiled
[Lazarus] Program version
Hi Folks. Currently I can extract any Windows program version as far as it has been compilerd on a Win platform using either Delphi or Lazarus. I can do the same on a Linux program on a Linux platform as fas as far as the version has been embedde somewhere in the elf. So fa, so good. But do you now any method for a program running on a Linux platform to extract the version of a Window compiled program ? And vice-versa ? Al I know about this is that the version is embedded somwhere into a resource into the executable Is it right if I assume that executable program signatures are Windows: first two bytes of the file are MZ. Linux: first 4 bytes of the file are $7F'ELF' Antonio -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Program version
Le 06/11/2013 14:41, Anton Kavalenka a écrit : The unit versionresource is part of package fcl-res I already use it for Linux with a Linux executable file Unit allow x-platform version resource extraction and parsing. rsrc:=TVersionResource.Create; Stream := TResourceStream.CreateFromID(*hMod*, 1, PChar(RT_VERSION)); What's *hMod *stands for ? Looks like a pointer of so (PtrUint) rsrc.SetCustomRawDataStream(Stream); with res do case it of vsFileVersion: Result:=format('%d.%d.%d.%d',[FileVersion[0],FileVersion[1],FileVersion[2],FileVersion[3]]); vsProductVersion: Result:=format('%d.%d.%d.%d',[ProductVersion[0],ProductVersion[1],ProductVersion[2],ProductVersion[3]]); end; regards, Anton -- ___ 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
Re: [Lazarus] Program version
Le 06/11/2013 16:31, Sven Barth a crit: If you look at my other mail you'll see the solution. The reader unit for Windows PE files is WinPEImageReader. You're rigth and I used your comment to buil the test and it runs nice. 8-) Next step is to build some general procedure to retrieve the version of any pogram on any platform as far as far as the source file is accessible and has the platform executable signature. I think I have all the peices right now. Leave some days (I have other things to do for which I'm paid and a boss looking over my shoulder :o , he is very comprehensive though). Anyway, thank you to you two. I'ill come back here when I have something clean and working. Antonio. And you can avoid ifdefs by additionally to unit "resources" using the units "elfreader", "winpeimagereader" and "versionresource". Then you can do "Rs.LoadFromFile(sProgram);" Does make sense. In fact that's exactly what I've done just before your post. (the explicit reader isn't needed as the extension will be used) and either loop through all resources like you currently do or use "Rs.Find(RT_VERSION, 1)" which should(!) return you the correct version resource. Which avoids the ridiculous loop Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- Antonio Fortuny Senior Software engineer 220, avenue de la Libert L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] ComponentCount
Hi Folks. I've a problem with the TComponent.ComponentCount. Lazarus 1.0.12, FPC 2.6.2, WIn Vista32 Onto a TForm, at design time, I drop a TPanel (named MyPanel). Into MyPanel I drop half a dozen inside TPanel's. These have been dropped doing: 1.)select MyPanel first, 2.) then drop inside TPamel). When I move the MyPanel, all inside panels move too. At runtime, when in the TForm.CreateForm event I execute a wCount := ComponentCount; displays 15 which is the total components count onto the form, irrespective of the containers wCount := MyPanel.componentCount; wCount appears to be 0 (zero) :-\ as if MyPanel wasn't a container (Parent property didn't work at design time ?) Some lines later, after having dynamically created 6 Tpanels inside the MyPanel I do (still in Create event): wCount := MyPanel.componentCount; which gives 6 as count which is the number of TPanel's added wCount := ComponentCount; whish shows 15, the initial TForm.ComponentCount This time, at form level wCount is exactly the number of components onto the form irrespective of the containers wich Some time lated into the MyForm.OnShow event I display again the counts: wCount := MyPanel.componentCount; shows 6 wCount := ComponentCount; shows 15: same as in the beginning, where are gone the 6 dynamically added panels ? This leads me to assume that, at design time, the main form appears to be the parent of all newly dropped TComponent descendants. Right ? Did I miss something ? Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] ComponentCount
Le 05/11/2013 11:30, Mattias Gaertner a écrit : On Tue, 05 Nov 2013 11:14:55 +0100 Antonio Fortuny a.fort...@sitasoftware.lu wrote: Hi Folks. I've a problem with the TComponent.ComponentCount. Lazarus 1.0.12, FPC 2.6.2, WIn Vista32 Onto a TForm, at design time, I drop a TPanel (named MyPanel). Into MyPanel I drop half a dozen inside TPanel's. These have been dropped doing: 1.)select MyPanel first, 2.) then drop inside TPamel). Maybe you are searching for ControlCount? Yep, it did it. Thanks Mattias. Antonio. Mattias -- ___ 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
Re: [Lazarus] About TComboBox.Items.IndexOfName
Le 30/10/2013 22:41, FreeMan a écrit : Hello, I'm not sure is this bug? can some one test please? and if its but I'll make new issue. I have a TComboBox, I add 2 strings. I wanna do, if TmpStr is in the items, do it selected. I := EDT_User.Items.IndexOfName(TmpStr); EDT_User.ItemIndex:= I; 1-) I is always return -1; Well, I don't know what's in the Items property (TStrings) but if I execute a Index := Combo.Iyems.IndexOf('My text'); I receive 7 when the string 'My text' is in the 8th position, counting from 1. When the Items property contains one=1 two=2 three=3 four=4 doing: str := 'three'; Index := ComboBox1.Items.IndexOfName(str); str2 := ComboBox1.Items.Values[str]; MessageDlg('Search',Format('index:%d, val:%s', [Index, str2]), mtInformation, [mbOK], 0, mbOK); result is 'index:2 val:3 platform is Vista32, Lazarus 1.0.12 Antonio. 2-) I add breakpoint on IndexOfName function, debugger stop there, when click F7 not to go that function, I added breakpoint in IndexOfName function, but never stop in, directly jump to next line on my code. 3-) EDT_User.ItemIndex:= 1; this code not to trigger Text property, text not change /opt/freepascal/2.7.1/rtl/objpas/classes/stringl.incline 784 Kubuntu 13.10 x64 fpc svn update 25886 lazarus svn update 43343 QT -- ___ 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] WinCE and TIdleTimer
Hi Folks. Do you know if there is a chance that the TIdleTimer works in WinCE ? I have a project running on Win32 (Vista) and WinCE. On the Win32 platform, it woks like a charm. The timer OnTimer event fires when expected. No way to have it running on WinCE. Do you something about it ? Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] WinCE and TIdleTimer
Sorry, forgot to mention Lazarus 1.0.12 Win32 + WinCE Antonio. -- Antonio Fortuny Senior Software engineer 220, avenue de la Libert L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] TApplicationProperties
Hi Folks. This problem may be related to my previous post. Wen running a WinCE project on a true Wince pocket machine (Motorola running Windows CE) I get an error message at the very beginning telling me that the class TapplicationProperties is not found =-O Maybe one of those Windows things not implemented in WinCE ? Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Graeme would love this, or not, I think
Le 12/10/2013 13:36, Marco van de Voort a crit: On Fri, Oct 11, 2013 at 05:28:33PM -0400, Dmitry Boyarintsev wrote: There was something similar 1-2 years ago in Great Britain, where education commission recognized pascal languages (Delphi) as the best for education. So the next generation of good developers will come from South Africa. The Department of Education will purchase Delphi and students (and graduates) will be able to use FOSS solution like FPC/Lazarus. Another proof, that pascal is the language that makes sense. One could argue about language, but Delphi as RAD-IDE is definitely not a good choice. Students tend to overfocus on embellishing forms etc, and not spending their time on the more problem-solving oriented assignment. Probably because dolling up the UI is easier and gives instant-gratification. 1 Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- Antonio Fortuny Senior Software engineer 220, avenue de la Libert L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Bug zeros out Pas files.
Hi Dave. I've had the same trouble some time ago and submitted the problem here. Unfortunately I'm not able to find the topic in this forum. It looks like it was before 2012. I wonder if the name of one of the files was concerned. Maybe one with blakns in the name. If I remember well I used this version too. Antonio. Le 07/10/2013 19:00, Dave Coventry a écrit : This is the second time I've experienced this, with different versions of Lazarus on Windows XP 32 bit running as Guest on Virtualbox on a Ubuntu system. The first version was Lazarus-1.0.7-40379-fpc-2.6.0-20130224-win32 and the program suddenly claimed that I had upgraded and wanted to upgrade the User preferences. After which the PAS file on the app I was working on contained 12Kb of zeros. Now, Lazarus 1.1 r40379 FPC 2.6.1 i386-win32-win32/win64 is doing the same. I was working on a significantly larger project, but the main PAS file, it's LFM Form descriptor and the .res, .lps, and .lpi have all had their content replaced with zeros. Also several files in C:\Documents and Settings\dave\Local Settings\Application Data\lazarus have been corrupted. EditorMacros.xml and environmentoptions.xml have both had their content replaced with zeros. Is this a known issue? -- ___ 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
Re: [Lazarus] Bug zeros out Pas files.
Le 08/10/2013 10:14, Dave Coventry a écrit : Hi Antonio, The first one, with Lazarus-1.0.7-40379-fpc-2.6.0-20130224-win32, was with a very standard small App called 'pruler.lpi'. There was only one PAS unit and it was simply called 'Unit1.pas', so (in my case, anyway) there is unlikely to have been naming conflicts. I'm wondering if it has something to do with the VirtualBox I'm using VB a lot myself (home and at work) along with esxi (at work) and I haven't experienced such a problem, except some months (maybe even years) ago. I do not rremember if Lazarus was involved or not. Win32 excepted (Vista box) all others (Linux64, Win64) are in esxi virtual machines. configuration as this doesn't seem to be a common experience amongst Lazarus users (from the response on here, anyway), although it's happened to me twice in the last week, on different Lazarus versions Same for me, until I decided to reinstall from blank. I think this was the solution but I'm not really sure. Antonio. and on separate code projects. Dave -- ___ 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] What's behind an IP address
Hi Folks. This is specifically neither a Lazarus nor an FPC question but because I'm using a Lazarus project (along with Synapse) I ask this question: Having an IP address, which could be the best question to ask to that IP to know what's behind this address ? - Echo (ICMP 7) is not sufficient - Get an SSH connection: if it answers then should be almost certainly a Unix box otherwise can be a Win box - if it a Win box, how to confirm ? Thanks a lot, Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Changing the cursor to hourglass then to default
Le 20/09/2013 15:47, Richard Mace a écrit : Hi, I am trying to change the cursor in my app to busy and then default, when it is going to be busy for a bit. I have changed to cursor := crHourglass and then back to crDefault at the end, but the cursor doesn't update. *Screen.*Cursor := crHourGlass; try ... finally *Screen.*Cursor := crDefault; end; works fine for me in all platforms. Antonio. Even if I put application.processmessages in (after the crHourglass bit). Any ideas? Richard -- ___ 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
Re: [Lazarus] Changing the cursor to hourglass then to default
Le 20/09/2013 16:52, Martin a crit: On 20/09/2013 14:47, Richard Mace wrote: Hi, I am trying to change the cursor in my app to busy and then default, when it is going to be busy for a bit. I have changed to cursor := crHourglass and then back to crDefault at the end, but the cursor doesn't update. Even if I put application.processmessages in (after the crHourglass bit). On some platforms there is an issue, and the cursor image only updates if the mouse moves Yep: WinCE on handheld computers but in a random manner ! Antonio; -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- Antonio Fortuny Senior Software engineer 220, avenue de la Libert L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Add package
Le 18/09/2013 17:03, Graeme Geldenhuys a crit: On 2013-09-18 11:09, Antonio Fortuny wrote: The package is Indy. On a different subject. What is the latest Indy version that works with FPC? I have 10.5.8 here, is that the latest for FPC? I'm currently working with 10.6.0 on Win32, Win64, Linux x86_64 and WinCE Antonio. Regards, - Graeme - -- Antonio Fortuny Senior Software engineer 220, avenue de la Libert L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Add package
Hi All. I run into a Lazarus package install that I've had some months ago but on Win64. This time problem araises into my new Lazarus 1.0.12 in a Linux x86_64 box The package is Indy. The package compilation itself runs OK, no problem. It hes been compiled with -fPIC because it is used in a shared library. When rebuilding the IDE, the following messages are displayed: make: Entering directory `/usr/lib64/lazarus' /usr/bin/make -C ide idepkg make[1]: Entering directory `/usr/lib64/lazarus/ide' /usr/bin/make --assume-new=lazarus.pp lazarus OPT=' -O2 -g- -Xs @/home/sita/.lazarus/idemake.cfg -FU/home/sita/.lazarus/units/x86_64-linux/gtk2 -FE/home/sita/.lazarus/bin -o/home/sita/.lazarus/bin/lazarus' make[2]: Entering directory `/usr/lib64/lazarus/ide' /usr/bin/fpc -gl -Sci -dlclgtk2 -Fu../designer -Fu../debugger -Fu../debugger/frames -Fu../converter -Fu../packager -Fu../packager/frames -Fu../components/custom -Fuframes -Fu. -Fiinclude -Fiinclude/linux -Fi../images -FE.. -FU../units/x86_64-linux/gtk2 -Cg -Fl/usr/lib64/gcc/x86_64-suse-linux/4.7 -Fl/usr/local/lib64 -Fl/usr/local/lib -Flinclude -Fl/etc/ld.so.conf.d/*.conf -O2 -g- -Xs @/home/sita/.lazarus/idemake.cfg -FU/home/sita/.lazarus/units/x86_64-linux/gtk2 -FE/home/sita/.lazarus/bin -o/home/sita/.lazarus/bin/lazarus -dx86_64 lazarus.pp Free Pascal Compiler version 2.6.2 [2013/03/17] for x86_64 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling lazarus.pp PPU Loading /home/sources/packages/Indy10/lib/lib/x86_64-linux/IdStreamVCL.ppu PPU Source: IdStreamVCL.pas not found PPU Source: IdCompilerDefines.inc not found Recompiling IdStreamVCL, checksum changed for IdGlobal IdStream.pas(29,3) Fatal: Can not find unit IdStreamVCL used by IdStream. All units (*.o and *.ppu) have been compiled with the package itself and are visible in the ./lib/x86_64-linux folder I couldn't find something similar in the history. Antonio. . -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Add package
Colved. Recompile indylaz with -Ur option Found trick in http://www.mail-archive.com/lazarus@lists.lazarus.freepascal.org/msg18469.html -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TTreenode.data
Le 17/09/2013 07:16, Richard Mace a écrit : Thanks Antonio, that worked fine. Goodness knows what I was originally doing! Nothing less I did when I started to play with pointers. 8-) Happy to be usefull. Antonio. Richard -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] DB aware components
Hi Folks. Is it normal that when a TDBGrid is dropped onto a TFrame (or descendant) the DataSource property cannot be assigned to a TSqlQuery dropped onto a TDataModule ? In other words, in the properties inspectior of the TDBGrid, the Datasource property shows nothing. The TDataModule is in the uses clause of the TFrame Interface. Otherwise when the TDbGrid is doppêd onto a TForm, the DataSource shows all TDataset descendants dropped into the TDataModule. It appears to be the same for all data aware components that I have tested so far. Finally, assigning the datasource at runtime appears to work. But this is a workaround. Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] DB aware components
Le 16/09/2013 11:12, Mattias Gaertner a écrit : On Mon, 16 Sep 2013 10:52:08 +0200 Antonio Fortuny a.fort...@sitasoftware.lu wrote: Hi Folks. Is it normal that when a TDBGrid is dropped onto a TFrame (or descendant) the DataSource property cannot be assigned to a TSqlQuery dropped onto a TDataModule ? In other words, in the properties inspectior of the TDBGrid, the Datasource property shows nothing. The TDataModule is in the uses clause of the TFrame Interface. Otherwise when the TDbGrid is doppêd onto a TForm, the DataSource shows all TDataset descendants dropped into the TDataModule. It appears to be the same for all data aware components that I have tested so far. Finally, assigning the datasource at runtime appears to work. But this is a workaround. Maybe a result of Juha's change: http://wiki.freepascal.org/Lazarus_1.2.0_release_notes#TComponentPropertyEditor_behavior_was_changed Could be but I'm currently using 1.0.12 and not 1.2. I'm moving and re-engineering a Delphi application and I wonder how much time I'll loose recoding the Datasources properties :-( Mattias -- ___ 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
Re: [Lazarus] DB aware components
In the same way, travelling within a TFrame components doesn't work too. When clicking over any component on the TFrame using either TAB or any other arrow key has no effect. At runtime, it works. Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] DB aware components
Same for TImageList. A TImageList is dropped onto a TDataModule, included in the interface uses, but a TToolBar does not see the TImagesList in the TDataModule. This breaks completely the porting from Delphi. I'm really very disapponted. I've made another test as explained in the Wiki page http://wiki.freepascal.org/Frames - build a new TFrame - add the unit to the project units list (otherwise it is not droppable) - drop it onto a TTabSheet of a TPageCpntrol in the main form - drop a TSqlQuery onto the TFrame: this time, the objects in the TDataModule created before, are displayed in properties of the TFrame components (database for TSqlQuery, i.e.). It's a long way to ... This way does not allow to create independent TFrames and fill them with all pertinent components and code and that's exactly what I need. All the TFrames are independent and dynamically created as the user runs thru the application. Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TTreenode.data
Le 11/09/2013 07:51, Richard Mace a écrit : Hi, Can anyone give me an example of adding and retrieving an integer value to a TTreenode via it's data property please? I've tried the below, but it doesn't seem to work. Set: with tvMain.Items.AddChildObject(tvMain.Selected,'string',TObject(fUserList.Items[I].Id)) do change to: with tvMain.Items.AddChildObject(tvMain.Selected,'string', *Pointer*(fUserList.Items[I].Id)) do and getting as, throws an exception on start: procedure TfrmMain.tvMainChange(Sender: TObject; Node: TTreeNode); begin ShowMessage('Node ' + IntToStr(Integer(Node.Data))); change to: ShowMessage('Node ' + IntToStr(*PtrInt***(Node.Data))); Antonio. end; Thanks in advance Richard -- ___ 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] package FCL
Hi Folks. I want to make some changes and additions to the unit bufdataset.pas incresing dataset possibilities. I've made the changes, compiled and tested using a dynamically created component. So far, so good. Now I want to incorporate the changes in the FCL package fcl-db Vista32, Lazarus 1.0.10, FPC 2.6.2 Compile FPC fcl-db package, and compilation runs OK and my new unit gets compiled (see below for console output) BUT new .o and .ppu are not moved to D:\Programmes\lazarus\fpc\2.6.2\units\i386-win32\fcl-db\ but are kept in D:\Programmes\lazarus\fpc\2.6.2\source\packages\fcl-db\units\i386-win32\ as compilation result Secondly, I guess that the Lazarus pacakge FCL should be compiled as well. The unit RegisterFCL does the TBufDataSet component registration This one also looks good. Then I install the FCL package and rebuild Lazarus. During Lazarus compilation all packages depending on FCL are compiled as well But then I get the classical Lazarus errors: Recompiling sqldb, checksum changed for BufDataset registersqldb.pas(50,38) Fatal: Can not find sqldb used by registersqldb, ppu=..\..\fpc\2.6.2\units\i386-win32\fcl-db\sqldb.ppu, package SQLDBLaz Of course there must be more than opne copy of bufdataset.o( ppu). Which one to keep and which to delete ? I probably miss something but I can't point out what. Maybe some file moves to do by hand ? Thanks for your ideaas. Antonio. Console output FCL compilation D:\*cd D:\Programmes\lazarus\fpc\2.6.2\source\packages\fcl-db\src\base* D:\Programmes\lazarus\fpc\2.6.2\source\packages\fcl-db\src\base *D:\Programmes\lazarus\fpc\2.6.2\bin\i386-win32\make.exe all INSTALL TARGET=i386-win32* D:/Programmes/lazarus/fpc/2.6.2/bin/i386-win32/ppc386.exe -S2h -Fu../dbase -Fu../../../../rtl -Fu../../../../packages/fcl-base -Fu../../../../packages/fcl-xml -FE. -FU../../../../packages/fcl-db/units/i386-win32 -di386 bufdataset.pas Free Pascal Compiler version 2.6.2 [2013/06/09] for i386 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: Win32 for i386 *Compiling bufdataset.pas* bufdataset.pas(50,14) Note: Virtual method TBufBlobStream.Read(var Formal type,LongInt):LongInt; has a lower visibility (protected) than parent class TStream (public) bufdataset.pas(51,14) Note: Virtual method TBufBlobStream.Write(const Formal type,LongInt):LongInt; has a lower visibility (protected) t han parent class TStream (public) bufdataset.pas(52,14) Note: Virtual method TBufBlobStream.Seek(LongInt,Word):LongInt; has a lower visibility (protected) than parent class TStream (public) bufdataset.pas(2223,5) Note: Local variable StoreReadOnly is assigned but never used bufdataset.pas(3747,34) Warning: Function result does not seem to be set 3887 lines compiled, 0.2 sec 1 warning(s) issued 4 note(s) issued D:/Programmes/lazarus/fpc/2.6.2/bin/i386-win32/fpcmake.exe -p -Ti386-win32 Makefile.fpc Processing Makefile.fpc Writing Package.fpc D:/Programmes/lazarus/fpc/2.6.2/bin/i386-win32/ginstall.exe -m 755 -d /pp/units/i386-win32/fcl-db D:/Programmes/lazarus/fpc/2.6.2/bin/i386-win32/cp.exe -fp Package.fpc /pp/units/i386-win32/fcl-db D:/Programmes/lazarus/fpc/2.6.2/bin/i386-win32/ginstall.exe -m 755 -d /pp/units/i386-win32/fcl-db D:/Programmes/lazarus/fpc/2.6.2/bin/i386-win32/cp.exe -fp ../../../../packages/fcl-db/units/i386-win32/dbconst.ppu ../../../../packages/fcl- db/units/i386-win32/db.ppu ../../../../packages/fcl-db/units/i386-win32/dbwhtml.ppu ../../../../packages/fcl-db/units/i386-win32/bufdataset_ parser.ppu ../../../../packages/fcl-db/units/i386-win32/bufdataset.ppu ../../../../packages/fcl-db/units/i386-win32/dbcoll.ppu ../../../../p ackages/fcl-db/units/i386-win32/sqlscript.ppu ../../../../packages/fcl-db/units/i386-win32/xmldatapacketreader.ppu /pp/units/i386-win32/fcl- db D:/Programmes/lazarus/fpc/2.6.2/bin/i386-win32/cp.exe -fp ../../../../packages/fcl-db/units/i386-win32/dbconst.o ../../../../packages/fcl-db /units/i386-win32/db.o ../../../../packages/fcl-db/units/i386-win32/dbwhtml.o ../../../../packages/fcl-db/units/i386-win32/bufdataset_parser .o ../../../../packages/fcl-db/units/i386-win32/bufdataset.o ../../../../packages/fcl-db/units/i386-win32/dbcoll.o ../../../../packages/fcl- db/units/i386-win32/sqlscript.o ../../../../packages/fcl-db/units/i386-win32/xmldatapacketreader.o /pp/units/i386-win32/fcl-db D:\Programmes\lazarus\fpc\2.6.2\source\packages\fcl-db\src\base -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] package FCL
The usual work flow is like this: You alter fpc units and tests them with some test program (ppu files in source\packages\fcl-db\units\...). OK When you are done, you build all fpc packages that depend on these ppus and copy all new files to the install folders (fpc\2.6.2\units\...). Done with units from bufdataset.pas. All the fpc-db has been recompiled and units copied But still doesn't work with Lazarus. Dropping the TBufDataSet onto a Form the new method I added is not seen. My problem seems to be able to re-install the component. When changing a little bit an FPC unit not involved in any Lazarus package, the former trick runs OK and looks pretty good. This time inside the Lazarus IDE the changes I've made to the original unit are not seen. The safest way is too simply rebuild the whole fpc and call make install. Please read the documentation about building and installing fpc. Mattias -- ___ 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
Re: [Lazarus] package FCL
You can use the FPC database test suite for that (e.g. dbtestframework_gui), see e.g. http://wiki.lazarus.freepascal.org/Databases#Running_FPC_database_tests You can add new unit tests to e.g. testspecifictbufdataset.pas When you are done, you build all fpc packages that depend on these ppus and copy all new files to the install folders (fpc\2.6.2\units\...). The safest way is too simply rebuild the whole fpc and call make install. Please read the documentation about building and installing fpc. Additionally, if you want to have your additions to bufdataset incorporated into FPC, please submit a patch against fpc trunk (in other words, please be prepared to copy over your changes to FPC trunk) Looking forward to your updates! Hi Reinier. It's still a little bit too early to acomplish this step. But anyway I'll be glad to do it when I'm satisfied with the additions, including unit tests and some help text. I'll probably need some help form you guys, as I'm not yet used to prepare and make additions neither to FPC nor Lazarus. For the time being I want to change the Lazarus IDE component TBufDataSet. The FPC part looks OK as I can use it only using the unit itself Remains the Lazarus part for which I need obviously some help. BTW, I discovered that the Lazarus package FCL (which registers the TBufDataSet component) is located in $LAZARUS\packager\registration. Looks funny. Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- Antonio Fortuny Senior Software engineer 220, avenue de la Libert L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] package FCL
Le 05/09/2013 15:50, Reinier Olislagers a crit: It's still a little bit too early to acomplish this step. But anyway I'll be glad to do it when I'm satisfied with the additions, including unit tests and some help text. OK - just to clarify if needed: the tests mentioned above are unit tests for the FPC db units, including bufdataset, so any unit tests you'd like to add could be added there ;) I'm used since a long time now to build DUnit projects for almost everything I write. So don't worry Of course, unit tests for Lazarus components are a different story... Good luck with the Lazarus part! Thanks. I'll let you know as soon as I'm ready. This will take some weeks. So, be patient ;-) -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- Antonio Fortuny Senior Software engineer 220, avenue de la Libert L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Threads
Hi Folks. I'm facing a problem where threads are involved. I have a test program with a main form and using threads. When I run without threads, a Close button executed the TForm.Close method and the program terminates without problem. But when the threads (one or more) on closing, the TForm.Close method is still executed but the program continues execution. All other components on the main form are still active. As if the Close action had no effect. The same behaviour is observed in Win32 and Linux. Ther is the Execute method of the thread: procedure TMsgTread.Execute; var PFileEvent: pDirNotifyEvent; FileName: String; len: Integer; Counter: Integer=0; Delay: Integer; begin Delay := MAX_DELAY; FRunning := True; while not terminated do begin if Delay = 0 then begin PFileEvent := new(pDirNotifyEvent); PFileEvent^.FileName := nil; Inc(Counter); FileName := Format('#%d file from_thread:%3.3d', [FID, Counter]); len := Length(FileName); PFileEvent^.FileNameSize := len; ReAllocMem(PFileEvent^.FileName, len + 1); Move(PChar(FileName)^, PFileEvent^.FileName^, len); (PFileEvent^.FileName + len)^ := #0; PFileEvent^.Actions := [fnaNewFile, fnaModified]; PostQMessage(FMessageQ, FILE_EVENT, PFileEvent^.FileName, PFileEvent); Delay := MAX_DELAY; end; Sleep(FTimeOut); Dec(Delay, FTimeOut) end; PostQMessage(FMessageQ, 0, Format('thread #%d terminated', [FID]), nil); FRunning := False end; the theards launching code: for NThreads := 1 to EThreads.Value do begin FMsgTread := TMsgTread.Create; FMsgTread.SendToHandle := Self.Handle; FMsgTread.ID := NThreads; FMsgTread.MessageQ := FmsgQ; FMsgTread.FMessageID := USER_FILE_MONITOR; FMsgTread.TimeOut := wTimeOut; ATh[NThreads - 1] := FMsgTread; ATh[NThreads - 1].Start; Inc(wTimeOut, 40); if wTimeOut 400 then wTimeOut := 100 + NThreads; FMsgTread := nil end; and the threads stop code: for NThreads := 1 to EThreads.Value do begin Memo1.Lines.Add(Format('Stoppting thread #%d', [NThreads])); FMsgTread := ATh[NThreads - 1]; FMsgTread.Terminate; WaitForThreadTerminate(FMsgTread.Handle, MAX_DELAY); FreeAndNil(FMsgTread); ATh[NThreads - 1] := nil; Application.ProcessMessages end; Thanks. Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Threads
Sorry, I did forget some information: Win32: Lazarus 1.0.10 Linux: x86_64, Lazarus 1.0.8 The threads are defined in the main form. When the threads are used, the program does not hang, the main form gains control but the program does not terminate. Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Threads
Le 27/08/2013 11:22, Michael Schnell a écrit : FTimeOut needs to be (a lot) lower than MAX_DELAY. Timeout runs from 100 to about 400 ms whereas MAX_DELAY. is fixed to 600 ms You should note that all threads send the last message to the Q which means that the Terminate has been trapped. Antonio. -Michael -- ___ 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
Re: [Lazarus] Shell notifications
Hi All. I've built some code which works fine under Linux. I'm now working on the Windows part using FindFirstChangeNotificationA to get the directory handle and ReadDirectoryChangesW to fetch events data. And I'm blocked there. The receiving buffer is set to 32kb. After changing a file content, ReadDirectoryChangesW does not return any error but the return length is crazy (28 megs) and nothing in the returned buffer contents looks right. After reading some ms docs I've read thah the buffer has to be DWORD aligned. So there is may question: how to do that ? Thanks, Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Shell notifications
See the code in attachment I changed the code a little bit adding the OVERLAP parameter and events to use the async method. Now the same function returns error code 6 Antonio. procedure TFrmMain.StartNotify(const FolderName: String); {$IFDEF LINUX} function decodeMask(Mask:Longint):string; var Rslt:String; begin Rslt:=''; if (Mask and IN_ACCESS)=IN_ACCESS then Rslt:=Rslt+' File was accessed.'; if (Mask and IN_MODIFY)=IN_MODIFY then Rslt:=Rslt+' File was modified.'; if (Mask and IN_ATTRIB)=IN_ATTRIB then Rslt:=Rslt+' Attribute was changed.'; if (Mask and IN_CLOSE_WRITE)=IN_CLOSE_WRITE then Rslt:=Rslt+' Writtable file was closed.'; if (Mask and IN_CLOSE_NOWRITE)=IN_CLOSE_NOWRITE then Rslt:=Rslt+' Unwrittable file was closed.'; if (Mask and IN_CLOSE)=IN_CLOSE then Rslt:=Rslt+' File was closed.'; if (Mask and IN_OPEN)=IN_OPEN then Rslt:=Rslt+' File was opened.'; if (Mask and IN_MOVED_FROM)=IN_MOVED_FROM then Rslt:=Rslt+' File was moved from '; if (Mask and IN_MOVED_TO)=IN_MOVED_TO then Rslt:=Rslt+' File was moved to '; if (Mask and IN_MOVE)=IN_MOVE then Rslt:=Rslt+' File is moving'; if (Mask and IN_CREATE)=IN_CREATE then Rslt:=Rslt+' Subfile was created'; if (Mask and IN_DELETE)=IN_DELETE then Rslt:=Rslt+' Subfile was deleted'; if (Mask and IN_DELETE_SELF)=IN_DELETE_SELF then Rslt:=Rslt+' Self was deleted'; if (Mask and IN_MOVE_SELF)=IN_MOVE_SELF then Rslt:=Rslt+' Self was moved'; if (Mask and IN_UNMOUNT)=IN_UNMOUNT then Rslt:=Rslt+' Filesystem was unmounted'; if (Mask and IN_Q_OVERFLOW)=IN_Q_OVERFLOW then Rslt:=Rslt+' Event queued overflowed'; if (Mask and IN_IGNORED)=IN_IGNORED then Rslt:=Rslt+' File was ignored'; if (Mask and IN_ONLYDIR)=IN_ONLYDIR then Rslt:=Rslt+' Only watch the path if it is a directory'; if (Mask and IN_DONT_FOLLOW)=IN_DONT_FOLLOW then Rslt:=Rslt+' Do not follow a sym link'; if (Mask and IN_MASK_ADD)=IN_MASK_ADD then Rslt:=Rslt+' Add to the mast of an already existing watch'; if (Mask and IN_ISDIR)=IN_ISDIR then Rslt:=Rslt+' Event occurred against dir'; if (Mask and IN_ONESHOT)=IN_ONESHOT then Rslt:=Rslt+' Only send event once'; decodeMask:=Rslt; end; {$ENDIF} {$IFDEF MSWINDOWS} function decodeMask(Mask:Longint):string; var Rslt:String; begin Result := ''; if (Mask and FILE_ACTION_ADDED) = FILE_ACTION_ADDED then Result := Result + ' file ADDED'; if (Mask and FILE_ACTION_REMOVED) = FILE_ACTION_REMOVED then Result := Result + ' file REMOVED'; if (Mask and FILE_ACTION_MODIFIED) = FILE_ACTION_MODIFIED then Result := Result + ' file CHANGED'; end; {$ENDIF} var wFolderName: String; FileName: String; Timeout: Integer=200; Buffer: PChar; PData: Pointer; P: Integer; {$IFDEF LINUX} Ret: Integer; instance_handle: cint; notify_handle: cint; rfds: tfdset; length: Integer; iEvent: inotify_event; buflen: Integer=(SizeOf(iEvent) + 16) * 512; evnt: Pinotify_event; TotalRead: TSsize; FileName: String; {$ENDIF} {$IFDEF MSWINDOWS} wHandle: THANDLE; Ret: Integer; Res: BOOL; pFileInfo: PFILE_NOTIFY_INFORMATION; buflen: DWORD=SizeOf(FILE_NOTIFY_INFORMATION) * 512; TotalRead: DWORD; Error: Integer; Overlap: OVERLAPPED; events: array[0..1] of THANDLE; Ev1: TEvent; Ev2: TEvent; {$ENDIF} begin wFolderName := ExcludeTrailingPathDelimiter(Trim(FolderName)); {$IFDEF MSWINDOWS} wHandle := FindFirstChangeNotificationA(PChar(wFolderName), DWORD(LongBool(False)), FILE_NOTIFY_CHANGE_SIZE + FILE_NOTIFY_CHANGE_LAST_WRITE); try if wHandle = INVALID_HANDLE_VALUE then begin MessageDlg('Error','Invalid notify handle', mtError, [mbOK], 0, mbOK); Exit end; Ev1 := TEvent.Create(nil, False, False, 'FEV1_tralala'); Ev2 := TEvent.Create(nil, False, False, 'FEV2_tralala'); events[0] := THANDLE(Ev1.Handle); events[1] := THANDLE(Ev2.Handle); FillMemory(@Overlap, SizeOf(OVERLAPPED), byte(#0)); Overlap.hEvent := THANDLE(Ev1.Handle); FStopNotify := False; PData := nil; buflen := 32 * 1024; ReAllocMem(PData, buflen); //Buffer := system.Align(PData, 16); Buffer := PData; while not FStopNotify do begin Ret := WaitForSingleObject(wHandle, 200); if Ret = WAIT_OBJECT_0 then begin FillMemory(PData, buflen, byte(#0)); Res := ReadDirectoryChangesW(wHandle, Buffer, buflen, False, FILE_NOTIFY_CHANGE_FILE_NAME + FILE_NOTIFY_CHANGE_SIZE + FILE_NOTIFY_CHANGE_LAST_WRITE, @TotalRead, @Overlap, nil); if not Res then begin Error := GetLastError; FStopNotify := True; Memo1.Lines.Add(Format('error on read changes: %d %s', [Error, SysErrorMessage(Error)]));
Re: [Lazarus] Shell notifications
Le 22/08/2013 14:06, Henry Vermaak a écrit : On Thu, Aug 22, 2013 at 01:49:28PM +0200, Sven Barth wrote: Am 22.08.2013 13:33, schrieb Antonio Fortuny: See the code in attachment I changed the code a little bit adding the OVERLAP parameter and events to use the async method. Now the same function returns error code 6 Error code 6 is ERROR_INVALID_HANDLE (would be nice if you'd mention the error message as well next time when you're already using SysErrorMessage). FindFirstChangeNotification returns a notification handle, but ReadDirectoryChanges requires a directory handle (with FILE_LIST_DIRECTORY priviledge), so you need to open the directory yourself. To add to this, the remarks section on msdn says this: To obtain a handle to a directory, use the CreateFile function with the FILE_FLAG_BACKUP_SEMANTICS flag. In addition to this you're also passing an OVERLAPPED record to ReadDirectoryChangesW(), so you'll have to use FILE_FLAG_OVERLAPPED when you open the directory, too. This did it. Don't even need FindFirstChangeNotification Thanks Antonio. Henry -- ___ 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] Shell notifications
Hi Folks. Do you know any component / tool to allow an application to be notified by the host OS when something changes in a disk directory ? Both Windows Linux. Thanks, Antonio. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus