lazarus

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

Is it possible to change the colour of TTabSheet tabs

断了今生、忘了曾经 提交于 2019-12-12 11:30:55
问题 I am running Lazarus 0.9.30.2. I have a TForm on which there is a TPageControl. Within the TPageControl there is a series of TTabSheets (about 30 of them). What I want to do is colour code the tabs, so the first 10 are Red, next 10 are Blue and the last 10 are Green. I have seen code snippets on the intranet that change the tab sheet colour (including the tab itself) when you click on them and navigate to them (to highlight the active tab), but what I want to do is colour them as described

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

Errors when using Lazarus IDE on OS X

痴心易碎 提交于 2019-12-12 04:04:06
问题 I'm trying to use Lazarus for OS X to complete a PASCAL programming assignment, and for some reason, I keep getting the following debugger error. Debugger Error Ooops, the debugger entered the error state. Save your work now! Hit Stop, and hope the best, we're pulling the plug. Even though it tells me "Project successfully built :)" after compiling, it will always give me that debugger error. When I rescan the FPC source directory, I get another error as well, even though I installed the FPC

How to avoid violating the DRY principle when the boolean expression of a while loop is reassigned every loop pass?

喜欢而已 提交于 2019-12-12 03:49:34
问题 Both while MyFunction(1, 2, 3) > 0 do begin Temp := MyFunction(1, 2, 3); ShowMessage(IntToStr(Temp)); end; and Temp := MyFunction(1, 2, 3); while Temp > 0 do begin ShowMessage(IntToStr(Temp)); Temp := MyFunction(1, 2, 3); end; violate the DRY principle because there are two calls to MyFunction when only one is necessary. 回答1: Easy, function dotemp(a,b,c:integer;var value : integer):boolean; begin value:a*b+c; result:=value>0; end; begin while dotemp(a,b,c,temp) do begin Operateontemp(temp);

Lazarus using Indy + OpenSSL on OS X results in EIdOSSLCouldNotLoadSSLLibrary

ⅰ亾dé卋堺 提交于 2019-12-12 03:28:36
问题 I am currently using: OS X Yosemite 10.10.5 newest Indy (10.6.2.0, download 2016 March 13 - Indy10_5346.zip) Lazarus 1.4.4 newest openssl OpenSSL is more specificly: openssl-1.0.2g accordingly to home brew cmd line interface placed in /usr/local/Cellar/openssl/1.0.2/lib/ lib files in above directory are: libcrypto.10.dylib, libcrypto.1.0.0.dylib, libcrypto.dylib, libcrypto.a, libssl.1.0.0.dylib, libssl.dylib, libssl.a ... I am passing above pah to Indy using idOpenSSLSetLibPath() befoe using

How can I increase the size of the console inside the code

橙三吉。 提交于 2019-12-12 01:25:34
问题 I'm doing some code in pascal using lazarus IDE v1.8.4, as the question says I need to be able to edit the console size in the code, I also preferably need to get the max possible console width they can have. If you do know how please also let me know the uses you.. used. Thanks! 回答1: Assuming you're targeting Windows: Use GetLargestConsoleWindowSize to retrieve the largest possible console size depending on the console font and display settings, Use SetConsoleScreenBufferSize to set the

Base converter binary to octal

狂风中的少年 提交于 2019-12-12 00:47:16
问题 I'm writing a base converter because I have a test soon and I need to convert a binary number in 3 different bases: octal, decimal and hexadecimal. I've already written the code that convert a binary string into decimal and hexadecimal. function bintodec(Value:string;dec:TEdit;hexadec:TEdit): Integer; var //dec and hexadec are the TEdits where I will put the result i, iValueSize: Integer; Edit2,f:TEdit; begin Result := 0; iValueSize := Length(Value); for i := iValueSize downto 1 do begin if

Faulty fonts on Lazarus

删除回忆录丶 提交于 2019-12-11 22:02:12
问题 I've recently installed FPC 2.2.2 and Lazarus 0.9.6 on my Acer Aspire One, so I can cross-compile some apps and to my dismay, the fonts for the menus all are little squares. Has anyone had a similar problem with Lazarus on a Fedora Core instalation that could give me some advice? 回答1: This answer might help even though its for Fedora Core 8 rather than 10. I've stuck with Linpus and had to do the same for Lazarus to get the fonts displaying ok. 回答2: Recompiled with "make LCL_PLATFORM=gtk2"

IdNotify : How to pass parameteres to function

扶醉桌前 提交于 2019-12-11 13:53:35
问题 I have code typhoon with lazarus installed after a long strugle I have managed to include the unit IdSync to my project. How can I pass parameteres to a function that I want to execute in the main thread from TIdNotify ? 回答1: You have to override the TIdNotify.DoNotify() method, then you can pass whatever parameters you want, eg: type TMyNotify = class(TIdNotify) protected procedure DoNotify; override; end; procedure TMyNotify.DoNotify; begin SomeFunction(parameters); end; . begin ...