Re: [fpc-devel] procedure ... message(); in Linux
Zitat von Michael Schnell : On 03/01/2010 10:36 AM, Mattias Gaertner wrote: You need lazarus 0.9.29. I might try to get this running some day soon Try that on "PostMessage". I get a method in unit InterfaceBase and a procedure in unit LCLIntf. Obviously you want the last. I've not yet been able top find the Linux definition of same. Keeping on trying Mattias ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
Zitat von Juha Manninen : Hi, What gave no feedback? Ok, I tested again with a non-typical situation. I worked with lazarus.lpi and built Lazarus from tools -> Configure Build Lazarus. The error messages show up just like when compiling a "normal" project but "search identifier" does nothing. I tested with lazarus.lpi: It works. Do you have english messages? Now I tested with a "normal" project and it works. It is a cool feature actually. I noticed a minor bug: the Scope combobox gets "Project" by default. If I click the down-arrow to see a list then the first "Lazarus IDE" gets selected automatically. I guess you forgot to set Combobox.ItemIndex and only set its text. It didn't matter for me. I now set the ItemIndex. Does that fix it? BTW, what does the Scope do? If I comment out SysUtils in my source, it always finds the missing function under FCL, whatever scope I select. That's the interesting difference between the codebrowser and a find declaration. Find declaration will search only via the uses sections and search paths. The codebrowser searches in whole packages and projects. That's why it can tell you in which unit an identifier is defined. If you set scope to 'project' it will search in all units of the project. If you check the 'with packages' it will search in all packages required by the project too. This normally includes the FCL package, so it will search in all units installed by FPC. Mattias ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 03/01/2010 10:43 AM, Juha Manninen wrote: > > You must first select the error saying "identifier not found" and then right > click on it. > I only can select a complete line in the message window. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 03/01/2010 10:36 AM, Mattias Gaertner wrote: > > You need lazarus 0.9.29. > I might try to get this running some day soon Try that on "PostMessage". I've not yet been able top find the Linux definition of same. Keeping on trying -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
Hi, > What gave no feedback? Ok, I tested again with a non-typical situation. I worked with lazarus.lpi and built Lazarus from tools -> Configure Build Lazarus. The error messages show up just like when compiling a "normal" project but "search identifier" does nothing. Now I tested with a "normal" project and it works. It is a cool feature actually. I noticed a minor bug: the Scope combobox gets "Project" by default. If I click the down-arrow to see a list then the first "Lazarus IDE" gets selected automatically. I guess you forgot to set Combobox.ItemIndex and only set its text. BTW, what does the Scope do? If I comment out SysUtils in my source, it always finds the missing function under FCL, whatever scope I select. Juha ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On Mon, 1 Mar 2010 11:43:23 +0200 Juha Manninen wrote: > Hi, > > > All these are very interesting options I was not aware of, but > > unfortunately no search for identifiers. > > You must first select the error saying "identifier not found" and then right > click on it. > > I tested it with some broken code and it gave no feedback at all. I think it > should always give some message. What gave no feedback? Mattias ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On Mon, 01 Mar 2010 10:14:50 +0100 Michael Schnell wrote: > On 02/26/2010 04:10 PM, Mattias Gaertner wrote: > > ' > > There are several tools in Lazarus for this: > > - click compile, fpc will give "identifier not found", right click on > > the message - popup menu - search identifier. This will search all > > units. On first time it may take a minute to scan > > the about 1000 units of fpc. > > > > Thanks a lot, > Sorry but no :( > Right-Clicking the message gives: > - Create local Variable You need lazarus 0.9.29. - Search identifier > - Clear > - Copy selected messages to clipboard > - copy all messages to clipboard > - copy all and hidden messages to clipboard > - Help > - Save all messages to file > > All these are very interesting options I was not aware of, but > unfortunately no search for identifiers. > > > - search / find in files > > > > Can search in > - Project Files > - open files > - a given directory. > > (1) and (2) are not helpful, > > (3) Of course I often did search the FPC or LCL sources using standard > keyword search but here I get all the instances not just the definition > and of course with these system functions there are several definitions > that are included in the active sources or not depending on the > compile-target. Wait until it finds the first, stop the search. Do find declaration on the first found. Mattias ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
Hi, > All these are very interesting options I was not aware of, but > unfortunately no search for identifiers. You must first select the error saying "identifier not found" and then right click on it. I tested it with some broken code and it gave no feedback at all. I think it should always give some message. Regards, Juha ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/26/2010 10:21 AM, Mattias Gaertner wrote: > > PostMessage is threadsafe, dispatch is not. > Not only thread-save, but thread traversing, which is the proper function of the message delivering library service. Seemingly the function names are wisely chose (regarding the work of a parcel service that uses a store-and foreword warehouse): Dispatch() performs the local (i.e. within the same thread) delivery to the final recipient. This is to be done by the library itself (the parcel service agent). PostMessage() performs giving the message to the library to have it transport it to the main thread (the remote location)., This is to be done by the user software (the client of the parcel service. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/26/2010 04:10 PM, Mattias Gaertner wrote: > ' > There are several tools in Lazarus for this: > - click compile, fpc will give "identifier not found", right click on > the message - popup menu - search identifier. This will search all > units. On first time it may take a minute to scan > the about 1000 units of fpc. > Thanks a lot, Sorry but no :( Right-Clicking the message gives: - Create local Variable - Clear - Copy selected messages to clipboard - copy all messages to clipboard - copy all and hidden messages to clipboard - Help - Save all messages to file All these are very interesting options I was not aware of, but unfortunately no search for identifiers. > - search / find in files > Can search in - Project Files - open files - a given directory. (1) and (2) are not helpful, (3) Of course I often did search the FPC or LCL sources using standard keyword search but here I get all the instances not just the definition and of course with these system functions there are several definitions that are included in the active sources or not depending on the compile-target. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On Fri, 26 Feb 2010 10:46:09 +0100 Michael Schnell wrote: > On 02/26/2010 10:19 AM, Mattias Gaertner wrote: > > > > SendMessage is defined in unit LCLIntf and implemented in the > > LCL interfaces. > > > > Great ! This is the info I needed. > > with "uses LCLIntf" it gets compiled. There are several tools in Lazarus for this: - click compile, fpc will give "identifier not found", right click on the message - popup menu - search identifier. This will search all units. On first time it may take a minute to scan the about 1000 units of fpc. - search / find in files Mattias ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/26/2010 10:19 AM, Mattias Gaertner wrote: > > SendMessage is defined in unit LCLIntf and implemented in the > LCL interfaces. > Great ! This is the info I needed. with "uses LCLIntf" it gets compiled. Thanks, -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/26/2010 10:21 AM, Mattias Gaertner wrote: > PostMessage is threadsafe, dispatch is not. > This is what I did suppose. Now I need to find out how to call PostMessage (as "uses Classes" does not make it visible). -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/26/2010 10:03 AM, Graeme Geldenhuys wrote: > Michael Schnell wrote: > >> 1) "procedure...message" does wok in Linux >> 2) it can be triggered by "Dispatch". >> > > And this is what I have been telling you since the start! :-) > I did not see the relevance, as I did not suppose that Dispatch is thread save and "procedure ...message" does not make any sense at all it it needs to be triggered from the Main thread, simulating - more or less - a normal function call. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
26.02.2010 16:19, Mattias Gaertner wrote: SendMessage is defined in unit LCLIntf and implemented in the LCL interfaces. In the end it calls Dispatch. AFAIK under gtk it does not support sending messages to/from other apps. As far as I remember both are using same messaging subsystem of gtk. At least it is so for qt and win32. Best regards, Paul Ishenin. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On Fri, 26 Feb 2010 09:53:44 +0100 Michael Schnell wrote: > OK, Thisa does take me one step further. > > 1) "procedure...message" does wok in Linux > 2) it can be triggered by "Dispatch". > > This is good news, as FPC/Lazarus is confirmed to work as expected. :) > This is bad news as now I need to consider "procedure...message" when > doing the NoGUIApplication package. ;) > > What I now need to know is the exact spec of "Dispatch". Can it be > legally used in a thread (like PostMessage in Windows can)? PostMessage is threadsafe, dispatch is not. Mattias ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On Fri, 26 Feb 2010 09:41:15 +0100 Michael Schnell wrote: > On 02/25/2010 07:47 PM, David W Noon wrote: > > > > for a couple of years. Provided you are using Lazarus classes, it > > works just like Windows: the PostMessage() and SendMessage() functions > > in the LCLIntf unit provide closely analogous functionality to their > > Win32 API namesakes. [In all the applications I have written to > > exploit this, I used the Gtk2 widget set.] > > > > I'll try to find "PostMessage" in the LCL source code (once again). > > > What is it that you cannot get working? > > > > When compiling, I get "Identifier not found: Postmessage", even though I > do have "uses Classes" in a standard "Application" project. Classes is not part of the LCL. SendMessage is defined in unit LCLIntf and implemented in the LCL interfaces. In the end it calls Dispatch. AFAIK under gtk it does not support sending messages to/from other apps. Mattias ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
Michael Schnell wrote: > > 1) "procedure...message" does wok in Linux > 2) it can be triggered by "Dispatch". And this is what I have been telling you since the start! :-) Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
OK, Thisa does take me one step further. 1) "procedure...message" does wok in Linux 2) it can be triggered by "Dispatch". This is good news, as FPC/Lazarus is confirmed to work as expected. :) This is bad news as now I need to consider "procedure...message" when doing the NoGUIApplication package. ;) What I now need to know is the exact spec of "Dispatch". Can it be legally used in a thread (like PostMessage in Windows can)? Thanks a lot for your support ! -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/25/2010 07:47 PM, David W Noon wrote: > > for a couple of years. Provided you are using Lazarus classes, it > works just like Windows: the PostMessage() and SendMessage() functions > in the LCLIntf unit provide closely analogous functionality to their > Win32 API namesakes. [In all the applications I have written to > exploit this, I used the Gtk2 widget set.] > I'll try to find "PostMessage" in the LCL source code (once again). > What is it that you cannot get working? > When compiling, I get "Identifier not found: Postmessage", even though I do have "uses Classes" in a standard "Application" project. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/25/2010 06:59 PM, Mattias Gärtner wrote: > > Maybe if you provide a more complete example, some Linux users can > help you. Sorry, but an example how "procedure ... message" can be used in Linux is what I am requesting. A working example in Windows is trivial. Here it works exactly as in Delphi and can be triggered e.g. by "postmessage()" (which of course is a non portable Windows API call). I also would be content when I would get an official statement that "procedure ... message" is not supposed to be functional in a Linux environment. But in this case I vote for having the compiler issue an error message. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On Thu, 25 Feb 2010 17:59:05 +0100, Michael Schnell wrote about Re: [fpc-devel] procedure ... message(); in Linux: > Can't anyone answer the question if in Linux the legal and compilable > construct > > procedure... message; > > either > > is not supposed to be working > > or > > how I can have such a procedure be executed (e.g. by posting a message > from a thread or another application, what I successfully did in > Windows. I have been using the Message option on Procedure/Function declarations for a couple of years. Provided you are using Lazarus classes, it works just like Windows: the PostMessage() and SendMessage() functions in the LCLIntf unit provide closely analogous functionality to their Win32 API namesakes. [In all the applications I have written to exploit this, I used the Gtk2 widget set.] What is it that you cannot get working? -- Regards, Dave [RLU #314465] === david.w.n...@ntlworld.com (David W Noon) === ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
25.02.2010 19:59, Michael Schnell: Can't anyone answer the question if in Linux the legal and compilable construct procedure... message; either is not supposed to be working Is is working fine on linux, see my example below. or how I can have such a procedure be executed (e.g. by posting a message from a thread or another application, what I successfully did in Windows. Some sort of IPC is necessary as a ground for that. On windows, PostMessage/GetMessage mechanism is always available and it does not require any additional libraries (as it is an integral part of the system), so it is used most of the time. On linux, there is no such "global default" (AFAICS), but you are free to choose some existing library or create your specific implementation based on OS functionality directly (like my favourite pipes or whatever). Nikolai -- cut --- {$mode delphi} {$ifdef win32 }{$apptype console }{$endif } const const_my_msg = $7FFF; type TMyMessage = record Msg: Cardinal; SomeData1: byte; end; TSomeTestObj = class procedure msg_my_msg_proc(var Msg: TMyMessage); message const_my_msg; end; procedure TSomeTestObj.msg_my_msg_proc(var Msg: TMyMessage); begin writeln('I got called! SomeData1 = ', Msg.SomeData1); end; var o: TSomeTestObj; m: TMyMessage; begin m.Msg := const_my_msg; m.SomeData1 := 1; o := TSomeTestObj.Create; o.Dispatch(m); o.Free; end. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
Zitat von Michael Schnell : Can't anyone answer the question if in Linux the legal and compilable construct procedure... message; either is not supposed to be working or how I can have such a procedure be executed (e.g. by posting a message from a thread or another application, what I successfully did in Windows. Maybe if you provide a more complete example, some Linux users can help you. Mattias ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
P.S.: I found out that homeip,net is banned here in the company's network, as in the past, there have been some frauds using this. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
> So about a week ago I setup a .htaccess in the > opensoft.homeip.net root website to block some of those domains. > > Is your domain listed in any of these? > > --- > # Deny hosts or spam domains > RewriteCond %{REMOTE_HOST} sputnikmedia.net [NC,OR] > RewriteCond %{REMOTE_HOST} cuil.com [NC,OR] > RewriteCond %{REMOTE_HOST} altushost.com [NC,OR] > RewriteCond %{REMOTE_HOST} ufanet.ru [NC] > --- > Nope it's "lumino.de". (And I of course can't see your .haccess file :( , either. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
Michael Schnell wrote: > On 02/18/2010 05:35 PM, Michael Schnell wrote: >> I'll try at home >> > It works at home, No idea why it is blocked here. Is this a kind of > spam-prone server ? In this last month I was bombarded with web crawlers even though I have a robots.txt file setup. So about a week ago I setup a .htaccess in the opensoft.homeip.net root website to block some of those domains. Is your domain listed in any of these? --- # Deny hosts or spam domains RewriteCond %{REMOTE_HOST} sputnikmedia.net [NC,OR] RewriteCond %{REMOTE_HOST} cuil.com [NC,OR] RewriteCond %{REMOTE_HOST} altushost.com [NC,OR] RewriteCond %{REMOTE_HOST} ufanet.ru [NC] --- I only set up the blocking for the http://opensoft.homeip.net site. Can you access any of the other virtual sites hosted on our server? http://capture.myphotos.cc or http://mastermaths.dnsalias.com Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/18/2010 10:26 PM, Graeme Geldenhuys wrote: > > Just thought of something else. Not sure if this is a solution, > Thanks a lot for your support, but in fact I am not seeking for a solution, but the question is if the compilable FPC construct "procedure ... message" works at all in (Lazarus /) Linux and what it can be used for. I could verify, that with (Lazarus /) Windows "procedure ... message" can fetch windows system messages and messages to a window generated by a thread (I did not yet test sending windows messages from another application, but as I used postmessage() and not postthreadmessage(), I suppose it will work as well. I did not get postthreadmessage working in Lazarus/Windows nor in Delphi yet.) -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
I suppose it's a glitch of our office's ID. Sorry for the inconvenience. Thanks, -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/18/2010 05:35 PM, Michael Schnell wrote: > I'll try at home > It works at home, No idea why it is blocked here. Is this a kind of spam-prone server ? -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/18/2010 10:16 PM, Nikolai Zhubr wrote: > ... if you are going to make this messaging work to some degree in > non-main thread on windows, you'll probably need to take care of some > things manually. Of course you are right that the Delphi / Windows paradigm only allows for a single message queue and same is dedicated to the main thread as a receiver. Lazarus / Windows uses the same algorithm as Delphi. Lazarus / Linux reproduces the same behavior with a different algorithm. For now, the NoGUIApplication Lazarus package I am planning, is suppose to reproduce this behavior, too, with a home-brew message queue. For the future I think about having the home-brew message queue done in a way that allows for multiple instances of same and thus allow for worker threads to be programmed using an event-driven paradigm. > When I ported some threaded delphi application to linux I replaced > window handles (used for inter-thread communication) by unix pipes. While this of course is possible, I suppose a pure user-land algorithm should offer better performance. > These are not exactly the same, but generally provide sufficient > functionality and are quite easy to use. No idea if it is anywhere > appropriate in your case, though. The event queue (ported form mse) already does work nicely for me (e.g. with for timer events, TThread.Synchronize). I just wonder if supporting procedure ... messages in the package is possible / viable / necessary. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 17 February 2010 16:47, Michael Schnell wrote: > What messages does it capture ? > How to send a message from a thread ? Just thought of something else. Not sure if this is a solution, but it might head you in the right direction. Have a look at two behavioural design patterns: Chain of Responsibility, Command. These patterns describe something like what you are trying to do. If you can't find documentation on these, I can email you the two chapters from the Design Patterns (GoF) book. -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
18.02.2010 16:16, Michael Schnell: [trim] use "procedure message". But In Delphi/Windows you don't need to create a server. Just using "procedure message" is enough o receive a message from another process. No. AFAIK even in Delphi, "message procedures" for non-components are pretty much abstract (and probably almost useless). The messaging system you are talking about only works automagically for components belonging to the Application component (and is therefore limited to the main thread). If you create a thread in Delphi (even a Tthread descendant) you will not be able to insert components to it, because it is not a component itself. So, if you are going to make this messaging work to some degree in non-main thread on windows, you'll probably need to take care of some things manually. First, you'll need some window handle created within your thread, as otherwise OS will not even create a message queue for this thread. Delphi won't do this for you, AFAIK. Then, in the body of your thread, you'll need to regularily fetch new messages (GetMessage or PeekMessage etc) and actually dispatch them to some objects (maybe to this very tthread object for instance). If this is possible with FPC/Linux, I should make sure that it's still possible with the NoGUIApplication package. When I ported some threaded delphi application to linux I replaced window handles (used for inter-thread communication) by unix pipes. These are not exactly the same, but generally provide sufficient functionality and are quite easy to use. No idea if it is anywhere appropriate in your case, though. Hope this helps:) Nikolai -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 18 February 2010 17:44, Michael Schnell wrote: > > Of course I did try this, but the project seems to be abandoned: It works fine here (from the office and home). I can also assure you the project is not abandoned. :) I use it daily in our company and am currently busy putting together the next (long overdue) release. The project website is hosted on our company servers. We sometimes get minor internet outages (we have ADSL), but I wasn't aware of any today. -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 18 February 2010 15:41, Michael Schnell wrote: > > my fpc sources don't have any fpg* files other than fpglibc* and fpgtk*. > > Lazarus does have a directory /lazarus/lcl/interfaces/fpgui/ but it does > not contain a file fpg_main.* and fpgPostMessage is not mentioned in any > file :(. Sorry for the confusion. I was talking about fpGUI, so thought it would be obvious to look in the fpGUI repository for those methods and units. fpGUI is not part of FPC or Lazarus, it's a separate project like MSEgui. fpGUI Home page: http://opensoft.homeip.net/fpgui/ SourceForge project page http://sourceforge.net/projects/fpgui/ Direct repository access: git clone git://fpgui.git.sourceforge.net/gitroot/fpgui/fpgui -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/18/2010 04:50 PM, Jonas Maebe wrote: > > On 18 Feb 2010, at 16:44, Michael Schnell wrote: > >> Of course I did try this, but the project seems to be abandoned: >> >> http://opensoft.homeip.net/fpgui/ >> >> ERROR >> >>The requested URL could not be retrieved > > It works fine here. > I'll try at home -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/18/2010 05:12 PM, Marc Weustink wrote: > > Nope. On non windows widgetrsets, lazarus implements its own > messagequeue which is handled in application.Idle. I'll try to find out how this works(and how things like Timer and the waiting for events are done). Maybe it's an alternative to use this code instead of the mse code (which actually does run fine for me when (ported and) compiled with Lazarus) for NoGUIApplication. -Thanks, -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
Michael Schnell wrote: On 02/18/2010 02:48 PM, Sergei Gorelkin wrote:If this is possible with FPC/Linux, I should make sure that it's still possible with the NoGUIApplication package. Windows has a built-in transport for the messages, Linux doesn't. Of course there are libraries providing similar or even better functionality, but you end up depending on particular library. I do know this. This is why I need to port Martin's NoGUIApplication, which has an internal message queue, to Lazarus, I suppose with Linux, FPC (or Lazarus ? ) uses X11 as a message queue provider. Nope. On non windows widgetrsets, lazarus implements its own messagequeue which is handled in application.Idle. On some widgetsets (iirc Carbon and QT) this messagequeue is mixed with the messagequeue if that widgetset. But I was not yet able to find out how to post a message into the X11 queue (with a thread or another application) and capture this message by an FPC "procedure ... message" construct. (with FPC/Lazarus on Windows this does work fine using Windows messages) AFAIK, X11 has no messagequeue but is based on callbacks. If it does work with Linux/X1, I need to think how to make it work with NoGUIApplication, as well. If it does not work in Linux, anyway, I don't think I'll bother. Marc ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 18 Feb 2010, at 16:44, Michael Schnell wrote: Of course I did try this, but the project seems to be abandoned: http://opensoft.homeip.net/fpgui/ ERROR The requested URL could not be retrieved It works fine here. Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/18/2010 02:49 PM, Jonas Maebe wrote: > > http://www.google.com/search?q=fpgui > Of course I did try this, but the project seems to be abandoned: http://opensoft.homeip.net/fpgui/ ERROR The requested URL could not be retrieved ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/18/2010 02:48 PM, Sergei Gorelkin wrote:If this is possible with FPC/Linux, I >> should make sure that it's still possible with the NoGUIApplication >> package. >> > Windows has a built-in transport for the messages, Linux doesn't. Of > course there > are libraries providing similar or even better functionality, but you > end up depending > on particular library. I do know this. This is why I need to port Martin's NoGUIApplication, which has an internal message queue, to Lazarus, I suppose with Linux, FPC (or Lazarus ? ) uses X11 as a message queue provider. But I was not yet able to find out how to post a message into the X11 queue (with a thread or another application) and capture this message by an FPC "procedure ... message" construct. (with FPC/Lazarus on Windows this does work fine using Windows messages) If it does work with Linux/X1, I need to think how to make it work with NoGUIApplication, as well. If it does not work in Linux, anyway, I don't think I'll bother. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 18 Feb 2010, at 14:41, Michael Schnell wrote: Lazarus does have a directory /lazarus/lcl/interfaces/fpgui/ but it does not contain a file fpg_main.* and fpgPostMessage is not mentioned in any file :(. http://www.google.com/search?q=fpgui Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
Michael Schnell wrote: Yep. Here you need to do a server and a client and it does not seem to use "procedure message". But In Delphi/Windows you don't need to create a server. Just using "procedure message" is enough o receive a message from another process. Things are more complicated than that. At the very least Delphi application must receive the message from system (using GetMessage() or other API), determine the target object and call its Dispatch method with message as parameter. If this is possible with FPC/Linux, I should make sure that it's still possible with the NoGUIApplication package. Windows has a built-in transport for the messages, Linux doesn't. Of course there are libraries providing similar or even better functionality, but you end up depending on particular library. Sergei ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/18/2010 09:21 AM, Graeme Geldenhuys wrote: > > fpGUI has an internal event queue which later gets dispatched to the target > using TObject.Dispatch(). fpGUI v0.4 and earlier used a Object based even > system and had it's own distribution functions. Later version of fpGUI uses > Record based messages and the 'message' language feature of Object Pascal. > > fpGUI has the following procedures defined in fpg_main.pas unit that work > with the message queue. > > procedure fpgPostMessage(Sender, Dest: TObject; MsgCode: integer; var > aparams: TfpgMessageParams); overload; > my fpc sources don't have any fpg* files other than fpglibc* and fpgtk*. Lazarus does have a directory /lazarus/lcl/interfaces/fpgui/ but it does not contain a file fpg_main.* and fpgPostMessage is not mentioned in any file :(. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/18/2010 09:21 AM, Graeme Geldenhuys wrote: > >> How to send a message from another process ? >> > > On example would be to use IPC as defined in the SimpleIPC unit - part of > FCL. SimpleIPC documentation can be found at: > > http://www.freepascal.org/docs-html/fcl/simpleipc/index.html > > Yep. Here you need to do a server and a client and it does not seem to use "procedure message". But In Delphi/Windows you don't need to create a server. Just using "procedure message" is enough o receive a message from another process. If this is possible with FPC/Linux, I should make sure that it's still possible with the NoGUIApplication package. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
Thanks for your valuable hints ! On 02/18/2010 09:21 AM, Graeme Geldenhuys wrote: > You can obviously use other custom communications methods too. > Of course I do know this, my current goal is to explore if/how I need to support "procedure...message" with the upcoming NoGUIApplication package. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
On 02/17/2010 05:46 PM, Marco van de Voort wrote: > Afaik it is nothing more than a table that says "for msg with value xxx call > method yyy". IOW it is abstract. > In Windows obviously an "msg" is a Windows message. But what is a "msg" in Linux ? -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
I hope I understand your question correctly... Michael Schnell wrote: > What messages does it capture ? Anything that fits into 'var message' parameter. fpGUI uses the following base structure for the event queue. TfpgMessageRec = record MsgCode: integer; Sender: TObject; Dest: TObject; Params: TfpgMessageParams; Stop: Boolean; end; > How to send a message from a thread ? fpGUI has an internal event queue which later gets dispatched to the target using TObject.Dispatch(). fpGUI v0.4 and earlier used a Object based even system and had it's own distribution functions. Later version of fpGUI uses Record based messages and the 'message' language feature of Object Pascal. fpGUI has the following procedures defined in fpg_main.pas unit that work with the message queue. procedure fpgPostMessage(Sender, Dest: TObject; MsgCode: integer; var aparams: TfpgMessageParams); overload; procedure fpgPostMessage(Sender, Dest: TObject; MsgCode: integer); overload; procedure fpgSendMessage(Sender, Dest: TObject; MsgCode: integer; var aparams: TfpgMessageParams); overload; procedure fpgSendMessage(Sender, Dest: TObject; MsgCode: integer); overload; procedure fpgDeliverMessage(var msg: TfpgMessageRec); procedure fpgDeliverMessages; Here is an example of the X11 backend in fpGUI translating the X11 window messages into fpGUI messages and dispatching them to the message queue. -- X.FocusIn: fpgPostMessage(nil, FindWindowByHandle(ev.xfocus.window), FPGM_ACTIVATE); X.FocusOut: fpgPostMessage(nil, FindWindowByHandle(ev.xfocus.window), FPGM_DEACTIVATE); X.EnterNotify: fpgPostMessage(nil, FindWindowByHandle(ev.xcrossing.window), FPGM_MOUSEENTER); X.LeaveNotify: fpgPostMessage(nil, FindWindowByHandle(ev.xcrossing.window), FPGM_MOUSEEXIT); -- All the above describes messages from main thread to component or thread to component. For one thread to another thread, I would imagine a simple thread-safe message queue could be created (a simple list with message items). I'm not sure if FPC supplies a thread-safe list class. Each thread will periodically check the queue for messages related to itself, or post messages for other threads. A multi-read-single-write synchronizer (available in FPC as TMultiReadExclusiveWriteSynchronizer) could be used when accessing the message queue. > How to send a message from another process ? On example would be to use IPC as defined in the SimpleIPC unit - part of FCL. SimpleIPC documentation can be found at: http://www.freepascal.org/docs-html/fcl/simpleipc/index.html You can obviously use other custom communications methods too. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message(); in Linux
In our previous episode, Michael Schnell said: > How to send a message from a thread ? > > How to send a message from another process ? > > I do know that there are other (supposedly more decent) ways to do > inter-thread and inter-process communication, But as > procedure...message(), does compile in a Linux executable, I'd like to > know how it's supposed to be used. Afaik it is nothing more than a table that says "for msg with value xxx call method yyy". IOW it is abstract. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message
Somewhere user code must call MyObject.Dispatch(MyMessage); This looks as if this might be good news. The dispatch mechanism seems to be completely platform independent and so it seems I just need to fire the normal (obviously hierarchical) dispatch mechanism when a message arrives. Thanks a lot ! -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message
Thanks. I did try to find it but am lost up till now. regarding Thorsten's message I assume it is a member function to some class (e.g. TObject), but my usual means to find such functions don't show it to me. Sorry. Found it ! Thanks again. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message
Also I failed to find the implementation of TObject.Dispatch. Have you any hint where to search ? Sorry. Found it ! Thanks again. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message
"creates an entry" most probably. Right. Thanks. -Michael (not a native speaker :-( ) ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message
Thorsten Engler wrote: Thanks. That seems to give me a clue. I have no idea what "creates a try" means but maybe I'll find out. Should have been "an entry" Sorry for not guessing this :-\ . Now I need to find out what exactly it puts into the RTTI and how to extract it from there. Also I failed to find the implementation of TObject.Dispatch. Have you any hint where to search ? Thanks again, -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message
Michael Schnell wrote: What happens is that the compiler creates an try in the message table of the RTTI for the class. Check out the implementation of Tobject.Dispatch to see how that is used. Thanks. That seems to give me a clue. I have no idea what "creates a try" means but maybe I'll find out. "creates an entry" most probably. Micha ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message
See implementation of dispatch. It gets the message number and looks for the corresponding method in a table. The compiler generates this table at compile time. Thanks. I did try to find it but am lost up till now. regarding Thorsten's message I assume it is a member function to some class (e.g. TObject), but my usual means to find such functions don't show it to me. This may not be the completely accurate description, but this is how I model things in my mind and in my experiments reality hasn't falsified this model. I do believe that you are right. Thorsten's hint that the compiler moves the information in the RTTI might point into the the correct direction, but up I still need to find out what the exactly RTTI contains and how to extract it from there. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
RE: [fpc-devel] procedure ... message
> Thanks. That seems to give me a clue. I have no idea what > "creates a try" means but maybe I'll find out. Should have been "an entry". ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message
Michael Schnell schreef: I see you are still a bit lost. Maybe the documentation can help: http://www.freepascal.org/docs-html/ref/refsu24.html I in fact am lost (as I still don't dare to try to look into the compiler's source code). Unfortunately the docs text does not say what code the compiler generates to make the library assign the message to the function it generates from the users source code. That is because the compiler doesn't generate that code. Somewhere user code must call MyObject.Dispatch(MyMessage); See implementation of dispatch. It gets the message number and looks for the corresponding method in a table. The compiler generates this table at compile time. This may not be the completely accurate description, but this is how I model things in my mind and in my experiments reality hasn't falsified this model. Vincent ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message
What happens is that the compiler creates an try in the message table of the RTTI for the class. Check out the implementation of Tobject.Dispatch to see how that is used. Thanks. That seems to give me a clue. I have no idea what "creates a try" means but maybe I'll find out. Thanks again, -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message
I see you are still a bit lost. Maybe the documentation can help: http://www.freepascal.org/docs-html/ref/refsu24.html I in fact am lost (as I still don't dare to try to look into the compiler's source code). Unfortunately the docs text does not say what code the compiler generates to make the library assign the message to the function it generates from the users source code. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
RE: [fpc-devel] procedure ... message
That is the result of what is happening. Most of it is done by the library (the compiler can't do this by itself), and I am trying to use some home-brew library functions here. What I wanted to know is how the compiler does this (or how I can find out what exactly it does). I _assume_ that when it sees "procedure ... message" the compiler in the "initialization" section generates a call to a library function that is supposed to register the message with the procedure. I need to know the name of this function so that I can do it in my new library. Your assumption is totally wrong. What happens is that the compiler creates an try in the message table of the RTTI for the class. Check out the implementation of Tobject.Dispatch to see how that is used. Cheers, Thorsten ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message
Michael Schnell schreef: peter green wrote: What does the compiler do when translating "procedure ... message" ? I need to know this as I want to create a non-GUI workalike of the TApplication class that can do things like "TTimer" "TThread.Synchronize", Message events, etc, using Windows messages in Windows (for testing purpose) and system V message queues in Linux. afaict it does the same as delphi does, puts them in some form of table which is used by the dispatch method in tobject (which on delphi at least is called from wndproc which is called from mainwindowproc which is registered as the window procedure for the window and hence called by windows when the mainloop calls the windows api function dispatchmessage). Thanks a lot for your answer. I see you are still a bit lost. Maybe the documentation can help: http://www.freepascal.org/docs-html/ref/refsu24.html Vincent ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] procedure ... message
peter green wrote: What does the compiler do when translating "procedure ... message" ? I need to know this as I want to create a non-GUI workalike of the TApplication class that can do things like "TTimer" "TThread.Synchronize", Message events, etc, using Windows messages in Windows (for testing purpose) and system V message queues in Linux. afaict it does the same as delphi does, puts them in some form of table which is used by the dispatch method in tobject (which on delphi at least is called from wndproc which is called from mainwindowproc which is registered as the window procedure for the window and hence called by windows when the mainloop calls the windows api function dispatchmessage). Thanks a lot for your answer. That is the result of what is happening. Most of it is done by the library (the compiler can't do this by itself), and I am trying to use some home-brew library functions here. What I wanted to know is how the compiler does this (or how I can find out what exactly it does). I _assume_ that when it sees "procedure ... message" the compiler in the "initialization" section generates a call to a library function that is supposed to register the message with the procedure. I need to know the name of this function so that I can do it in my new library. I suppose in the end WidgetSet.AddEventHandler is called, but as the compiler does not know about a WidgetSet object that is created by the initialization of the RTL done by the library, I suppose some mechanism in the library is catching the stuff the compiler magic creates for "procedure ... message". -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
RE: [fpc-devel] procedure ... message
> What does the compiler do when translating "procedure ... message" ? > > I need to know this as I want to create a non-GUI workalike of the > TApplication class that can do things like "TTimer" > "TThread.Synchronize", Message events, etc, using Windows messages in > Windows (for testing purpose) and system V message queues in Linux. afaict it does the same as delphi does, puts them in some form of table which is used by the dispatch method in tobject (which on delphi at least is called from wndproc which is called from mainwindowproc which is registered as the window procedure for the window and hence called by windows when the mainloop calls the windows api function dispatchmessage). ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel