tform | Transform JSON records | JSON Processing library
kandi X-RAY | tform Summary
kandi X-RAY | tform Summary
Define an interface for your JSON input. Define rules for transformation (or de-serialize rules as described later on). Create a Tform instance. Use the instance to transform records.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of tform
tform Key Features
tform Examples and Code Snippets
Community Discussions
Trending Discussions on tform
QUESTION
I make the code by using Delphi.
When I press the button, it create a new MDI child form.
So, the program has multiple MDI child form, and I want to access the component(for example, timer) of each child form in the MainForm.
MainForm is fsMDIForm, and ChildForm is fsMDIChild.
Here is the code I tried. But it doesn't work because TChildForm and TForm is not compatible.
...ANSWER
Answered 2021-May-21 at 09:28You need to use a cast like this:
QUESTION
After setting ListView in virtual mode ListView1.Selected.Top always returns 0. I'm using that property on double click on list view to show edit box at that position.
How can I resolve this?
Example of .pas and .dfm files are here. I want to open edit box on position where it is double clicked.
...ANSWER
Answered 2021-May-19 at 09:36I can reproduce your problem. I found a workaround: use the display rectangle of the selected item:
QUESTION
I need to call batch script from Delphi. I'm using TDosCommand because I want to show echo messages from batch before external process finishes. How to wait in procedure until script finishes?
Here is simple demo example. I'm calling Test.bat on click. Pause is only for testing purpose.
Test.bat.
...ANSWER
Answered 2021-May-18 at 14:29Looking at TDosCommand source code, you have 3 ways to know if the started process is running: use property ExitCode
, or property EndStatus
, or event OnTerminated
.
Using OnTerminated
event would avoid building a wait loop, which is usually not a good idea.
QUESTION
Update:
Indeed, the issue was fixed since 10.2.
I compared the FMX.Platform.Win
from 10.4, the fix is in the function TWinDropTarget.GetDataObject: TDragObject;
I've implemented the answer for
Drag and drop with TTreeView in Firemonkey to drag&drop TTreeViewItem
s in a Delphi 10.2 FMX Windows application.
Everything is working perfectly within the same app, however when the user suddenly drops an item to another copy of the same app, it hangs or even shuts down with c0000374 external error
.
When trying to debug in the IDE, the source app stops with this system call stack:
I don't actually need the ability to drag between applications (although, it would be perfect). I'm just asking, how to avoid such errors?
According to the comment below, I've added a minimal example. Create a Win32 FMX app and add a TLabel
to it:
ANSWER
Answered 2021-May-17 at 19:39There is a bug in Delphi 10.2 which has been fixed in Delphi 10.4.2. All you have to do is to update to the latest Delphi version.
QUESTION
I'm using Delphi XE7 on Windows 10.
I have been using the following code for a long time, and just read the documentation on SetTimer()
. To state it simply, I am setting timers from non-UI threads, but Microsoft's documentation says they should only be set on the UI thread. Extensive tests show my code works fine, but I can't trust my system to behave the same as other systems, or the Microsoft documentation to be 100% accurate. Can anyone verify whether this code is OK or not OK?
The Delphi code will not deadlock, it pretty much just calls SetTimer()
(I am aware there is a race condition setting TTimer.FEnabled
).
The MSDN documentation says:
hWnd
Type: HWND
A handle to the window to be associated with the timer. This window must be owned by the calling thread.
What I'm trying to accomplish is worker threads doing stuff, and when appropriate, they notify the main thread that elements of the UI must be updated, and the main thread updates the UI. I know how to use TThread.Synchronize()
, but deadlocks can happen in certain cases. I can use PostMessage()
from my worker threads and handle the message in the UI thread.
Is there any other way in Delphi to notify and update the UI thread?
...ANSWER
Answered 2021-May-07 at 17:01The TTimer
is being constructed in the main UI thread, when the TForm
streams in its DFM resource. The TTimer
's constructor creates an internal HWND
for the timer to receive WM_TIMER
messages with. That HWND
is thus owned by the main UI thread.
TForm.Notify()
is setting the timer's Enabled
property to true
, which will call SetTimer()
. Notify()
is being called in the context of the worker thread, not the main UI thread. This SHOULD NOT work, as stated in SetTimer()
's documentation. Only the main UI thread should be able to start the timer running, since the main UI thread owns the timer's HWND
.
TTimer.UpdateTimer()
, which is called internally by the setters of the timer's Enabled
, Interval
and OnTimer
properties, will raise an EOutOfResources
exception if SetTimer()
fails. So, calling form1.Notify()
in TypeThreadTest.Execute()
SHOULD NOT work. The only way SetTimer()
would not be called in that situation is if either:
Interval
is 0Enabled
isfalse
OnTimer
is unassigned
Otherwise, your worker thread SHOULD be crashing.
As you have noted, your worker thread can alternatively use TThread.Synchronize()
(or TThread.Queue()
), or PostMessage()
(or SendMessage()
), when it wants to notify the main UI thread to do something. These are viable and preferred solutions. Personally, I would opt for TThread.Queue()
, eg:
QUESTION
I would like to have my stack trace contain unit names / methods / lines. Anything that can help really to make it more readable. I know this has worked in the past, but it has stopped working...
I have enabled
...ANSWER
Answered 2021-May-07 at 14:19Somehow your project is corrupted.
Recreate the project from scratch (dpr and dproj, add all pas files and code you manually added to your dpr) and make sure the options are as described in How to get a stack trace from FastMM
QUESTION
I want to implement an interface, but I cannot declare it from TInterfacedObject
, and in this case the documentation says that I must implement QueryInterface
, _AddRef
, _Release
. But I am not sure if this is mandatory. I haven't really worked with interfaces so far... They say something about COM objects, but I don't even know what that means. I never intentionally used COM objects, maybe only if they are included in some pieces of code which I took from the internet. I tried an example (see below) and it's working without implementing those 3 methods. So...
- How should I know if I must implemet them ?
- If I must implement them, how can I do it ? I don't know nothing about those methods should do. Should I copy the implementation from
TInterfacedObject
? (In fact, it has more than 3... those extra ones must be copied too ?)
Thanks !
...ANSWER
Answered 2021-May-07 at 13:21Any class that supports interfaces must implement all three methods:
QUESTION
I try to change the field name of FDMemTable1field1 which is 'field1' to 'field3'. There is no code and all is done in design-time.
...ANSWER
Answered 2021-May-06 at 18:42I think that a problem with what you want is that afaik you can't rename a field in an FDMemTable while it has data stored in it, because the field name is amongst the metadata stored in the saved data.
That said, here's a minimal example of renaming an FDMemTable field without having to discard the data stored in it. Basically, it writes the table's data out in XML format, changes the field name (in this case 'FieldA') to something different ('FieldB') and reloads the data from the changed XML file.
QUESTION
I have to prepare an individual unit to communicate with another system by TCP/IP.
I created two units: Unit1
with a TForm
, and Unit2
with communications.
Unit1:
...ANSWER
Answered 2021-May-06 at 18:20You should have TCommunication
expose its own events that the TForm
can assign event handlers to. Just as TCommunication
is assigning handlers to TClientSocket
's events. For example:
Unit1:
QUESTION
I updated my code and looked over it. The problem is when I try to generate NextButton4 and NextButton3 with procedure TForm2.Next1Click(Sender:TObject) in AForm(which is my Form that is created by TForm2.Button1Click) it won`t work like i can not see NextButton4 and NextButton3 in AForm. Delphi tells me that it is possible that AForm could not be intialized in line 117 (which says NextButton3 := TButton.Create(AForm);) but i do not know how to fix it. Sorry that I did not explain it very well. (the clickable component for TForm2.Next1Click(Sender:TObject); is NextButton1). My aim is to create a working ToDoList. For that I need a Mainform where Button1 is located. Button1 when clicked now creates lists/folders (AButton) on the Mainform(Form2) and a new form(AForm) where is now located NextButton1 and NextButton2. Now I want to store memories, task,... in AForm thats why i need two more Buttons (NextButton3 and NextButton4). NextButton2 should just close the form (AForm). And NextButton1 should, if clicked, create 2 Buttons (NextButton3 and NextButton4) and another form(NextForm). At the End I want to add one panel in AForm to store memories and tasks(did not add the panel yet). NextButton4 should open NextForm. In NextForm you can edit the Panel i did not create yet (f.e. change colour or name of the memory/task). The Problem with this is that NextButton3 and NextButton4 is created(I think) but i can not see it. Hope you can understand what I wrote.
...ANSWER
Answered 2021-Apr-26 at 07:01At the end of TForm2.Next1Click
you'll need to add:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install tform
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page