freepascal

What is wrong with my if-statement?

 ̄綄美尐妖づ 提交于 2019-12-17 14:49:26
问题 I am now trying to explore pascal. And I ran into some compiler errors. I wrote a if else if statement like this: if ((input = 'y') or (input = 'Y')) then begin writeln ('blah blah'); end; else if ((input = 'n') or (input = 'N')) then begin writeln ('blah'); end; else begin writeln ('Input invalid!'); end; And it gives me an error at the first else : ";" expected but "ELSE" found I looked for a lot of tutorials about if statements and they just do it like me: if(boolean_expression 1)then S1 (

Screen recorder [closed]

喜欢而已 提交于 2019-12-17 02:24:18
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 26 days ago . I'm interested in a library(for windows) written in Delphi/Pascal or C++ that allows me to record(to a video format) desktop screen, requirements: must be able to specify the frame rate, or at least be able to record @ 5fps; must be open source or free; the output format could be almost any, but the quality must

Lazarus Free Pascal / Delphi - RunError 211

百般思念 提交于 2019-12-13 18:29:43
问题 I'm trying to connect my Windows XP program (Lazarus) to my Ubuntu postgres server. When the Lazarus program runs, it seems to compile fine but I get this error: Project ... raised exception class 'RunError(211)'. Then it terminates execution (and I don't see any output), and opens up a file customform.inc . In that file, it shows a procedure procedure TCustomForm.DoCreate; where it highlights a line: if Assigned(FOnCreate) then FOnCreate(Self); I believe this is one of the system's files. I

TIdHTTP in Indy 10

耗尽温柔 提交于 2019-12-13 16:34:46
问题 I used to use Indy back in the Delphi 6 days, and I am playing with Indy 10 now. What I want to do is incredibly simple, but I don't see a simple way of doing it, so I must be missing something. What I want to do is something like this: Here is the actual code I am using: procedure TForm1.btnGetURLClick(Sender: TObject); begin moHeader.Lines.Clear; moBody.Lines.Clear; try moBody.text := IdHttp1.Get(edURL.text); finally end; end; When the request is complete, the http_result should contain the

Uncaught translation error: com.android.dx.cf.code.SimException: local 0002: invalid

妖精的绣舞 提交于 2019-12-13 15:39:03
问题 I am trying to install an FPC program on to android device by following this article. While creating .dex file by giving the input as .jar ( classes.jar ) file, it is giving the following error. MacBookPro:src Sreehari$ /Library/android-sdk-macosx/build-tools/23.0.2/dx --dex --output=bin/classes1.dex eu/blaisepascal/skeletonapp/skeltonapp.jar Uncaught translation error: com.android.dx.cf.code.SimException: local 0002: invalid 1 error; aborting I have seen on internet that it is because of not

Reading from file FreePascal

这一生的挚爱 提交于 2019-12-13 02:31:06
问题 So I have text file containing: Harry Potter and the Deathly Hallows###J. K. Rowling###2007 And I have to output it to the FreePascal program in the following form J.K.Rowling "Harry Potter and the Deathly Hallows" 2007 year I know how to read from file but I don't know how to make it like in the previos form Can someone help me? I would be very thankful. 回答1: If TStringList in freepascal is the same as in Delphi, then this would do the trick: function SortedString( const aString : String) :

Abstract function in Pascal

限于喜欢 提交于 2019-12-13 00:31:29
问题 I have been working on AVL-tree unit where user can specify what he wants to have inside of the tree. I'm using objects for this purpose. In my unit I defined parent Object called Node and pointer to this object is PTNode. In this object I have 3 attributes which are Balance:integer;Left,Right:PTNode for sons of the node, and 1 method:Function Is_Greater(Node1:PTNode):integer which is virtual and abstract. And it is left up to user to define this function(I don't know whether it will be char

Setting size of hint window (THintWindow) in Delphi/Lazarus

人走茶凉 提交于 2019-12-12 17:06:45
问题 I am trying to make a custom hint in Lazarus. So far I have dynamically loaded the text in the hint, and customized the font face, font size, and font color. I would like to limit the width of the hint window. Any ideas? Here is my code. type TExHint = class(THintWindow) constructor Create(AOwner: TComponent); override; ... constructor TExHint.Create(AOwner: TComponent); begin inherited Create(AOwner); with Canvas.Font do begin Name := 'Hanuman'; Size := Size + 3; end; //Canvas.Width := ; end

How do I use CreateFile to access a physical disk?

冷暖自知 提交于 2019-12-12 11:26:51
问题 I asked on the Lazarus programming forum how to open a physical disk. I want to allow the user to select physical disks from their system when they click a "Select Disk" button. There are some examples here at Stack Overflow that are similar but not quite the same (such as Delphi - Using DeviceIoControl passing IOCTL_DISK_GET_LENGTH_INFO to get flash media physical size (Not Partition)). There are lots of C and C++ examples of using CreateFile (in the documentation and especially an example

Object Pascal: Must all objects (classes) be freed?

房东的猫 提交于 2019-12-12 03:57:29
问题 Can I throw around class es without freeing them, or will my software start spouting leaks? For example can I do this Engine := TEngine.Create(TV); Then get rid of the reference without any problems, or must I call its Free method first? Or have a function that returns a TSomething and not having to free its reference later on? 回答1: The general rule is that if you create it, you should free it. The best way is in a try..finally if you're creating it in code: var Engine: TEngine; begin Engine