Re: [Lazarus] TFont.size
On Fri, 1 May 2009 17:35:19 -0300 Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com wrote: Hello, Does anyone the difference between TFont.Height and TFont.Size? ... A rather exoteric property IMHO. Or yet another Windowsism in Delphi Not so much a Windowsism as baggage from the days before screens when 'printing' was never to a screen but only a process that transferred ink from hand set lead typeface to paper. Traditionally type sizes were measured in printer points, defined as 1/72 inch as measured by the EM square of the font. The EM square is the size of the lead block that would enclose a capital letter M (the block is fractionally bigger than the actual printed size of the M). The two different properties Delphi provides to set the size of a font relate to the two possible expressions of the font: printing to paper and 'printing' to the screen. If you specify the font's size using the Font.Size property, the font is scaled to match the size you specify in printer points. If you specify the font's size using the Font.Height property, the font is scaled in pixels. If you specify the Height as a positive value, the font's external leading is included in the calculation. If you specify a negative value, the font's external leading is not included in the calculation. (Traditionally leading, pronounced like the metal lead, means the line spacing, dating from the time when thin strips of lead were placed between lines of type to increase the space between lines). Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Easiest way to case strings
On Sun, 22 Mar 2009 16:14:09 +1000 Alexander Klenin kle...@gmail.com wrote: On Sun, Mar 22, 2009 at 08:57, Howard Page-Clark h...@talktalk.net wrote: IndexStr() and AnsiIndexStr() were introduced in the then new StrUtils unit that shipped with BDS 3.0 (Delphi 2005). There is no StrUtils unit, or access to these functions in my Delphi 5 installation. Are you sure? I did not found Delphi 5 installation, but managed to install Delphi 6 -- StrUtils unit is at C:\Program Files\Borland\Delphi6\Source\Rtl\Common\StrUtils.pas and it does contain AnsiIndex* functions. Copyright header says 1995-2001 which I think dates at least the unit itself all the way back to Delphi 1. I don't have Delphi 6 - clearly the functions are present there. I was wrong about the timing of the introduction of the StrUtils unit. Maybe my version of Delphi 5 Pro is incomplete or damaged, but I can confirm it does not have the StrUtils unit (or obviously the functions contained there). Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Easiest way to case strings
On Sat, 21 Mar 2009 15:39:23 +0100 Marc Weustink m...@dommelstein.net wrote: Alexander Klenin wrote: On Sat, Mar 21, 2009 at 23:37, Marc Weustink m...@dommelstein.net wrote: At the time I wrote StringCase, AnsiIndexStr / AnsiIndexText were unknown to me. I wonder even if they existed at that time. When did delphi introduce them ? (just a coincidence, I just discovered them last week) They definitely exist in Delphi 7. Google search suggests they were introduced around Delphi 5. That might explain, the first incarnation of StringCase was written in D4 IndexStr() and AnsiIndexStr() were introduced in the then new StrUtils unit that shipped with BDS 3.0 (Delphi 2005). There is no StrUtils unit, or access to these functions in my Delphi 5 installation. Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus not show components caption
On Tue, 10 Mar 2009 13:17:20 -0300 delphi netto.delp...@gmail.com wrote: My Lazarus is not the name of the components in Delphi that option as show components caption, you know someone has a version that has this property? If your question is How can I get Lazarus to show component names in the designer? then (in recent versions of Lazarus) select Environment Options The Options dialog has a TreeView on the left with four headings Environment Editor Codetools Debugger if 'Environment' is not expanded, click on the + sign, then select the subheading Form Editor This page has four panels: Grid Rubber band Miscellaneous Guide lines The first check box under 'Miscellaneous' is the component caption option. If I have not understood your question correctly, you'll have to ask it again. Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Large Integer errors
On Sat, 14 Feb 2009 12:30:55 +0200 Dave Coventry dgcoven...@gmail.com wrote: function mycalc( num1,num2: real):integer; begin Result:=trunc(num1*num2); end; How can I protect from the product of the two numbers being too big? If it's too big I want to discard it anyway. function mycalc( num1,num2: real):integer; begin Result:=trunc(num1*num2); if result maxint then result := 0; end; Would this do what you want? Howard Page-Clark h...@talktalk.net ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Where to place definition of a record?
On Sun, 25 Jan 2009 00:22:09 +0200 Dave Coventry dgcoven...@gmail.com wrote: I'm following a suggestion for producing my own records so that I can define a custom TStringlist as detailed in this article: http://dn.codegear.com/article/33423 However, I am unsure of where to post this code and am wondering if someone would advise me. ... type TNameValueRecord = record private FNames: array of string; FTypes: array of string; function GetCount: integer; inline; ... end; Delphi 2006 introduced new Pascal syntax - the possibility that records can contain methods and properties in addition to the data fields records have always had. This makes such 'advanced records' a sort of pseudo-class construct. FreePascal/Lazarus does not support this language extension. Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] delphi 4 project w/ database support
On Wed, 24 Dec 2008 11:38:00 -0500 Michael Edwards miedw...@gmail.com wrote: I am familiar with pascal and I became aware of a project (a mud client called Portal) that I use a fair bit that has been open sourced. It was written using Borland Delphi 4. It has some significant database components and currently uses whatever database borland uses by default (I think). I am not familiar with Delphi or Lazarus but I would like to take the code and make it more cross platform friendly since many of our users are Mac or Linux clients. Is this sort of project reasonable? Is Lazarus a good place to start with this given that I am a noob? Lazarus/FPC is definitely a better option for cross platform development of Pascal based applications than the abandoned Kylix. However, a quick look at the source code you pointed to makes me think your ambitions will not be realised. It is definitely 'legacy' code with no concessions to object oriented design at all. The main form has over 80 global variables! I am not familiar with Delphi - so you won't easily comprehend what is a large and complex Delphi application. While it may be open source, it depends on two commercial libraries from Woll2Woll (Infopower and 1stClass). You would have to ask Woll2Woll if these are still available (or supported) for Delphi 4. The Woll2Woll routines (even if available for Delphi 4) would not be compatible with FreePascal runtime database library routines. The databases are all Paradox tables which are not going to port to Linux or Mac easily, if at all. I would say it is a non-starter. Better to write your own game from scratch using Lazarus/FPC (or whatever Pascal you are familiar with) based on the best ideas in the source code and using a contemporary open source database that is actively developed and supported such as Firebird or one of the sql versions. Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Lazarus compilation error, rev 16862
Using FPC 2.2.2 on WinXP SP2 compilation of the latest Lazarus SVN stops at the compilation of codehelp.pas: codehelp.pas1850, 78 Error: Wrong number of parameters specified for call to ExtractCommentContext Is this a known issue, or could there be something wrong with my setup? Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Asyncronous socket error lNet
Usuario AnĂ³nimo wrote I get an asyncronous socket error. This is my code. procedure TForm1.Button1Click(Sender: TObject); var Item: string; begin System.Assign(DataModule1.ItemFile,'items.txt'); System.Reset(DataModule1.ItemFile); repeat System.Read(DataModule1.ItemFile,Item); DataModule1.LTCPComponent1.SendMessage(Item,DataModule1.LTCPComponent1.Iterator); until EOF(DataModule1.ItemFile); System.Close(DataModule1.ItemFile); end; I don't know what a LTCPComponent is. But you could try replacing your repeat ... until loop with: while not EOF(DataModule1.ItemFile) begin ... end; Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Paintbox complete redraw
Boguslaw Brandys wrote: What is the cause of flicker ? I see it is common problem in Lazarus for all controls under Windows ? did you found the reason ? I don't know, but presume flickering controls get painted successively rather than just once. I know various Lazarus graphics routines have recently had a major rewrite, and the evolution and testing is continuing. The results on Windows seem less satisfactory than on unix at the moment. This is the joy of using a tool that is continually being improved, and (I imagine - I'm not clever enough to be one myself) the headache of being a developer where the improvements you introduce in one part of a complex codebase give rise to unwanted or unforeseen side effects elsewhere. Software is imperfect, but Lazarus is much less imperfect than a year or two ago. I can only congratulate its developers on their skill and teamwork, and ability to overcome their disagreements and blend all their insights into a first rate, free tool. Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Paintbox complete redraw
Benito van der Zander wrote: So how can you redraw the paintbox complete in OnPaint? This is a hack, so I hope another may show you how to do it properly. Add a boolean flag to your form class thus: type TForm1 = class( TForm ) ... private FOnPaintCalled: boolean; ... end; and a Formcreate event handler to initialise FOnPaintCalled: PROCEDURE Tform1 .Formcreate ( Sender : Tobject ) ; BEGIN inherited; FOnPaintCalled := false; End; and write the OnPaint handler as follows: PROCEDURE Tform1 .Paintbox1paint ( Sender : Tobject ) ; BEGIN PaintBox1.Canvas.brush.Color:=rgb( random(255), random(255), random(255) ); PaintBox1.Canvas.Rectangle(0, 0, 100, 100); if not FOnPaintCalled then Paintbox1.Invalidate; FOnPaintCalled := not FOnPaintCalled; End; Regards Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Paintbox complete redraw
Benito van der Zander wrote: is there a way to change the whole paintbox in the OnPaint event? For example, if I draw this in Onpaint: PaintBox1.Canvas.brush.Color:=rgb(random(255),random(255),random(255)); PaintBox1.Canvas.Rectangle(0,0,100,100); and move another window in XP over the paintbox it is striped instead of being filled with a single color. When the window covering PaintBox1 is removed, the operating system repaints only the newly exposed region, which your code fills with a (new) randomly generated colour. Unless by chance that new colour happens to coincide with the previous Paintbox colour it will look like exactly what you have coded for: a randomly coloured stripe. If you replace rgb(random(255),random(255),random(255)) with rgb(100, 100, 100) you'll not notice the repainting because it will be painted in the same indistinguishable colour as before (well, there might be some flicker). Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Printing the keyboard mappings setup
On Monday, September 22, 2008 Michael Van Canneyt wrote: I'm just writing an article on printing in Lazarus. I'll send it so you can program it yourself in no time ;-) Could you put this in the wiki or publish it publicly elsewhere so others apart from Graeme can benefit from your experience? Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] [patch] File Browser add-on
Graeme Geldenhuys wrote: I hope others find this useful. :) http://bugs.freepascal.org/view.php?id=12178 Thanks Graeme for this useful contribution. Elegantly coded and works flawlessly. Simple is good. Yours Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] lhelp application fails to compile
Many thanks, it works a treat (I commented out the TPFReaderTarga line, since that function seems to have disappeared as well). The Readme.txt for the project says: From the Help menu choose Configure Help Change to the Viewers tab and select CHM Help Viewer The CHM Help Viewer line is no longer present in current Lazarus versions. Any idea how to reinstate this correctly? Howard - Original Message - From: Lord Satan [EMAIL PROTECTED] To: lazarus@lazarus.freepascal.org Sent: Sunday, September 14, 2008 2:37 PM Subject: Re: [Lazarus] lhelp application fails to compile On Sat, 13 Sep 2008 22:44:40 +0100 Howard Page-Clark [EMAIL PROTECTED] wrote: Identifier not found GetFPImageReaderForFileExtension Indeed this function is not in any of the graphics units given in the project's uses clause. I cannot find it anywhere else either. Can anyone shed any light? This function was removed. There was talk about a replacement system for it but I don't know the actual status. I think the easiest way would be to just write a similar function yourself. This is what I did after the removal. But I also changed my code from using TLazIntfImage to using TFPCustomImage. I don't know if this is an option for lhelp. Here is my more than simple function: function GetFPImageReaderForFileExtension(const FileExt: string ): TFPCustomImageReaderClass; begin if FileExt='.bmp' then Result:=TFPReaderBMP; if (FileExt='.jpg') or (FileExt='.jpeg') then Result:=TFPReaderJPEG; if FileExt='.png' then Result:=TFPReaderPNG; if FileExt='.tga' then Result:=TFPReaderTarga; if FileExt='.xpm' then Result:=TFPReaderXPM; end; hope it helps ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] lhelp application fails to compile
On Sun, 14 Sep 2008 Lord Satan [EMAIL PROTECTED] wrote: A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? Point taken. Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TShiftstate
Hi Because shift is of type set (not an integer or some other variable type) you cannot test for equality as you would for integer variables with the algebraic = sign. The syntax needed is: if (ssShift in shift) then . Howard - Original Message - From: Alex du Plessis [EMAIL PROTECTED] To: Lazarus mailing list lazarus@lazarus.freepascal.org Sent: Wednesday, August 06, 2008 4:15 PM Subject: [Lazarus] TShiftstate I am trying to check a shift state in an onMouseUp event if shift=ssShift then but when I compile this I get an error E:\DataRoot\Projects\DelphiConversions\Mathparsers\LXExpParser\Source\lxmathstringgrid.pas(132,11) Error: Incompatible types: got TShiftStateEnum expected TShiftState When I look in classesh.inc (where it is defined) there is a strange definition {$packset 1} TShiftState = set of TShiftStateEnum; {$packset default} How do I check my shift state and get around this compiler error? Regards Alex du Plessis ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Using TNotebook
Damien Gerard wrote: Could someone explain me the difference between `TPage.Visible` and `TPage.TabVisible` ? 'Visible' controls the visibility of items within the client area of the page - whatever panels, labels etc you have put there. 'Tabvisible' controls whether the Tab is shown (and therefore whether you can click on it to move pages) or not. Pages without visible tabs are not immensely useful I would say. However, if you need them, you can have them without having to write code to hide the tabs yourself! Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus for education bugfix
Rainer Hamann wrote: Compiling resource lazarus.rc c:\lazarus\fpc\2.2.0\bin\i386-win32\windres.exe: no resources laz4edu.pp(115,1) Error: Error while linking Why? I made the change from protected to public you suggested, and then got this to link (under WinXP) by copying lazarus.rc and lazarus.manifest from the $(LazarusDir)/ide/ subdirectory into the project directory. I also commented out line 83 of laz3edu.pp (setting a path to '~/.laz4edu') which otherwise gave an error under Windows. Howard___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus for education
Rainer Hamann wrote Source of laz4edu : http://www.hamann-kiel.de/laz4edu/laz4edu-ide.zip see README included When I try to build this the compiler stops with can't find unit Unix used by LazConf which puzzles me since I can't find any reference to a unit called Unix in any of the project source files. Can anyone shed any light?___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Contact Database example
Howard Lee Harkness wrote: ... When I load the project file, I get an error about MyDbf.UseFloatFields -- unknown property UseFloatFields. When you get the error dialog you should see three buttons. If you click the 'Stop all loading' button Lazarus will then present you with a 'FixLFMfile' dialog. All you have to do is click the 'Remove all invalid properties' button, and the project will then compile. If you are not presented with the 'FixLFMfile' dialog, just open the mainunit.lfm file (any text editor) and remove the line 'UseFloatFields = true' in the object MyDbf: TDbf definition (it occurs about line 456). HowardPC ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus