Re: [lazarus] How to develop real applications in Lazarus?
Am Montag, den 28.01.2008, 10:31 +0100 schrieb [EMAIL PROTECTED]: Hi, I'm working on Hamradio station logging program in Lazarus (http://cqrlog.sourceforge.net/). I started a few months (maybe a year) ago in Lazarus 0.9.23 CVS (I don't remember date, I'm on another computer). Why this CVS version? Because almost what I need works very well. My program use Firebird database (I installed uib components) and use telnet connection (Indy 10.2.0.1). In this cvs version I developed entire program. After release version 0.9.24 I decided to use it instead of 0.9.23 CVS. The fist problem was in TLazImage. It was completely rewriten. I have to made some changes in my program. Next problem was with TColorCombobox.Selection. Newer version has Selected. But it was simply. The biggist problem is that program freeze if telnet is connected. Program works perfectly about two hours and freeze. Nothing in console, no access violation. Just freeze. Program compiled in 0.9.23 CVS works perfectly many hours and never freeze. I tried latest daily snapshot and program show access violation randomly. Nothing in console, no details in access violation window. My question is, how to develop real application? Should I still develop program with old lazarus version and ignore newer versions? What can I do for better compatability with newer versions? I can not rewrite my program after every new lazarus release. How do you develop your applications? Look where the app. is freezing or crashing. Just use the debugger. If it freeze, pause the app. in the debugger and looks where your threads are in. -- Albert _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Robot2 for MacOSX
Am 24.01.2008 um 10:31 schrieb Damien Gerard: On Jan 24, 2008, at 12:47 AM, Albert Zeyer wrote: Hi, Just packed it together. Here it is (but only for IntelMac): http://www.az2000.de/downloads/Robot1.7.Mac.zip You have just to click on the robot-Application (robot.app) inside. In a OS X app, all ressources should be inside the package. Yes I know, but I was to lazy to rearrange everything etc. Also I would have to care where I save the map-files and the game-files then (because the user can click on load game or load map and then a simple fileopen-dialog pops up. And it's just a really simple demo application. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] C++ libraries
Am 25.01.2008 um 02:37 schrieb mramirez: Hi. I was wondering if C++ classes binary *.obj files could be accessed from a Free Pascal application. As far as I know this is not possible (yet). The main problem is that the C++ ABI is very complicated and also changes with each GCC version. But though, I myself was also interested in this topic. I have not yet read more about the details of the C++ ABI. Does somebody know further details? Which details are changing there? What exactly is complicated? Another thing is that C++ objects are not exactly similar to Object pascal objects. Regards, Albert _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] make, MacOSX
Hi, Is there any documentation about the parameters I can pass to the Makefile? I am mainly trying to compile Lazarus directly on my system without using Lazarus for the compilation. I have added an entry in the wiki: http://wiki.lazarus.freepascal.org/Carbon_Interface#Compiling_the_Carbon_interface_via_Makefile I am currently using this command: make LCL_PLATFORM=carbon FPC=fpc -k-framework -kcarbon It takes some time until I found out that LCL_PLATFORM is the option to set the interface. And I also didn't find any method to pass parameters to fpc or the linker, but it seems that FPC=fpc PARAMS did the trick. Though I get a lot of these: ... ld: atom sorting error for DEBUGEND_SYNEDITTYPES and DEBUGSTART_SYNEDITTYPES in /Users/az/Programmierung/lazarus/components/ synedit/units/powerpc-darwin/synedittypes.o ld: atom sorting error for DEBUGEND_SYNEDITTYPES and DEBUGSTART_SYNEDITTYPES in /Users/az/Programmierung/lazarus/components/ synedit/units/powerpc-darwin/synedittypes.o unknown stabs type 0xC0 in /Users/az/Programmierung/lazarus/components/ synedit/units/powerpc-darwin/synedittextbuffer.o unknown stabs type 0xE0 in /Users/az/Programmierung/lazarus/components/ synedit/units/powerpc-darwin/synedittextbuffer.o unknown stabs type 0xC0 in /Users/az/Programmierung/lazarus/components/ synedit/units/powerpc-darwin/syntextdrawer.o unknown stabs type 0xE0 in /Users/az/Programmierung/lazarus/components/ synedit/units/powerpc-darwin/syntextdrawer.o unknown stabs type 0xC0 in /Users/az/Programmierung/lazarus/components/ synedit/units/powerpc-darwin/synregexpr.o unknown stabs type 0xE0 in /Users/az/Programmierung/lazarus/components/ synedit/units/powerpc-darwin/synregexpr.o unknown stabs type 0xC0 in /Users/az/Programmierung/lazarus/components/ synedit/units/powerpc-darwin/synexporthtml.o unknown stabs type 0xE0 in /Users/az/Programmierung/lazarus/components/ synedit/units/powerpc-darwin/synexporthtml.o unknown stabs type 0xC0 in /Users/az/Programmierung/lazarus/components/ synedit/units/powerpc-darwin/synhighlightermulti.o unknown stabs type 0xE0 in /Users/az/Programmierung/lazarus/components/ synedit/units/powerpc-darwin/synhighlightermulti.o 987 lines compiled, 5.10 sec albert-zeyers-macbook:lazarus az$ I am using FPC 2.2.0 (installed via the provided DMG from SF) and Lazarus from SVN, revision 13844. Though, Lazarus is starting after this: albert-zeyers-macbook:lazarus az$ ./startlazarus dyld: shared cached file is corrupt: /var/db/dyld/dyld_shared_cache_ppc TCarbonWidget.Create TCarbonWindow SplashForm: TSplashForm TCarbonWindow.RegisterEvents TCarbonWindow SplashForm: TSplashForm CarbonCommon_BoundsChanged SplashForm:TSplashForm TCarbonWindow.SetScrollInfo TODO TCarbonWindow.SetScrollInfo TODO TLazarusManager.Run starting /Users/az/Programmierung/lazarus/ lazarus ... dyld: shared cached file is corrupt: /var/db/dyld/dyld_shared_cache_ppc TApplication.IconChanged - TODO: convert this message...no implementation in gtk or win32 Note: environment config file not found - using defaults TCarbonWidget.Destroy TCarbonWindow SplashForm: TSplashForm Then, a window pops up (a native Carbon window) which says that it doesn't find the FPC sources. There is an Ignore-Button on this window but I cannot click on it. I even cannot focus the window neither move it or do anything with it. The only thing I can do is pressing Ctrl+C in the console to break it. Any ideas? Any hints? Regards, Albert Zeyer _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] make, MacOSX
Am 23.01.2008 um 23:17 schrieb Damien Gerard: On Jan 23, 2008, at 10:02 PM, Hess, Philip J wrote: http://michael-ep3.physik.uni-halle.de/Lazarus/ Try a snapshot from here. I believe an Intel Mac's can run the PowerPC version via its Rosetta technology. Yes but you should not. For compiling it is a bit more complicated I am indeed really impressed by Rosetta that the whole compiling process just worked out-of-the-box and even the application was runable and had the same behaviour than now with the x86 version of FPC. -- Albert _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] make, MacOSX
Am 23.01.2008 um 23:48 schrieb Hess, Philip J: Hi Albert, The Lazarus installer creates the lazarus.app bundle and puts the structure inside it that OS X wants. For apps you develop yourself you can use the create_app_mac.sh script to create the app's .app bundle. Open the script in a text editor to see what it's doing. Note that for convenience both lazarus.app and the bundle created by create_app_mac.sh use a symlink to the actual executable in the same folder as the .app. For distribution you would want to replace the symlink in the bundle with the actual executable file. I am trying exactly this right now. First of all, it seems that the script is only working if your binary is in the same directory from you are running the script. Secondly, I get the message by MacOSX that my architecture doesn't support this application when I click on the app-bundle. It seems that it is incompatible with Leopard. Does somebody know what I have to extend? Albert Vincent, et al: Would it make sense to based the nightly builds on the 2.2.1 FPC that works around some of the Leopard bugs now that more and more users are upgrading to Leopard? Or would the 2.2.1 FPC just create more problems than it solves? Thanks. -Phil -Original Message- From: Albert Zeyer [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 23, 2008 4:35 PM To: lazarus@miraclec.com Subject: Re: [lazarus] make, MacOSX Am 23.01.2008 um 23:26 schrieb Tom Gregorovic: On Jan 23, 2008 9:26 PM, Albert Zeyer [EMAIL PROTECTED] wrote: Hi, Is there any documentation about the parameters I can pass to the Makefile? I am mainly trying to compile Lazarus directly on my system without using Lazarus for the compilation. I have added an entry in the wiki: http://wiki.lazarus.freepascal.org/Carbon_Interface#Compiling_the_Carbon _interface_via_Makefile I am currently using this command: make LCL_PLATFORM=carbon FPC=fpc -k-framework -kcarbon It takes some time until I found out that LCL_PLATFORM is the option to set the interface. And I also didn't find any method to pass parameters to fpc or the linker, but it seems that FPC=fpc PARAMS did the trick. Though I get a lot of these: ... ld: atom sorting error for DEBUGEND_SYNEDITTYPES and DEBUGSTART_SYNEDITTYPES in /Users/az/Programmierung/lazarus/ components/ synedit/units/powerpc-darwin/synedittypes.o ld: atom sorting error for DEBUGEND_SYNEDITTYPES and DEBUGSTART_SYNEDITTYPES in /Users/az/Programmierung/lazarus/ components/ synedit/units/powerpc-darwin/synedittypes.o unknown stabs type 0xC0 in /Users/az/Programmierung/lazarus/ components/ synedit/units/powerpc-darwin/synedittextbuffer.o unknown stabs type 0xE0 in /Users/az/Programmierung/lazarus/ components/ synedit/units/powerpc-darwin/synedittextbuffer.o unknown stabs type 0xC0 in /Users/az/Programmierung/lazarus/ components/ synedit/units/powerpc-darwin/syntextdrawer.o unknown stabs type 0xE0 in /Users/az/Programmierung/lazarus/ components/ synedit/units/powerpc-darwin/syntextdrawer.o unknown stabs type 0xC0 in /Users/az/Programmierung/lazarus/ components/ synedit/units/powerpc-darwin/synregexpr.o unknown stabs type 0xE0 in /Users/az/Programmierung/lazarus/ components/ synedit/units/powerpc-darwin/synregexpr.o unknown stabs type 0xC0 in /Users/az/Programmierung/lazarus/ components/ synedit/units/powerpc-darwin/synexporthtml.o unknown stabs type 0xE0 in /Users/az/Programmierung/lazarus/ components/ synedit/units/powerpc-darwin/synexporthtml.o unknown stabs type 0xC0 in /Users/az/Programmierung/lazarus/ components/ synedit/units/powerpc-darwin/synhighlightermulti.o unknown stabs type 0xE0 in /Users/az/Programmierung/lazarus/ components/ synedit/units/powerpc-darwin/synhighlightermulti.o 987 lines compiled, 5.10 sec albert-zeyers-macbook:lazarus az$ I am using FPC 2.2.0 (installed via the provided DMG from SF) and Lazarus from SVN, revision 13844. Though, Lazarus is starting after this: albert-zeyers-macbook:lazarus az$ ./startlazarus dyld: shared cached file is corrupt: /var/db/dyld/ dyld_shared_cache_ppc TCarbonWidget.Create TCarbonWindow SplashForm: TSplashForm TCarbonWindow.RegisterEvents TCarbonWindow SplashForm: TSplashForm CarbonCommon_BoundsChanged SplashForm:TSplashForm TCarbonWindow.SetScrollInfo TODO TCarbonWindow.SetScrollInfo TODO TLazarusManager.Run starting /Users/az/Programmierung/lazarus/ lazarus ... dyld: shared cached file is corrupt: /var/db/dyld/ dyld_shared_cache_ppc TApplication.IconChanged - TODO: convert this message...no implementation in gtk or win32 Note: environment config file not found - using defaults TCarbonWidget.Destroy TCarbonWindow SplashForm: TSplashForm Then, a window pops up (a native Carbon window) which says that it doesn't find the FPC sources. There is an Ignore-Button on this window but I cannot click on it. I even cannot focus the window neither move it or do anything with it. The only thing I can do is pressing Ctrl +C in the console to break it. Any ideas? Any
[lazarus] Lazarus + Robot2 under MacOSX
Hey, Just wanted to report that everything works really fine under MacOSX! I am really impressed. I haven't found any big bug which prevents me from working with the native Carbon interface. Some screenshots: http://www.az2000.de/pics/robot2mac_1.png?get http://www.az2000.de/pics/robot2mac_2.png?get Greetings, Albert _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] Robot2 for MacOSX
Hi, Just packed it together. Here it is (but only for IntelMac): http://www.az2000.de/downloads/Robot1.7.Mac.zip You have just to click on the robot-Application (robot.app) inside. Regards, Albert _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] c++ to object pascal converter
Hi, Is there any automatic C++ to Object Pascal converter? I am thinking of porting a C++ game to Object Pascal and want to have some code as a basic to work with. It's enough if just the syntax got translated and some easy designed objects. Greetings, Albert _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] generics
Hi, If have just googled a bit about Generics in FPC and the Lazarus Wiki says that they are implemented since FPC 2.3.1. How is the current state? Are they used? Are all the common containers (like list, vector, map, etc.) available as generic classes? In the FPC reference, it seems that a lot of parts are not implemented yet (function generics, operators). Regards, Albert _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] c++ to object pascal converter
Thanks for the hint. Sadly I need the same realy for C++ as most of the code is C++ based (a lot of classes). Am Dienstag, den 22.01.2008, 14:20 + schrieb Luis Quental: On Jan 22, 2008 11:29 AM, Albert Zeyer [EMAIL PROTECTED] wrote: Hi, Is there any automatic C++ to Object Pascal converter? I am thinking of porting a C++ game to Object Pascal and want to have some code as a basic to work with. It's enough if just the syntax got translated and some easy designed objects. Greetings, Albert Hi, Recently I have used C to Pascal Converter to convert a simple project with some success (but the generated code has to be reviewed) Link: http://codecentral.borland.com/Item/23991 _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Solution to the BIG compiled file issue!
Am 15.01.2008 um 17:02 schrieb Andrew Brunner: Vincent: IOW: I expect Lazarus users to be knowledgeable, Lazarus is not for fools. I offer you all this. The #1 reason why Microsoft Windows (3 and up) took off and became so popular was Visual Basic for idiots and Turbo Pascal / Delphi for the coders between C++ and VB. The long term success of this project would be cemented if we all keep a more welcoming attitude to all walks of developers. (VB, Delphi, and C++) types should be able to utilize Lazarus in the years to come. Lazarus should even have an Express edition with more powerful features not even available. IMO Lazarus has serious potential to rival that of Java. It just needs more time and backing. Full ack on this. And: A wide spread of Lazarus is of course in every case a big advantage. Imagine how much talented programmers are out there who have never heard of Lazarus. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Solution to the BIG compiled file issue!
Am 15.01.2008 um 17:11 schrieb Vincent Snijders: Andrew Brunner schreef: Vincent: IOW: I expect Lazarus users to be knowledgeable, Lazarus is not for fools. I offer you all this. The #1 reason why Microsoft Windows (3 and up) took off and became so popular was Visual Basic for idiots and Turbo Pascal / Delphi for the coders between C++ and VB. Do you have a similar comparison for Open Source projects? Compare Linux with FreeBSD. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Solution to the BIG compiled file issue!
Am 15.01.2008 um 18:35 schrieb Marco van de Voort: On Tue, Jan 15, 2008 at 06:28:12PM +0200, Albert Zeyer wrote: I've no idea what you mean by that remark. Linux became popular because it was/is easy to install. (OK, not gained by the Linux kernel developers itself but by the community around.) Linux got a lot of funding due to hype. And the hype was mostly around the single student Linus cult, which was simply more marketable than a multi person core of dedicated but relatively colourless professionals. FreeBSD not, though from the quality point of view it's better. It didn't have the hype. You have to have a motivation to start installing in the first place. Yes that was one hype. But the reason to be so wide spread is mainly that it was easy to install and that it (often) works better in comparison with FreeBSD. Also you see what you get by popularity: More support. Why would you not install FreeBSD instead of Linux? Mostly it's because of a non-supported feature or a hardware. And that is mainly because of the smaller community and less support by companies. And that is mainly because of less popularity and less support. Or perhaps it's also because it seems too complicated instead of using Linux. And then you are also again at the point I wanted to point out. Or generally, some random person, why would he install Linux instead of FreeBSD? Probably because he has never heard of FreeBSD. All I wanted to say is: Popularity is important (at least gives much advantages). And easiness will increase popularity. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Solution to the BIG compiled file issue!
Am 15.01.2008 um 20:26 schrieb Vincent Snijders: For creating a successful and strong development tool (which is the goal of the whole project AFAIK) you need not only contributors but users as well... Why needs Lazarus users that contribute nothing? They are testers and they infect others by the virus ;) More users are already an good thing. Well, that was my question, please explain why. What benifit gets Lazarus from a user? Lazarus doesn't get a thing for users that just uses Lazarus and doesn't contribute anything. More users = more popularity = more contributors = patches Which of these consequences are wrong for you? _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Laz / Fpc function listing
Hey, just looked and it and it's realy nice! Just wanted to thank you... Greetings, Albert Am Dienstag, den 20.11.2007, 08:53 +0100 schrieb Tiziano De Togni: SteveG wrote: Would anybody know if there is a listing (or some way of building one) of all functions available for Lazarus and/or Fpc ? maybe the short answer is simply: no. But I am pleased that people are asking for something I'm currently working on :-) Look at this chart: http://digilander.libero.it/tizzziano/pdf/procs_01.pdf It was made looking into the FPC pdf documentation and surfing on the source code of the RTL libraries. It's only a draft version. Suggestions are welcome. tiziano _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Bad news
Am Montag, den 12.11.2007, 18:35 +0100 schrieb Marc Weustink: Leonardo M. Ramé wrote: http://www.stevetrefethen.com/blog/IWishTheDelphiCommandLineCompilerWereFree.aspx Where have I heard such accusations before Also my first thought. -- Albert _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] What do you thing of this ?
Please read also this: http://www.heise.de/open/artikel/92735 It's not only that MS-OOXML is useless. There is the usual MS strategy behind. Their goal is to became MS-OOXML as an standard and after to make all its users dependend on MS (because some important parts are not open). Read perhaps also this: http://blog.janik.cz/archives/2007/05/19/T20_32_07/ -- Albert Am Dienstag, den 06.11.2007, 20:36 +0200 schrieb Razvan Adrian Bogdan: Do you think this is a good initiative ? Would it be in the community interest to standardize Office formats as ISO ? http://www.noooxml.org/petition Razvan _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] freeze while resizing a window (GTK2 with rev 12674)
Hi, I got a freeze when I resize my window to a size where one of the panels of the form becames completly hidden (it is moved to the left while making the window smaller; this is because of the Anchors: left, right, bottom). I am using GTK2 and Lazarus rev 12674. On the console, I get all the time: (also when I do nothing) [DBGTGT] NOTE: TGtkWidgetSet.InvalidateRect during paint message: TMainForm I paused the application after it freezed. This is the stack then: #0 g_source_list_add((^GSource) 0x8a45458, (^GMainContext) 0x837c308) at gmain.c:848 #1 IA__g_source_attach((^GSource) 0x8a45458, (^GMainContext) 0x837c308) at gmain.c:913 #2 IA__g_idle_add_full(110, 0xb7c0b235 gtk_container_idle_sizer, 0x0, 0) at gmain.c:3986 #3 _gtk_container_queue_resize((^GtkContainer) 0x837c968) at gtkcontainer.c:1154 #4 real_queue_resize((^GtkWidget) 0x8378a98) at gtksizegroup.c:143 #5 queue_resize_on_widget((^GtkWidget) 0x8378a98, 1) at gtksizegroup.c:187 #6 IA__gtk_widget_queue_resize((^GtkWidget) 0x8378a98) at gtkwidget.c:2795 #7 gtk_layout_move_internal((^GtkLayout) 0x837c968, (^GtkWidget) 0x8378a98, 1, 0, 1, 311) at gtklayout.c:399 #8 FIXEDMOVECONTROL((PGTKWIDGET) 0x837c968, (PGTKWIDGET) 0x8378a98, 0, 311) at gtkproc.inc:3958 #9 SETWIDGETSIZEANDPOSITION((^TWINCONTROL) 0xb74549f0) at gtkproc.inc:7089 #10 RESIZEHANDLE((^TWINCONTROL) 0xb74549f0) at gtkproc.inc:7028 #11 TGTKWSWINCONTROL__SETBOUNDS((^TWINCONTROL) 0xb74549f0, 0, 311, 0, 101, (pvmt) 0xb74a6f40) at gtkwscontrols.pp:291 #12 TWINCONTROL__DOSENDBOUNDSTOINTERFACE((TWINCONTROL) 0xb74549f0) at wincontrol.inc:7172 #13 TWINCONTROL__REALIZEBOUNDS((TWINCONTROL) 0xb74549f0) at wincontrol.inc:7196 #14 TWINCONTROL__REALIZEBOUNDSRECURSIVE((TWINCONTROL) 0xb74549f0) at wincontrol.inc:7207 #15 TWINCONTROL__ALIGNCONTROL((TCONTROL) 0xb74549f0, (TWINCONTROL) 0xb744a780) at wincontrol.inc:5563 #16 TCONTROL__REQUESTALIGN((TCONTROL) 0xb74549f0) at control.inc:2794 #17 TCONTROL__CHANGEBOUNDS(0, 311, 1, 101, (TCONTROL) 0xb74549f0) at control.inc:406 #18 TCONTROL__SETBOUNDS(0, 311, 1, 101, (TCONTROL) 0xb74549f0) at control.inc:2738 #19 TWINCONTROL__SETBOUNDS(0, 311, 1, 101, (TWINCONTROL) 0xb74549f0) at wincontrol.inc:6949 #20 TCONTROL__SETBOUNDSKEEPBASE(0, 311, 1, 101, true, (TCONTROL) 0xb74549f0) at control.inc:4029 #21 TWINCONTROL__WMSIZE({MSG = 5, SIZETYPE = 128, WIDTH = 1, HEIGHT = 101, RESULT = 0}, (TWINCONTROL) 0xb74549f0) at wincontrol.inc:6041 #22 SYSTEM_TOBJECT_$__DISPATCH$formal at :0 #23 TCONTROL__WNDPROC({MSG = 5, WPARAM = 128, LPARAM = 6619137, RESULT = 0, WPARAMLO = 128, WPARAMHI = 0, LPARAMLO = 1, LPARAMHI = 101, RESULTLO = 0, RESULTHI = 0}, (TCONTROL) 0xb74549f0) at control.inc:1579 #24 TWINCONTROL__WNDPROC({MSG = 5, WPARAM = 128, LPARAM = 6619137, RESULT = 0, WPARAMLO = 128, WPARAMHI = 0, LPARAMLO = 1, LPARAMHI = 101, RESULTLO = 0, RESULTHI = 0}, (TWINCONTROL) 0xb74549f0) at wincontrol.inc:4628 #25 DELIVERMESSAGE((POINTER) 0xb74549f0, void) at gtkproc.inc:3738 #26 SENDSIZENOTIFICATIONTOLCL((PGTKWIDGET) 0x8378a98) at gtkproc.inc:6895 #27 GTKSIZE_ALLOCATECB((PGTKWIDGET) 0x8378a98, (PGDKRECTANGLE) 0xbfe41748, (POINTER) 0xb74549f0) at gtkcallback.inc:2596 #28 IA__g_cclosure_marshal_VOID__BOXED((^GClosure) 0xb7454c68, (^GValue) 0x0, 2, (^GValue) 0xbfe414d8, 0xbfe413e8, 0xb74a6f40) at gmarshal.c:566 #29 IA__g_closure_invoke((^GClosure) 0x83f5b20, (^GValue) 0x0, 2, (^GValue) 0xbfe414d8, 0xbfe413e8) at gclosure.c:490 #30 signal_emit_unlocked_R((^SignalNode) 0x8391220, 0, 0x8378a98, (^GValue) 0x0, (^GValue) 0xbfe414d8) at gsignal.c:2440 #31 IA__g_signal_emit_valist(0x8378a98, 23, 0, 0xbfe4171c #152#138'7'#8#160#23#228#191'D'#23#228#191#200's'#207#183) at gsignal.c:2199 #32 IA__g_signal_emit(0x8378a98, 23, 0) at gsignal.c:2243 #33 IA__gtk_widget_size_allocate((^GtkWidget) 0x8378a98, (^GtkAllocation) 0xbfe41790) at gtkwidget.c:3063 #34 gtk_layout_size_allocate((^GtkWidget) 0x837c968, (^GtkAllocation) 0xbfe41c98) at gtklayout.c:1102 #35 IA__g_cclosure_marshal_VOID__BOXED((^GClosure) 0x83910b0, (^GValue) 0x0, 2, (^GValue) 0xbfe41a28, 0xbfe41938, 0xb7c87ffe) at gmarshal.c:566 #36 g_type_class_meta_marshal((^GClosure) 0x83910b0, (^GValue) 0x0, 2, (^GValue) 0xbfe41a28, 0xbfe41938, 0x80) at gclosure.c:567 #37 IA__g_closure_invoke((^GClosure) 0x83910b0, (^GValue) 0x0, 2, (^GValue) 0xbfe41a28, 0xbfe41938) at gclosure.c:490 #38 signal_emit_unlocked_R((^SignalNode) 0x8391220, 0, 0x837c968, (^GValue) 0x0, (^GValue) 0xbfe41a28) at gsignal.c:2370 #39 IA__g_signal_emit_valist(0x837c968, 23, 0, 0xbfe41c6c '') at gsignal.c:2199 #40 IA__g_signal_emit(0x837c968, 23, 0) at gsignal.c:2243 #41 IA__gtk_widget_size_allocate((^GtkWidget) 0x837c968, (^GtkAllocation) 0xbfe41cf0) at gtkwidget.c:3063 #42 gtk_scrolled_window_size_allocate((^GtkWidget) 0x83ef800, (^GtkAllocation) 0xbfe42208) at gtkscrolledwindow.c:1335 #43 IA__g_cclosure_marshal_VOID__BOXED((^GClosure) 0x83910b0, (^GValue) 0x0, 2, (^GValue) 0xbfe41f98, 0xbfe41ea8, 0xb7cec47e) at gmarshal.c:566 #44 g_type_class_meta_marshal((^GClosure)
Re: [lazarus] freeze while resizing a window (GTK2 with rev 12674)
Am Donnerstag, den 01.11.2007, 13:59 +0100 schrieb Mattias Gaertner: On Thu, 01 Nov 2007 14:23:59 +0200 Albert Zeyer [EMAIL PROTECTED] wrote: On the console, I get all the time: (also when I do nothing) [DBGTGT] NOTE: TGtkWidgetSet.InvalidateRect during paint message: TMainForm This normally indicates, that you have a bug in your OnPaint code. Only paint in the OnPaint event. Do not change properties or resize, move, delete or create controls. I stepped through the code and I figured out that I get the message exactly at this point: GamePanel.Canvas.Draw(0,0,MyRoomPic.Picture); GamePanel is a TImage and MyRoomPic.Picture is a TBitmap. So, is the code wrong? How should I draw otherwise the TBitmap on the TImage? -- Albert _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] freeze while resizing a window (GTK2 with rev 12674)
Am Donnerstag, den 01.11.2007, 15:19 +0100 schrieb Mattias Gaertner: On Thu, 01 Nov 2007 15:51:59 +0200 Albert Zeyer [EMAIL PROTECTED] wrote: I stepped through the code and I figured out that I get the message exactly at this point: GamePanel.Canvas.Draw(0,0,MyRoomPic.Picture); GamePanel is a TImage and MyRoomPic.Picture is a TBitmap. So, is the code wrong? Is the OnPaint event of the GamePanel? No, it was the OnPaint event of the Form. I haven't set the OnPaint event of the GamePanel before. I have changed this now and it works! Thank you. :) (But of course that solves not the main bug I have reported: the freeze while resizing the window.) -- Albert _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] freeze while resizing a window (GTK2 with rev 12674)
Am Donnerstag, den 01.11.2007, 22:34 +0700 schrieb Paul Ishenin: Albert Zeyer пишет: Am Donnerstag, den 01.11.2007, 15:35 +0100 schrieb Mattias Gaertner: Just a guess: Maybe it is an endless loop between gtk and LCL about too small widget sizes. I added minimum constraints of 1x1. Can you update lazarus svn and check if this fixes the problem? I have updated the svn (to rev 12679) but it seems that something is completly broken now. See the screenshot: http://img217.imageshack.us/my.php?image=lazarusfr4.png Try to update from svn once again :) Svn version of lazarus gives no promices of correct work. Ah, it works realy great now (with rev 12682)! Also another bug is gone now (where the location of some aligned controles were wrong). Many thanks. -- Albert _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
RE: [lazarus] App bundle and icons for x11 apps on macintosh
I like the X11-version of OO way more better then the native one. The native one works slower, a bit unstable, has less features but on the other side more problems. (But I must admit, I tested it one year ago or so.) And it's also no problem to have X on your Mac OS X, it's installed by default and if it's not, you can very easily install it. And there are some other applications which need X, for example Gimp and most other Linux application (and while most native Mac OS X applications are shareware/commercial, you have the choice between Linux application under X or a pirated copy of some native application). Greetings, Albert Am Donnerstag, den 31.05.2007, 09:16 -0400 schrieb Hess, Philip J: Felipe, Have you tried NeoOffice? It's a native OO port for OS X. I don't think many Mac users would be happy with an X11 version of OO. http://www.neooffice.org/neojava/en/index.php Thanks. -Phil -Original Message- From: Felipe Monteiro de Carvalho [mailto:[EMAIL PROTECTED] Sent: Thursday, May 31, 2007 5:27 AM To: lazarus@miraclec.com Subject: [lazarus] App bundle and icons for x11 apps on macintosh Hi, I just installed open office on macintosh. It requires X11 to run, but it is as easy to install (just drag the folder from the dmg), to run (can be put on the docker) and uninstall as any good aqua application. That's really very interresting, because if Open Office can do it, we could do the same for Lazarus =) Yes, of course we still need fink and gtk, but with each improvement things can easier =) I will try to look at this when I have free time ... bye,
Re: [lazarus] Linux WriteLn - Staionary Output - how is done?
Am Dienstag, den 22.05.2007, 10:09 +0200 schrieb A.J. Venter: So it's a case of which is your needs - for general console apps though - you should use ncrt because it's terminal independent and a LOT faster (ansi escapes take a long time to execute and make your whole program feel slow) Why is it faster? I always thought, that ncurses also uses escape sequences, but it is very optimized in that to minimize them.
Re: [lazarus] Array of Buttons, OnClick how made to work
Use either {$MODE DELPHI} or ...OnClick := @BtnMenuClick. Am Montag, den 21.05.2007, 11:39 -0700 schrieb Carlos Avogaro: I have this in Delphi, and the event onClick, work perfect for xx do btnMenu[xx].Height := 25; btnMenu[xx].Left:= 15; btnMenu[xx].Width := 140; btnMenu[xx].Caption:= sqDataF.FieldByName('nombre').AsString; btnMenu[xx].Tag:= sqDataF.FieldByName('accion').AsInteger; btnMenu[xx].Name:='Menu' + intToStr(xx); btnMenu[xx].Font.Color:=RGB(255,255,255); btnMenu[xx].Color:=RGB(100,100,100); btnMenu[xx].OnClick := BtnMenuClick; INC(xx); end; //=== procedure TfrmMain.btnMenuClick(Sender: TObject); begin with TButton(Sender) do if Tag = 200 then end; In lazarus the compiler return grong number of parameters in: btnMenu[xx].OnClick := BtnMenuClick; Any idea ? thank you __ Got a little couch potato? Check out fun summer activities for kids.
Re: [lazarus] (Beryl and )way cool with Lazarus..?
This (AIGLX) is to prefer over XGL, because it doesn't add a complete X11-layer and it allows the usage of hardware accelerated OpenGL through it: http://wiki.beryl-project.org/wiki/Install_Beryl_on_Ubuntu_Edgy_with_AIGLX But all this isn't related to the software you run within. You only change the way how your X-server draws your application windows. AIGLX/XGL provides the necessary possibilities and the windowmanagers Compiz or Beryl (or others) uses them by making these effects. The applications themself don't recognize about how they are drawn on the screen. If you want to extend Beryl or Compiz, I don't know, if this is possible yet with Free Pascal. Take a look at the source code. I think, they have a modular design, so perhaps it's possible to code some moduls with Lazarus. Am Donnerstag, den 12.04.2007, 22:20 -0500 schrieb [EMAIL PROTECTED]: Just wondering if anybody has installed this? http://wiki.beryl-project.org/index.php/Install/Ubuntu/Edgy/XGL Here's what it can look like when it is running: http://www.youtube.com/watch?v=i0ZtcxHUSDQ I'm interested if any of the components are available in Lazarus yet.. because if they aren't I think that it would be worthwhile doing something about it. I really want to dump my winbloat for this.. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] (Beryl and )way cool with Lazarus..?
Hi David, Which widgets do you mean in detail? All the effects are applied at a window as a whole. This is something, your application can never do itself. Perhaps later, there are possible interfaces, that your application can send a message to Compiz, that it should be bigger or more green or something similar. There is already a DBus plugin for Compiz/Beryl. I don't know in detail, what you can control over this Dbus plugin, but it's perhaps possible to do things like these. But on this way, you cannot produce own effects, you can only say Copmiz/Beryl, that it should do something. You have also to differ between the effects inside your application and outside of it. Compiz/ Beryl / other windowmanagers produce some outside effects on the application windows. If you use OpenGL now, you can only make effects inside your window, but you cannot make any effect to the window itself. Regards, Albert Am Freitag, den 13.04.2007, 19:57 +1000 schrieb David Lyon: Hi Albert, Yes you're right of course that the visualisations are done at the OS level. Still, it would be nice to have some of these widgets available within an application. I know that OpenGL is available within Lazarus because the demo directory includes some code. So it's probably only a matter of time. Regards David Albert Zeyer wrote: This (AIGLX) is to prefer over XGL, because it doesn't add a complete X11-layer and it allows the usage of hardware accelerated OpenGL through it: http://wiki.beryl-project.org/wiki/Install_Beryl_on_Ubuntu_Edgy_with_AIGLX But all this isn't related to the software you run within. You only change the way how your X-server draws your application windows. AIGLX/XGL provides the necessary possibilities and the windowmanagers Compiz or Beryl (or others) uses them by making these effects. The applications themself don't recognize about how they are drawn on the screen. If you want to extend Beryl or Compiz, I don't know, if this is possible yet with Free Pascal. Take a look at the source code. I think, they have a modular design, so perhaps it's possible to code some moduls with Lazarus. Am Donnerstag, den 12.04.2007, 22:20 -0500 schrieb [EMAIL PROTECTED]: Just wondering if anybody has installed this? http://wiki.beryl-project.org/index.php/Install/Ubuntu/Edgy/XGL Here's what it can look like when it is running: http://www.youtube.com/watch?v=i0ZtcxHUSDQ I'm interested if any of the components are available in Lazarus yet.. because if they aren't I think that it would be worthwhile doing something about it. I really want to dump my winbloat for this.. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
RE: [lazarus] History of the widget set design?
Am Montag, den 02.04.2007, 18:22 -0400 schrieb Hess, Philip J: A Mac feels much more alive than other computers. For example, when logging in if you mistype your password the login dialog briefly wiggles from side to side as if shaking its head no at you. You get the point instantly. On other systems you would get a error dialog popping up, which you would then have to close before you could re-enter your password. You have this also in Gnome 2.16. But I am realy sure they got their idea from Apple... :) -Original Message- From: Graeme Geldenhuys [mailto:[EMAIL PROTECTED] Sent: Monday, April 02, 2007 5:57 PM To: lazarus@miraclec.com Subject: Re: [lazarus] History of the widget set design? On 4/2/07, Hess, Philip J [EMAIL PROTECTED] wrote: Example: OS X pulsing button. You might spend a lot of effort trying to reproduce this in the painting backend, whereas by using the native I'm afraid I can't comment on OSX and will take you word for it. The only time I have seen OSX, was in their cool ads and in screenshots - and the buttons didn't pulsate there. :-) I really need to get my hands on a Mac some time... smiley-3.png Description: PNG image
Re: [lazarus] Question: Multiprocessor Systems
I don't know if there is any possibility to define the CPU, on which a special thread should run on. Is there any? Because usually, this is something your OS should handle because it knows best about all the other parallel processes. And it's perhaps not always the best solution for your application to split all your threads on perhaps the 4 CPUs of a quadcore, if there is another application which also needs lot of CPU power (I would thought, that in this case, it should be a lot faster, if your application uses 2 CPUs and the other application the other ones). But as I said, usually this is something your OS should take care about. Greetings, Albert Am Freitag, den 02.03.2007, 11:18 +0100 schrieb tanila: I would like to know how many processors are on the system, because i would like to use them paralell for a single task. The job could be done using 2, 4, etc threads simultaniously, to speed it up with usage of all processors at the same time. To split up the task I have to know how many cpus are available for usage. Is there a way to figure this out ? greetings tanila Am Freitag, den 02.03.2007, 11:20 +0200 schrieb Graeme Geldenhuys: On 3/2/07, tanila [EMAIL PROTECTED] wrote: I would like to make experiences with multithreadded application and how to get benefits with more than one cpu. All you should need to do is create multiple threads in your system and the OS and CPU(s) will handle the rest. No need to do something special in you application. Another question: Are this magic doual/quad-core cups real multiprocessor-systems like a mainboard with two or more processors ? Yes they are like the old style mainboards with two or more physical processors on the motherboard. HyperThreading on the other hand is a Intel sales gimic which fakes a second processor (software processor). _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Re: Linking Fails: cannot find -lglib
Am Dienstag, den 16.01.2007, 10:16 +0200 schrieb Dave Coventry: Oops. This is possibly the crux of my problem. CoLinux cannot access any of the hardware on the machine, so I use a Virtual Desktop called Xming which acts as a VNC client similar to TightVNC. So I don't actually have X11 installed. Which could be a problem. My wheeze using the ebuild version of lazarus-0.9.12 also failed: * You need to build dev-lang/fpc with the 'source' USE flag * in order for lazarus to work properly !!! ERROR: dev-lang/lazarus-0.9.12 failed. Set the 'source' USE flag for FPC. You can set this globaly in /etc/make.conf or esp. for FPC by: echo dev-lang/fpc source /etc/portage/package.use This USE flag indicates for packages, that they shall install the source. (Read the Gentoo Handbook. USE flags are one of the base technics of Portage and this technic should be one of the reasons for using Gentoo.)
Re: [lazarus] Linking Fails: cannot find -lglib
This is the Debian way. Under Portage, you don't need extra packages for this. If you want to activate/deactivate something, you simply use USE flags. But in this case, you always got the header-files, they are installed by default. Am Dienstag, den 16.01.2007, 09:26 +0200 schrieb Dave Coventry: emerge glib-devel or glib-dev Before I took the drastic step of using Portage to install lazarus-0.9.12, I tried to search for glib-dev (emerge -s glib-dev) which drew no matches. Too obvious, i'm afraid! ;) Vincent Snijders wrote: Dave Coventry schreef: Arrrgh! installed glib (emerge glib) Same error. And the devel lib, which installs the symlink. emerge glib-devel or glib-dev Vincent _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Re: Linking Fails: cannot find -lglib
Btw as you said this: There is some --only-deps (or so) option for emerge. :) I also use Lazarius via subversion and only installed it locally in my home-folder, because I don't like the GTK2 version of Lazarus much (as it is not stable). I also want to have write access to it to recompile it time from time (for testing something and so on) and this is against the idea to have an application installed in the system (no user account on a system should never have write access to any globally installed software). But I use FPC via Portage, because it is stable from there. I wanted to point out the thing with the USE flags, because it seems to me, that you haven't understood this in detail. Perhaps I have missinterpreted this, but if not, take a look at this technic. You don't need to have some unclean installation of FPC in your system (every Gentoo user don't like unclean installations not using Portage, because the advantage of Gentoo is the cleanness of the system you got (if you don't break some basic rules and one of these rules is: never install anything not using Portage)). Am Dienstag, den 16.01.2007, 09:04 -0500 schrieb [EMAIL PROTECTED]: Albert, Thanks for your reply. My original intention was to use the ebuild to satisfy dependencies and this did, in fact work. I was able to install the subversion installation of Lazarus without too many problems, apart from Lazarus being unable to find the FPC sources. Original Message: - From: Albert Zeyer [EMAIL PROTECTED] Date: Tue, 16 Jan 2007 14:39:59 -0100 To: lazarus@miraclec.com Subject: Re: [lazarus] Re: Linking Fails: cannot find -lglib Am Dienstag, den 16.01.2007, 10:16 +0200 schrieb Dave Coventry: Oops. This is possibly the crux of my problem. CoLinux cannot access any of the hardware on the machine, so I use a Virtual Desktop called Xming which acts as a VNC client similar to TightVNC. So I don't actually have X11 installed. Which could be a problem. My wheeze using the ebuild version of lazarus-0.9.12 also failed: * You need to build dev-lang/fpc with the 'source' USE flag * in order for lazarus to work properly !!! ERROR: dev-lang/lazarus-0.9.12 failed. Set the 'source' USE flag for FPC. You can set this globaly in /etc/make.conf or esp. for FPC by: echo dev-lang/fpc source /etc/portage/package.use This USE flag indicates for packages, that they shall install the source. (Read the Gentoo Handbook. USE flags are one of the base technics of Portage and this technic should be one of the reasons for using Gentoo.) mail2web - Check your email from the web at http://mail2web.com/ . _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives smiley-3.png Description: PNG image
Re: [lazarus] Compiled Linuxy Binary Compatibility/A bit (OT)
Hi There are severeal parts you should seperate: Firstly, all the hardware-stuff: On the one hand, you have the CPU architecture. It is easy to investigate (Wikipedia is your friend), which architecture is compatible with some other. For example, you have 386 486 586/pentium1/amd_k6 686/all_other_pentium2/all_other_amd. The advantage of an 486 compatible binary is, it runs mostly everywhere (on so called x86 machines). The advantage of an 686 compatible binary is more performance (this binary takes account of the new CPU commands and so on). AMD64 (called x86_64 under Linux) is compatible with x86 (but you have to ensure, that I think the 32bit version of libc and some other libs are also available on the system; on most AMD64 Linux distributions, this is the case). On the other side, I64 is not. (Don't know exactly, if it is the case for PowerPC/PowerPC64 and other architectures.) But note, there are other platforms than x86! :) (Linux on PPC is not uncommon, but there are much more...) Then, there are series of other technics a CPU can have or have not, for example MMX, SSE1/2/3, 3Dnow!, AltiVec and so on. These are special subsets of commands designed to compute some special things. A normal application don't take account of these technics unless the author of the application use it explicitly. But you can have much more performance if you do so. Then, on the other side, there are some library issues. The user of your application has to have the right versions of the libraries you used in your application. You can list them with ldd. Nearly in time released versions (take account of the sub(-sub)-version numbers) of a library are often/mostly (they should by convention) binary compatible, but for example GTK1 is not compatible with GTK2. Regards, Albert Am Dienstag, den 16.01.2007, 10:25 -0500 schrieb Lee Jenkins: Hi all, I have a question about binary compatibility for linux programs that I write in Lazarus/Freepascal. I've done some googling, but am still unsure as to the answer to my question. Namely, if I do not provide source to a program, but still want to distribute it, can I compile the binary on a specific platform and run it on another without re-compiling? For instance, can I compile on a i686 box and run the binary on a 586 box as it is, compiled for 32bit? Or can I 32 bit binary run on a 64 bit linux? Sorry, I know it's a bit OT. Thank you. smiley-3.png Description: PNG image
Re: [lazarus] Compiled Linuxy Binary Compatibility/A bit (OT)
As Michael said, you can cover a very huge range of systems if you distribute an i386 and AMD64 version. (But you should have in mind, that there are also some people with other architectures...) Most closed-source applications for Linux are only available for these (for example Google Earth and others), Opera for example still also provides a version for PPC. (I, as a Linux/PPC user, am a little bit frustaded about the situation, that I cannot use Flash, Google Earth, official ATI drivers, ...) If you distribute a Windows application, you normaly also only distribute a i386 version of it. Some times ago, there was also an Alpha (I think it was Alpha...) version of Windows NT available. And perhaps, ReactOS will be ported to other platforms. :) (Just to point out, that you have with a closed-source distributed application the same possible range.) But as an Open Source developer, I surely recommend you to distribute the source. :) And you are right: Only if you distribute the source, you can ensure, that your application will run nearly everywhere. Am Dienstag, den 16.01.2007, 14:10 -0500 schrieb Lee Jenkins: Albert Zeyer wrote: Hi There are severeal parts you should seperate: Firstly, all the hardware-stuff: Thanks Albert. So it seems that if I do not distribute the source of a program, than I will have to compile binaries for at least a couple of different distributions and/or cpu's. smiley-3.png Description: PNG image
Re: [lazarus] Search Dialog
Am Dienstag, den 17.10.2006, 17:22 +0200 schrieb Lord Satan: On Tue, 17 Oct 2006 11:51:42 +0200 Sam Washkansky [EMAIL PROTECTED] wrote: Problem solved and now I'm a happy camper. Campers get fragged first. Exactly!
Re: [lazarus] how are interfaces / virtual functions handled internally
Am Freitag, den 06.10.2006, 15:13 + schrieb Albert Zeyer: Am Donnerstag, den 05.10.2006, 15:08 +0200 schrieb Christian Iversen: On Thursday 05 October 2006 16:48, Albert Zeyer wrote: Hi I am working on a very huge object-system, that means, I will have thousands objects and more in the memory. I am now thinking on how to redrucing the needed memory for each object to a minimum. The base of all objects is abstract, that means, I could use an interface for it or an abstract class with virtual abstract functions. I will have much helper functions on each object (~ 30 at the moment), that don't need to be virtual, because they should always behave the same, they internally simply use the other virtual functions. I don't want them outside the abstract class or the interface, because I don't want to have a mixture between a procedural and an object-oriented code. But the count of virtual functions is also not very small (~ 10 - 20). If I have a TObject1 and a TObject2 which both implements the abstract class TBaseObject, then what exactly is saved internally by an instance of each class? Does they contain a full table for each virtual function (that means ~ 40 - 80 bytes only for this table) or does they simply have a reference to their implementor-class (this means 4 bytes)? They simply have a reference to the TClass. Interfaces are much like this, although not exactly (but they scale as O(1) instead of O(n), with n objects) I will have perhaps not more than 5 different implementor-classes, so if a virtual function table is saved for every object, this table would look mostly the same on all objects. It's only saved for every class. Ah, that is what I wanted to hear. If I use an interface instead of the abstract class, is it the same situation or is the virtual function handling different? It's _almost_ the same. You don't need to worry about the difference, it's only important when programming the compiler. OK, the differences are not important for me (at the moment). But if I use an interface, where should I declare all my helper functions for the object? If I declare them all in the interface, the interface would be very huge. You should make an extra interface, which can be accessed by QueryInterface(). Then, on implementations that support the helper functions, you return the helper interface. On other implementations, you return nil. The helper functions should support all objects, not only a few, because the helper functions only use the base interface. So I don't want to make a check if they support them, they all simply do. For example, my base interface is: TFunction = interface function Map(Value: real): real; end; Helper functions (if they are procedural): function Integrate(fct: TFunction; a,b: real): real; function Diff(fct: TFunction; a: real): real; function GetZero(fct: TFunction; a,b: real): real; // calls Exception if no value is found ... I solved this now with a handler-object and I uses interfaces. This would look like the following for the given example: IFunction = interface function Map(Value: real): real; end; TFunctionHandler = class public: constructor Create(aFunction: IFunction); function Integrate(a,b: real): real; function Diff(a: real): real; function GetZero(a,b: real): real; // calls Exception if no value is found ... private: mFunction: IFunction; end; This solves all problems and gives me all wanted features. I don't think there is a better way to do it if I want to avoid abstract classes (because I need multi-inheriting and reference counting). And if I don't want to define the helper functions again and again for each implementor (that means to recode always the same), I have to have an abstract class again because else there is no way to declare them elsewhere. There are several ways that interfaces can help you there - one of them would be the IMPLEMENTS-keyword. Can you give me an example? I know the implements-keyword and how to use it (everything from here: http://info.borland.com/techpubs/delphi/delphi5/oplg/objintrf.html ), but I cannot imagine, how to use this in my case. In principle I want non-virtual functions in my interface. If I use abstract classes, I can do this. But I want to use interface for a few reasons. I also need reference counting. I will have situations, where I want to create a huge amount of these objects, therefore it is important to save memory for each instance. You're not much worse off by using interfaces. A few thousand objects should take only a few KB more mem. I hope you're not THAT pressed for memory? :) Ah, that's OK. That is clear. Only if all objects save the virtual function table seperatly, I would have that problem. As far as I know, I would have the problem in C++. Regards
Re: [lazarus] how are interfaces / virtual functions handled internally
Am Donnerstag, den 05.10.2006, 15:08 +0200 schrieb Christian Iversen: On Thursday 05 October 2006 16:48, Albert Zeyer wrote: Hi I am working on a very huge object-system, that means, I will have thousands objects and more in the memory. I am now thinking on how to redrucing the needed memory for each object to a minimum. The base of all objects is abstract, that means, I could use an interface for it or an abstract class with virtual abstract functions. I will have much helper functions on each object (~ 30 at the moment), that don't need to be virtual, because they should always behave the same, they internally simply use the other virtual functions. I don't want them outside the abstract class or the interface, because I don't want to have a mixture between a procedural and an object-oriented code. But the count of virtual functions is also not very small (~ 10 - 20). If I have a TObject1 and a TObject2 which both implements the abstract class TBaseObject, then what exactly is saved internally by an instance of each class? Does they contain a full table for each virtual function (that means ~ 40 - 80 bytes only for this table) or does they simply have a reference to their implementor-class (this means 4 bytes)? They simply have a reference to the TClass. Interfaces are much like this, although not exactly (but they scale as O(1) instead of O(n), with n objects) I will have perhaps not more than 5 different implementor-classes, so if a virtual function table is saved for every object, this table would look mostly the same on all objects. It's only saved for every class. Ah, that is what I wanted to hear. If I use an interface instead of the abstract class, is it the same situation or is the virtual function handling different? It's _almost_ the same. You don't need to worry about the difference, it's only important when programming the compiler. OK, the differences are not important for me (at the moment). But if I use an interface, where should I declare all my helper functions for the object? If I declare them all in the interface, the interface would be very huge. You should make an extra interface, which can be accessed by QueryInterface(). Then, on implementations that support the helper functions, you return the helper interface. On other implementations, you return nil. The helper functions should support all objects, not only a few, because the helper functions only use the base interface. So I don't want to make a check if they support them, they all simply do. For example, my base interface is: TFunction = interface function Map(Value: real): real; end; Helper functions (if they are procedural): function Integrate(fct: TFunction; a,b: real): real; function Diff(fct: TFunction; a: real): real; function GetZero(fct: TFunction; a,b: real): real; // calls Exception if no value is found ... And if I don't want to define the helper functions again and again for each implementor (that means to recode always the same), I have to have an abstract class again because else there is no way to declare them elsewhere. There are several ways that interfaces can help you there - one of them would be the IMPLEMENTS-keyword. Can you give me an example? I know the implements-keyword and how to use it (everything from here: http://info.borland.com/techpubs/delphi/delphi5/oplg/objintrf.html ), but I cannot imagine, how to use this in my case. In principle I want non-virtual functions in my interface. If I use abstract classes, I can do this. But I want to use interface for a few reasons. I also need reference counting. I will have situations, where I want to create a huge amount of these objects, therefore it is important to save memory for each instance. You're not much worse off by using interfaces. A few thousand objects should take only a few KB more mem. I hope you're not THAT pressed for memory? :) Ah, that's OK. That is clear. Only if all objects save the virtual function table seperatly, I would have that problem. As far as I know, I would have the problem in C++. Regards, Albert
[lazarus] how are interfaces / virtual functions handled internally
Hi I am working on a very huge object-system, that means, I will have thousands objects and more in the memory. I am now thinking on how to redrucing the needed memory for each object to a minimum. The base of all objects is abstract, that means, I could use an interface for it or an abstract class with virtual abstract functions. I will have much helper functions on each object (~ 30 at the moment), that don't need to be virtual, because they should always behave the same, they internally simply use the other virtual functions. I don't want them outside the abstract class or the interface, because I don't want to have a mixture between a procedural and an object-oriented code. But the count of virtual functions is also not very small (~ 10 - 20). If I have a TObject1 and a TObject2 which both implements the abstract class TBaseObject, then what exactly is saved internally by an instance of each class? Does they contain a full table for each virtual function (that means ~ 40 - 80 bytes only for this table) or does they simply have a reference to their implementor-class (this means 4 bytes)? I will have perhaps not more than 5 different implementor-classes, so if a virtual function table is saved for every object, this table would look mostly the same on all objects. If I use an interface instead of the abstract class, is it the same situation or is the virtual function handling different? But if I use an interface, where should I declare all my helper functions for the object? If I declare them all in the interface, the interface would be very huge. And if I don't want to define the helper functions again and again for each implementor (that means to recode always the same), I have to have an abstract class again because else there is no way to declare them elsewhere. I will have situations, where I want to create a huge amount of these objects, therefore it is important to save memory for each instance. Regards, Albert
Re: [lazarus] Building 32-bit Lazarus on a 64-bit Suse 10.1
Am Dienstag, den 26.09.2006, 09:18 -0400 schrieb David B Copeland: Hi all, I can't recall if this question has been answered before, but ... I am running 63-bit Suse 10.1, and I'm trying to install/build 32 bit Lazarus. FPC 2.1.1 32-bit is installed. Lazarus seems to compile fine, but the link fails because its picking the 64-bit versions of the pthread and gdk libraries. How do I tell it to use 32-bit versions? Under Gentoo, there are special packages providing this 32bit versions for this libs (I think these are only wrappers for the 64bit ones). Do you have installed this 32bit versions? If you have done this, I think you can specify the lib-path with the -Xr option. Perhaps, you could also use the LD_PATH variable. -- Albert
Re: [lazarus] Screenshot tool under Linux
Am Freitag, den 22.09.2006, 14:01 + schrieb Albert Zeyer: If you hit Alt+Print (I think it was Alt, perhaps it could also be Shift or Ctrl) will make a screenshot of the selected window in the foreground under Gnome. This is this very usefull and make a screenshot of a special region redundantly for me. ... Sorry, I haven't read carefully . If you use Compiz, you can press the 'Super'-key (it is the Windows-key on most x86 PCs) and then select a region. This will produce a screenshot of this region.
Re: [lazarus] Help!!
Which error? Please write the full last ~20-30 lines of the emerge. Most known errors are also reported on http://bugs.gentoo.org, you often also find there a solution for a problem. But I don't think it is a big problem. On all my PCs here, where I installed Lazarus (AMD64, PPC, a few x86), I doesn't have any problems. But I think I installed them with activated ~ARCH keyword (this will install a newer version of the special package). Read the part about Portage in the Gentoo handbook, there you got a description about how to use the genious features of Portage. Shortly, to add a ~ARCH keyword (where ARCH is your architecture, for example x86), you have to do this: echo dev-lang/lazarus ~x86 /etc/portage/package.keywords echo dev-lang/fpc ~x86 /etc/portage/package.keywords If you would like also to install the documentation and the source of FPC, you have to activate the appropriate USE-flags. You can do this globaly in your /etc/make.conf (but I would not do this, your system will be blown up) or for a special keyword in the /etc/portage/package.use. This should look like this: echo dev-lang/fpc doc source /etc/portage/package.use Am Donnerstag, den 21.09.2006, 11:58 +0800 schrieb Jonathan Chiu: I tried with emerge lazarus in gentoo but error found in compile time of fpc. On 9/19/06, Albert Zeyer [EMAIL PROTECTED] wrote: Am Montag, den 18.09.2006, 09:57 +0700 schrieb Colin Lehmann: Well I give up, I simply cannot get anything to work. I have changed the compiler path, the lazarus path, done make clean all so may times I can do it in my sleep. This afternoon I am going to re-install Ubuntu and start again, hopefully this time something will work!! Thanks everyone for your patience and consideration for a fumbling Linux amateur, I still have my Windows 2000 machine so all is not lost Colin _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives You could try out Gentoo ( www.gentoo.org). The installation of Lazarus is easy there (like most other things, too). You have to run the command 'emerge lazarus' and that's it. -- Albert _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] deploy an application
Am Donnerstag, den 21.09.2006, 14:32 +0200 schrieb Andrea Mauri: Hi to all, I build a little application that I would like to deploy by the web. I compiled both on Windows and Linux. For the Windows application I used InnoSetup, I deploy only the exe file. I need to deploy some libraries too? And for Linux? How can I know which libraries my application needs in order to work properly? You can use 'ldd binary', it will show you a list of all linked libraries. It depends on the LCL-Interface, you use. If you choosed GTK1, then the GTK1 libs are needed. Most of the libs listed there are on mostly all Linux distributations out there. I would like to deploy only the binary file and not the source. Which is the best way in order to do that? RPM? Tarball? Both and more. A Debian-package would be also nice for Debian users and an Ebuild would be nice for Gentoo users. RPM is the prefered type for Red Hat and SuSE users. I have to deploy all the required libraries? The users can install the missing libraries by his own? Most package systems support dependency-lists. You can add the appropriate libs to this list. There is a tutorial where I can find this kind of information? I read Deploy your application tutorial but I didn't find any information about the required libraries if I decide that I don't want to use RPM. An on which Linux distribution works the RPM? RPM would work on allmost every Linux distribution, if the appropriate tools are installed there. But I would not install a RPM directly on my Gentoo system. I would extract the files and install them manually or write a simple ebuild for it. The best way I think should be a tarball. You could write then a Debian package or a Gentoo ebuild, which use this tarball to install your program. -- Albert
Re: [lazarus] Help!!
Am Montag, den 18.09.2006, 09:57 +0700 schrieb Colin Lehmann: Well I give up, I simply cannot get anything to work. I have changed the compiler path, the lazarus path, done make clean all so may times I can do it in my sleep. This afternoon I am going to re-install Ubuntu and start again, hopefully this time something will work!! Thanks everyone for your patience and consideration for a fumbling Linux amateur, I still have my Windows 2000 machine so all is not lost Colin _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives You could try out Gentoo (www.gentoo.org). The installation of Lazarus is easy there (like most other things, too). You have to run the command 'emerge lazarus' and that's it. -- Albert _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] My fpc file
Am Dienstag, den 12.09.2006, 17:17 +0700 schrieb Colin Lehmann: ... Searching file fpc.cfg... not found Configfile search: /home/colin/.fpc.cfg Searching file /home/colin/.fpc.cfg... found Reading options from file /home/colin/.fpc.cfg ... So it seems that fpc is using the /home/colin/.fpc.cfg It is possible to have both versions (2.0.2 and 2.0.4) installed but you have to set the right paths to select the version you want to use. Albert
Re: [lazarus] Hello world (no output)
The created binary (the EXE-file on Windows) should be in the project-path, that is, where you saved your project. If you have not saved it till now, the binary is in your /tmp directory. The output of the program itself can be seen on the console. So run your program in any terminal (on Windows the cmd.exe) and you will see the fascinating result. Albert Am Dienstag, den 12.09.2006, 14:17 +0200 schrieb Friedrich Hattendorf: i created: file - new - custom program (i use the german version and retranslated the above words; maybe, they are only similar) Then I wrote the following Program 8--- program Project1; {$mode objfpc}{$H+} uses Classes, SysUtils { add your units here }; begin writeln('Hello world'); end. 8--- The message-Box told Project created succesfully But where is the output? Friedrich _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Installing....
If you have updatet FPC last time, check the correctness of the unit-path in your /etc/fpc.conf. I had the same error on saterday and this was my fault. Albert Am Montag, den 11.09.2006, 08:54 +0700 schrieb Colin Lehmann: I have been struggling with the installation of Lazarus for two days. I now get after the MAKE CLEAN ALL the 'compilation aborted' error with Can't find unit glib'. Where is glib supposed to be? What is its full name? Where do I insert it so the compiler can find it? I downloaded the glib package but it didn't help Help!! _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Fast Named InterfaceList access
I don't think so. You have another problem with your current implementation: The reference counting of your interfaces will not work. You have to call manually the _AddRef and _Release of the interface after adding them to the list and removing them. You also can't use FList.Clear, because then the reference counting doen't work either. Am Samstag, den 09.09.2006, 20:10 -0300 schrieb Cesar Romero: Can someone suggest a better way to do that? Now Im using: THashedInterfaceList = class(TInterfacedObject, IHashedInterfaceList) private FList: THashedStringList; protected function Add(const Name: string; const Item: IInterface): Integer; function GetCount: Integer; function GetItem(const Name: string): IInterface; function GetItems(const Index: Integer): IInterface; function IndexOf(const Name: string): Integer; function IndexOfItem(const Item: IInterface): Integer; procedure Clear; procedure Delete(const Index: Integer); property Item[const Name: string]: IInterface read GetItem; property Items[const Index: Integer]: IInterface read GetItems; default; property Count: Integer read GetCount; public constructor Create(const SortList: boolean = False); virtual; destructor Destroy; override; end; function THashedInterfaceList.Add(const Name: string; const Item: IInterface): Integer; begin Result:= FList.AddObject(Name, Pointer(Item)); end; procedure THashedInterfaceList.Clear; begin FList.Clear; end; constructor THashedInterfaceList.Create(const SortList: boolean); begin inherited Create; FList:= THashedStringList.Create; FList.Duplicates:= dupError; FList.Sorted:= SortList; end; procedure THashedInterfaceList.Delete(const Index: Integer); begin FList.Delete(Index); end; destructor THashedInterfaceList.Destroy; begin FList.Free; inherited; end; function THashedInterfaceList.GetCount: Integer; begin Result:= FList.Count; end; function THashedInterfaceList.GetItem(const Name: string): IInterface; begin Result:= Items[IndexOf(Name)]; end; function THashedInterfaceList.GetItems(const Index: Integer): IInterface; var LItem: Pointer; begin if (Index NotFound) and (Index Count) then LItem:= FList.Objects[Index] else LItem:= nil; Result:= IInterface(LItem); end; function THashedInterfaceList.IndexOf(const Name: string): Integer; begin Result:= FList.IndexOf(Name); end; function THashedInterfaceList.IndexOfItem(const Item: IInterface): Integer; begin Result:= FList.IndexOfObject(Pointer(Item)); end; _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Stretching a PNG
Am Freitag, den 08.09.2006, 03:56 -0300 schrieb Flvio Etrusco: I've seen many sh***y things coming from MS through the years, but I you really saying that their stretch (down) algorithm is worst than copy every Nth pixel??? This is something I'll have to see before my eyes ;-) Yes, I don't know the exact algorithm of the StretchBtl from WINAPI, but the result by it looks a little bit crappier than to copy every Nth pixel. Look here the difference in my little game Robot: Copy every Nth pixel: http://www.az2000.de/downloads/own_stretch.png WINAPI: http://www.az2000.de/downloads/ms_stretch.png GTK: http://www.az2000.de/downloads/gtk_stretch.png BTW, there's a WinAPI function to set the stretch quality... I don't remember its name right now, unfortunately :-( This is interesting. Is the WINAPI StretchBtl affected by this? Albert PS: Sorry Flvio, I hit the wrong button so you will get another private copy of this mail
Re: [lazarus] Stretching a PNG
Hi Are you using Windows? I recognized that the StretchBlt in the Windows API sometimes results in crappy effects while scaling down a picture. On GTK, I don't have this effects. To avoid such effect, I coded a very simple own Stretch-Function: Excerpt from my little sample game Robot: procedure TMainForm.CopyRect(DstCanvas: TCanvas; const Dest: TRect; SrcCanvas: TCanvas; const Source: TRect); procedure OwnCopyRect(); var x,y: Integer; w,h: Integer; sw, sh: Integer; begin w := Dest.Right - Dest.Left; h := Dest.Bottom - Dest.Top; sw := Source.Right - Source.Left; sh := Source.Bottom - Source.Top; for x := 0 to w do for y := 0 to h do begin DstCanvas.Pixels[Dest.Left + x, Dest.Top + y] := SrcCanvas.Pixels[Source.Left + (x * sw) div w, Source.Top + (y * sh) div h]; end; end; begin {$IFDEF win32} // WIN API StretchBlt is shit ! OwnCopyRect(); {$ELSE} // on something else, we have already a good copyrect ... DstCanvas.CopyRect(Dest, SrcCanvas, Source); {$ENDIF win32} end; Regards, Albert Am Donnerstag, den 07.09.2006, 14:45 +0300 schrieb Ewald Horn: Hi, when I stretch a PNG file (256 colours) to fit a smaller window the new image quality is extremely poor. Am I doing something wrong here ? In Lazarus I use a TImage component and set the Stretch property to true. Maybe there is another way to make an image fit the constraints of the component ? If I resize the image with XnView and the load it it works, but that defeats the purpose of being able to browse images on the fly. Kind regards Ewald Horn _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] class-references
Am Dienstag, den 22.08.2006, 10:15 +0200 schrieb Graeme Geldenhuys: On 8/21/06, Mattias Gaertner [EMAIL PROTECTED] wrote: TTestObject.Create won't ever be called (only TBaseTestObject.Create will be, but if I use TClass instead of TBaseTestClass, it also won't be). It also makes no difference if I use TPersistent as base or simply TObject. But the DoSomething call works nevertheless, therefore it seems, that the VMT (and other stuff) is initialized correctly, but my own constructor won't ever be called. Make 'Create' virtual. Mattias Oops! Didn't see this was already answered... At the very first beginning of my thread, I wrote: I think, RTTI is very powerfull and there should be a way to do the same as above without a virtual constructor. But is it clean? But you are the second one who said, I should use a virtual constructor, so it seems, that it is the cleanest way. Greetings, Albert
Re: [lazarus] class-references
I think, RTTI is very powerfull and there should be a way to do the same as above without a virtual constructor. But is it clean? To use RTTI you must derive from TPersistent or use the {$M+} directive. In practice, I have a abstract base class with a function like this: function TMyBase.CreateCopy(): TMyBase; begin Result := Self.ClassType.Create(); // this doesn't work because ClassType is a TClass // TODO: fill the result with same data ... end; With TPersistent it would work like this TMyBase = class(TPersistent) public function CreateCopy: TMyBase; procedure Assign(Source: TPersistent); override; end; it would be function TMyBase.CreateCopy: TMyBase; begin Result := TMyBaseClass(Self.ClassType).Create; Result.Assign(Self); end; Every class must override the Assign method to copy all added values. But in this case, it would also not call the constructor of my inherited classes. The assignment of the data inside the object is not the problem, I have other virtual functions I can use for this. But it is important, that the constructor of my inherited class is also called because it does some important and needed init-work (which depends on the inherited class). Another possibility: Use TComponent as base class. Then you can copy without writing the Assign procedures. The IDE uses this. It is much slower than the Assign approach. Performance is important in my case. I will have very much of this objects. It seems that virtual constructors are the only possibility. Albert
Re: [lazarus] class-references
Am Montag, den 21.08.2006, 19:17 +0200 schrieb Mattias Gaertner: On Mon, 21 Aug 2006 14:30:06 + Albert Zeyer [EMAIL PROTECTED] wrote: With TPersistent it would work like this TMyBase = class(TPersistent) public function CreateCopy: TMyBase; procedure Assign(Source: TPersistent); override; end; it would be function TMyBase.CreateCopy: TMyBase; begin Result := TMyBaseClass(Self.ClassType).Create; Result.Assign(Self); end; Every class must override the Assign method to copy all added values. But in this case, it would also not call the constructor of my inherited classes. Why not? Did you test it? Yes, I tested the following code: // ... type TBaseTestObject = class(TPersistent) constructor Create(); procedure DoSomething(); virtual; abstract; end; TBaseTestClass = class of TBaseTestObject; TTestObject = class(TBaseTestObject) public constructor Create(); destructor Destroy(); override; procedure DoSomething(); override; end; TSkriptTestForm = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); mTest: TTestObject; end; var SkriptTestForm: TSkriptTestForm; implementation procedure TSkriptTestForm.Button1Click(Sender: TObject); var cls: TBaseTestClass; begin cls := TTestObject; mTest := cls.Create() as TTestObject; mTest.DoSomething(); end; constructor TBaseTestObject.Create(); begin inherited Create(); WriteLn('TBaseTestObject Create'); end; constructor TTestObject.Create(); begin inherited Create(); WriteLn('TTestObject Create'); end; destructor TTestObject.Destroy(); begin WriteLn('TTestObject Destroy'); inherited Destroy(); end; procedure TTestObject.DoSomething(); begin WriteLn('TTestObject DoSomething'); end; // TTestObject.Create won't ever be called (only TBaseTestObject.Create will be, but if I use TClass instead of TBaseTestClass, it also won't be). It also makes no difference if I use TPersistent as base or simply TObject. But the DoSomething call works nevertheless, therefore it seems, that the VMT (and other stuff) is initialized correctly, but my own constructor won't ever be called. Albert
[lazarus] class-references
Hello, I want to use class-references (class of SOMECLASS) as a way for a dynamic object factory. First I tried it with the predefined type TClass (:= class of TObject), but this doesn't work, because Create is not virtual in TObject (it costs some time to find out that this is the problem, nevertheless it is logical in some way... perhaps my experiences with ObjectPascal are to small). So I tried the following and it works as I want: // - ... type TBaseTestObject = class constructor Create(); virtual; end; TBaseTestClass = class of TBaseTestObject; TTestObject = class(TBaseTestObject) public constructor Create(); override; destructor Destroy(); override; end; TSkriptTestForm = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); mTest: TTestObject; end; procedure TSkriptTestForm.Button1Click(Sender: TObject); var cls: TBaseTestClass; begin cls := TTestObject; mTest := cls.Create() as TTestObject; end; constructor TBaseTestObject.Create(); begin // is this needed? it calls TObject.Create, but what does it? inherited Create(); WriteLn('TBaseTestObject Create'); end; constructor TTestObject.Create(); begin inherited Create(); WriteLn('TTestObject Create'); end; destructor TTestObject.Destroy(); begin WriteLn('TTestObject Destroy'); inherited Destroy(); end; // - But is there an easier way than this, so that I can use simply TClass? I think, RTTI is very powerfull and there should be a way to do the same as above without a virtual constructor. But is it clean? In practice, I have a abstract base class with a function like this: function TMyBase.CreateCopy(): TMyBase; begin Result := Self.ClassType.Create(); // this doesn't work because ClassType is a TClass // TODO: fill the result with same data ... end; Albert
[lazarus] cast interface to object
Hi, Is there a way to cast an interface to an object? If I have an interface: IBlub = interface function GetSomething(): TObject; end; And somewhere, I have: var Blub: IBlub; ... Therefore, Blub is an interface-reference to some object which implements the interface. How can I get this TObject? A simply cast like TObject(Blub) surely does not work, because Blub points to the function table of the interface. But Blub itself has to save the object somewhere because if I now call Blub.GetSomething(), I have Self inside of GetSomething. I could make the following implementation for GetSomething: function TSomeBlub.GetSomething(): TObject; begin Result := Self; end; (I would rename it to GetSelf or GetImplementingObject or perhaps GetImplementingClass (then I would return Self.ClassType).) But is there a better, direct way? It seems like a hack/workaround to implement such a function. Albert
Re: [lazarus] reference-counting
No, it will not. Reference counting with interfaces only works if you use interfaces as referencing types (so it has to be 'var MyObject: IUnknown'), all class-typed variables will not counted. I think this is because all class-typed variables are simply pointers and an interface variable is handled special (like a smart-pointer-structure in C++, which capsulate a pointer and does the reference counting automatically for you; this works, because a smart-pointer is constructed on the heap and so, it will automatically call the destructor if it goes out of scope). Is there a way to make a smart-pointer in pascal? Is it possible to create objects on the heap so that they will get destroyed and freed automatically when they get out of scope? Or is there a way to get informed if a class-typed variable get out of scope? I think it doesn't look so clean, if I use interfaces to manage reference counting. In my case it is not possible to do without this, because there is no efficient way to decide if there are other references to an object. If I would rewrite my program to use interfaces everywhere, is there a way to mix predefined functions (which are often uses other abstract functions in the background, but give an easier way to the user to do a few things and if there is no real reason, they would be implemented in all classes the same) and abstract functions (the default in interfaces). If this is possible (how? all my functions are abstract by default), is it possible to make some helper-functions private or protected? You see, I thought, this is not possible, that is the reason, why I uses (partly) abstract classes at the moment. Albert Am Donnerstag, den 17.08.2006, 08:41 +0200 schrieb Vincent Snijders: Cesar Romero schreef: Is there a way to use the reference counting (used with interfaces) with normal objects? Currently not, unless you use TInterfacedObject. But you have to declare as Interface I guess TInterfacedObject implemets IUnknown, so you don't need to declare a interface. type TMyClass = class(TInterfaceObject) // all your things. end; var MyObject : TMyClass; MyObject will be reference counted. Vincent _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] HashMap
Which one do you mean? I only find there a few special lists. But I need an implementation of a map (key elements map to some data), implemented with B-trees or similar (the key elements need to be hashed for this), like hash_map in STL. In my case, I don't need a special hash function because my key elements are object pointers. Albert. Am Donnerstag, den 17.08.2006, 08:08 +0200 schrieb Michael Van Canneyt: On Thu, 17 Aug 2006, Albert Zeyer wrote: Hi there. Is there any HashMap-implementation in the units of FPC? I didn't find one. Is an implemenentation missing till now? How can you life without it? :) There is a hash implementation in the contnrs unit, but I don't know if this is suitable for your purposes. Michael. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] HashMap
Thank you, this is a good base. But I need it a little bit more abstract. Mainly, I also need reference counting on the objects (interfaces now) I saved there. Yes, I can call _AddRef and _Release by myself, but this doesn't look very nice. And in future, I want to use other sort of key elements (eg strings). It would be nice if I can select any hash-function (a function, which maps my object to an integer) for my key objects so that I can use everything as keys. The code has to be extended a little bit to handle collisions. If I find the time, I can do this. And Burkhard is right, this should be merged into the FPL tree. Albert Am Donnerstag, den 17.08.2006, 11:25 +0200 schrieb Mattias: On Thu, 17 Aug 2006 11:16:58 + Albert Zeyer [EMAIL PROTECTED] wrote: Which one do you mean? I only find there a few special lists. But I need an implementation of a map (key elements map to some data), implemented with B-trees or similar (the key elements need to be hashed for this), like hash_map in STL. In my case, I don't need a special hash function because my key elements are object pointers. lcl/avglvltree.pas has TPointerToPointerTree Usage: Tree:=TPointerToPointerTree.Create; Tree[SomePointer]:=SomeData; Value:=Tree[SomePointer]; Mattias Albert. Am Donnerstag, den 17.08.2006, 08:08 +0200 schrieb Michael Van Canneyt: On Thu, 17 Aug 2006, Albert Zeyer wrote: Hi there. Is there any HashMap-implementation in the units of FPC? I didn't find one. Is an implemenentation missing till now? How can you life without it? :) There is a hash implementation in the contnrs unit, but I don't know if this is suitable for your purposes. Michael. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] HashMap
The SDL port is very interesting. All data structures I missed are there. I will take a deeper look tomorrow, but I think, this is what I want. Albert Am Donnerstag, den 17.08.2006, 12:02 +0200 schrieb Burkhard Carstens: Am Donnerstag, 17. August 2006 13:16 schrieb Albert Zeyer: Which one do you mean? I only find there a few special lists. But I need an implementation of a map (key elements map to some data), implemented with B-trees or similar (the key elements need to be hashed for this), like hash_map in STL. In my case, I don't need a special hash function because my key elements are object pointers. Albert. 1. There has been something in the fpc-announce mailing list about PascalAdt. I just have no idea, where to find the sources. 2. There is something in fpcprojects, that might be interesting. Docs: http://www.stack.nl/~marcov/decal.pdf Sources: www.freepascal.org/cgi-bin/viewcvs.cgi/contrib/ decal/?root=fpcprojectsrev=814 regards Burkhard _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Debug idea
That's only partly true. I think it cames with VB4 (32 Bit Version), VB5 or even only with VB6, but there you could choose to compile a real native Win32-EXE (which completly depends on the runtime DLL). That is not the same (but the speed increases aren't much higher in the native version then in the traditional byte code version). I would definitfly not call VB a script language. Java, C# (and all of the .Net languages) and a few other languages compiles only to a byte code, too. But in this time, I don't know which language to call a script language. Most of the script languages I know compile to byte code (the source, the executable contains only text, but the interpreter creates the byte code in memory and runs it then) to make them a little bit faster. But to the question to have a debug console where you can execute commands at run time: I didn't try it, but I think, there are a few possibilities with the methods of TObject StringMessageTable, GetInterfaceTable, Method*, Dispatch, ClassName, ClassParent. You can write a simple parser which uses this methods to call some functions of your own classes at run time by user input. The RTTI of Free Pascal contains much usefull things, but I don't know, if it's enough. Albert Am Dienstag, den 15.08.2006, 22:54 +0300 schrieb ik: The difference between VB and native languages, is that VB is a script language with internal interpreter. The executable file that is generated by VB actually contain byte code that is translated and executed on run time. That means that you can do such things inside your code. I do not know if it is possible, but on Delphi you could create something similar, using the interfaces of the IDE... Another trick is to write it to a file and parse it when needed :) Other then that, you can evaluate data on run time like in VB, so that's the same... Ido On 8/15/06, Christian Ulrich [EMAIL PROTECTED] wrote: Some days ago, i have seen on the screen of one of our visual basic programmers that Visual basic has something like an debug console. Where you can write something with an special function. I think this could be an good idea for lazarus, that evry line from debugln() is written at an seperate console or something else Christian _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] reference-counting
Hi, Is there a way to use the reference counting (used with interfaces) with normal objects? Albert