Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
LCL
»
[SOLVED] Windows only issue, invicible border
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
ThorVG - test (lightweigh...
by
Boleeman
[
Today
at 11:28:52 am]
Fpcupdeluxe
by
tk
[
Today
at 11:27:55 am]
Status of FPC 3.4.0 or FP...
by
marcov
[
Today
at 10:41:52 am]
Lazarus recompiles some o...
by
Hartmut
[
Today
at 09:26:21 am]
Strange Error in My Code ...
by
TYDQ
[
Today
at 09:18:58 am]
External SIGSEV (Database...
by
Zvoni
[
Today
at 08:26:34 am]
[ANN] fpGUI Toolkit v2.0....
by
CM630
[
Today
at 08:02:35 am]
Debian removes FPC/Lazaru...
by
dbannon
[
Today
at 01:08:23 am]
[SOLVED] TaChart on MAC: ...
by
wp
[
Today
at 12:16:09 am]
Fast Canvas Library V1.05...
by
backprop
[February 10, 2026, 11:38:53 pm]
fpGUI vs MSEide + MSEgui?
by
Graeme
[February 10, 2026, 10:23:25 pm]
Is FPGUI still active?
by
Graeme
[February 10, 2026, 10:20:16 pm]
TRichMemo EM_FORMATRANGE ...
by
rvk
[February 10, 2026, 09:31:40 pm]
TLazSerial : serial port ...
by
CM630
[February 10, 2026, 09:14:56 pm]
it2play - IT/S3M module r...
by
Lulu
[February 10, 2026, 09:11:05 pm]
The Future of FPC
by
Ten_Mile_Hike
[February 10, 2026, 07:38:23 pm]
Fixing Lazarus 4.4 IDE la...
by
Curt Carpenter
[February 10, 2026, 06:47:29 pm]
Z80 ZX Spectrum and Syste...
by
Cascade
[February 10, 2026, 03:30:13 pm]
Where is Lazarus config
by
Martin_fr
[February 10, 2026, 12:10:36 pm]
Anchordocking - window pr...
by
Zvoni
[February 10, 2026, 10:41:04 am]
How to determine the unkn...
by
Hartmut
[February 10, 2026, 09:56:10 am]
Anchordocking - Window T...
by
janhsh
[February 10, 2026, 09:33:09 am]
Free Pascal for a small e...
by
dbannon
[February 10, 2026, 09:20:55 am]
Problem with Generic Cons...
by
SonnyBoyXXl
[February 10, 2026, 07:59:15 am]
[SHARE] Rotate and Flip b...
by
Xenno
[February 10, 2026, 07:37:56 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED] Windows only issue, invicible border (Read 472 times)
Handoko
Hero Member
Posts: 5515
My goal: build my own game engine using Lazarus
[SOLVED] Windows only issue, invicible border
«
on:
February 28, 2025, 01:56:28 pm »
Today I am writing a small Windows tool on a Windows 11 laptop.
Try this code on your Windows computer:
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
Button1Click
(
Sender
:
TObject
)
;
begin
Left
:
=
0
;
Top
:
=
0
;
end
;
I am a Linux user, I am not sure but I believe this behavior only happens on Windows 8 and above. After running the code above and clicking the button, the form won't move to the exact top left corner we expected. Here is an old discussion related with this issue:
https://forum.lazarus.freepascal.org/index.php/topic,65298.msg497415.html#msg497415
Does anybody know how to make the code above to work correctly on WinXP to Windows 11? Or how to detect the thickness of the invincible border?
«
Last Edit: March 01, 2025, 08:03:13 am by Handoko
»
Logged
BrunoK
Hero Member
Posts: 766
Retired programmer
Re: Windows only issue, invicible border
«
Reply #1 on:
February 28, 2025, 04:02:59 pm »
Try this :
Code: Pascal
[Select]
[+]
[-]
unit
Unit1
;
{$mode objfpc}{$H+}
interface
uses
Classes
,
SysUtils
,
Forms
,
Controls
,
Graphics
,
Dialogs
,
StdCtrls
{$IFDEF WINDOWS}
,
Windows
{$ENDIF WINDOWS}
;
type
{ TForm1 }
TForm1
=
class
(
TForm
)
Button1
:
TButton
;
procedure
Button1Click
(
Sender
:
TObject
)
;
private
FFormXOffset
:
integer
;
public
end
;
var
Form1
:
TForm1
;
implementation
{$R *.lfm}
{ TForm1 }
procedure
TForm1
.
Button1Click
(
Sender
:
TObject
)
;
var
lPoint
:
TPoint
;
begin
{$IFDEF WINDOWS}
lPoint
.
SetLocation
(
0
,
0
)
;
// Init lPoint to TopLeft of form
lPoint
:
=
ClientToScreen
(
lPoint
)
;
// Retrieve screen coord of form
FFormXOffset
:
=
Left
-
lPoint
.
X
;
// Compute offset relative to declared left.
{$ENDIF WINDOWS}
Left
:
=
FFormXOffset
+
{ Desired real left }
0
;
// Apply offset to desired position
Top
:
=
0
;
end
;
end
.
Logged
Handoko
Hero Member
Posts: 5515
My goal: build my own game engine using Lazarus
Re: Windows only issue, invicible border
«
Reply #2 on:
March 01, 2025, 08:01:39 am »
Yes, it work. Thank you very much. The code may look simple but very helpful. I learned something new today.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
LCL
»
[SOLVED] Windows only issue, invicible border
TinyPortal
© 2005-2018