Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
on form drag and drop file option
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
Screen abnomally
by
Thaddy
[
Today
at 03:21:30 pm]
XRechnung-for-Delphi now ...
by
sh17
[
Today
at 03:20:09 pm]
A little contribution - T...
by
paxnet_be
[
Today
at 03:16:26 pm]
Line Numbers on MacOS
by
Thaddy
[
Today
at 03:14:19 pm]
FPC Unleashed (inline var...
by
440bx
[
Today
at 02:09:32 pm]
Sudden errors
by
Xenno
[
Today
at 01:15:27 pm]
[SOLVED] TSaveDialog
by
Zvoni
[
Today
at 12:33:33 pm]
Which Control should I us...
by
J-G
[
Today
at 11:57:57 am]
Codepage issue in console...
by
Thaddy
[
Today
at 11:48:25 am]
Questions about 16 color ...
by
jamie
[
Today
at 11:21:01 am]
Pdf Viewer in Pascal
by
Dzandaa
[
Today
at 11:20:08 am]
You can embed Windows Con...
by
Fibonacci
[
Today
at 10:13:32 am]
[New Component] ExtTabCtr...
by
ovidio
[
Today
at 09:50:44 am]
new JPEG XL in pure Pasca...
by
Tomxe
[
Today
at 08:02:53 am]
Conscious Artificial Inte...
by
schuler
[
Today
at 02:42:53 am]
Implementing an Elo ratin...
by
mas steindorff
[
Today
at 02:22:34 am]
Can /my/ AI help me with ...
by
microxa
[
Today
at 12:56:29 am]
IndySecOpenSSL is now ava...
by
TheMouseAUS
[
Today
at 12:08:51 am]
RunFormula: math expressi...
by
stormray
[June 17, 2026, 10:32:05 pm]
Canvas size
by
Thaddy
[June 17, 2026, 07:15:50 pm]
What am I missing here? [...
by
Thaddy
[June 17, 2026, 03:39:02 pm]
TCHATGPT — An Artificial ...
by
Weiss
[June 17, 2026, 07:00:13 am]
RFC: Separation of MCU an...
by
ackarwow
[June 16, 2026, 11:06:14 pm]
Error with last fixes_3.2...
by
patyit
[June 16, 2026, 09:49:02 pm]
Mundo Medieval 3D MMORPG ...
by
Rodrigo Robles
[June 16, 2026, 06:06:17 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: on form drag and drop file option (Read 1208 times)
Packs
Sr. Member
Posts: 496
on form drag and drop file option
«
on:
February 14, 2025, 08:36:29 am »
On form there is drag and drop option it is working properly .
I have one form where on top of form lot of panel and memo component.
it is not working because form event can not raised .
how to achieve this
Logged
cdbc
Hero Member
Posts: 2818
Re: on form drag and drop file option
«
Reply #1 on:
February 14, 2025, 11:17:59 am »
Hi
Forward the event to the components in question...
Regards Benny
Logged
If it ain't broke, don't fix it
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release & FPC Main -> Lazarus Main
Packs
Sr. Member
Posts: 496
Re: on form drag and drop file option
«
Reply #2 on:
February 14, 2025, 11:21:36 am »
Code: Pascal
[Select]
[+]
[-]
procedure
Tfrminward
.
FormDropFiles
(
Sender
:
TObject
;
const
FileNames
:
array
of
string
)
;
begin
if
Length
(
FileNames
)
>
1
then
begin
ShowMessage
(
'Select one file'
)
;
Exit
;
end
;
Opendlg_inward
.
FileName
:
=
FileNames
[
0
]
;
end
;
form FormDropFiles event should run.
it is get protected if you have panel or other components in form.
Logged
cdbc
Hero Member
Posts: 2818
Re: on form drag and drop file option
«
Reply #3 on:
February 14, 2025, 11:41:59 am »
Hi
If your whole form is covered with components, I've found it easiest to just let the /drop/ event-handlers of said components, just point to the same one - namely the one you have for the form...
Regards Benny
Logged
If it ain't broke, don't fix it
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release & FPC Main -> Lazarus Main
Packs
Sr. Member
Posts: 496
Re: on form drag and drop file option
«
Reply #4 on:
February 14, 2025, 11:47:56 am »
in that case I have to write event for all component .
it should be simple user will drag and drop any where , my form dragfile event should trigger .
Logged
cdbc
Hero Member
Posts: 2818
Re: on form drag and drop file option
«
Reply #5 on:
February 14, 2025, 12:06:37 pm »
Hi
No, just point all the components' handlers to the one you have written for the form, they have the same signature. You can do that in the Object Inspector.
Regards Benny
Logged
If it ain't broke, don't fix it
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release & FPC Main -> Lazarus Main
Packs
Sr. Member
Posts: 496
Re: on form drag and drop file option
«
Reply #6 on:
February 14, 2025, 12:09:27 pm »
all component is having different signature .
on formdrag event accept file other all accepting x,y position or string
Logged
cdbc
Hero Member
Posts: 2818
Re: on form drag and drop file option
«
Reply #7 on:
February 14, 2025, 12:31:29 pm »
...Then Google is your friend ...I guess.
eta: At least you need someone more knowledgeable than me, regarding the intricacies of the LCL.
«
Last Edit: February 14, 2025, 12:35:54 pm by cdbc
»
Logged
If it ain't broke, don't fix it
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release & FPC Main -> Lazarus Main
Packs
Sr. Member
Posts: 496
Re: on form drag and drop file option
«
Reply #8 on:
February 14, 2025, 12:46:58 pm »
Ok Sir 👍
Logged
wp
Hero Member
Posts: 13586
Re: on form drag and drop file option
«
Reply #9 on:
March 21, 2025, 07:19:24 pm »
See
https://forum.lazarus.freepascal.org/index.php/topic,70589.msg550415.html#msg550415
for a workaround based on embedded forms.
Logged
Remy Lebeau
Hero Member
Posts: 1596
Re: on form drag and drop file option
«
Reply #10 on:
March 21, 2025, 07:32:14 pm »
UI controls don't have events for dropping files on them. The
OnDragDrop
and similar events are meant for drag&dropping
other UI controls
onto each other. If you want to accept a file drop onto a child UI control of a Form, then you have to manually register the drag&drop handler yourself. For instance, on Windows, using either
DragAcceptFiles()
or
RegisterDragDrop()
, and then handling the relevant callback.
Logged
Remy Lebeau
Lebeau Software
- Owner, Developer
Internet Direct (Indy)
- Admin, Developer (
Support forum
)
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
on form drag and drop file option
TinyPortal
© 2005-2018