Questions tagged [tobject]
19 questions
18
votes
3 answers
Delphi array initialization
I currently have this, and it sucks:
type TpointArray = array [0..3] of Tpoint;
class function rotationTable.offsets(pType, rotState, dir: integer): TpointArray;
begin
Result[0] := point(1, 1);
Result[1] := point(1, 2);
Result[2] := point(1,…

Alex O
- 181
- 1
- 1
- 3
11
votes
1 answer
Why do TObject.AfterConstruction and BeforeConstruction have public visibility?
Today, one very simple question came to my mind when I had to override TObject's BeforeConstruction method:
Why do TObject methods AfterConstruction and BeforeConstruction have public visibility?
I expected them to be protected.
What is the reason…

René Hoffmann
- 2,766
- 2
- 20
- 43
10
votes
5 answers
Passing a generic class to a form
I can't seem to find out the answer to this through searching, so here goes....
I know that I can pass Class objects generically to other classes by utilising this type of code:
public class ClsGeneric where TObject : class
{
public…

Davy C
- 639
- 5
- 16
9
votes
3 answers
What data does a TObject contain?
TObject.InstanceSize returns 8, yet TObject doesn't declare any data members. According to the implementation of TObject.ClassType, the first 4 bytes can be explained as a pointer to the object's TClass metadata. Anyone know what the other 4 bytes…

Mason Wheeler
- 82,511
- 50
- 270
- 477
5
votes
3 answers
Invalid typecast: convert record to tobject on 64-bit platform
it works on 32-bit platform.but not 64-bit
here is the exzample
TVerbInfo = packed record
Verb: Smallint;
Flags: Word;
end;
var
VerbInfo: TVerbInfo;
strList : TStringList;
verb : Smallint;
flags : Word;
begin
strList :=…

taoxl
- 125
- 1
- 1
- 5
5
votes
5 answers
cast TObject using his ClassType?
how can i make my code to work ? :) i`ve tried to formulate this question but after several failed attempts i think you guys will spot the problem faster looking at the code than reading my 'explanations'. thank you.
setCtrlState([ memo1, edit1,…

Alin Sfetcu
- 542
- 6
- 16
3
votes
4 answers
Delphi: Pass TObject in array of Variants
I have a procedure that expects a parameter of type TObject, something like this:
MyProcedure (const AValue : TObject);
I have an array of Variant that I'm looping through to call the procedure, something like this:
for i:=0 to High(myArray) do
…

ObiWanKenobi
- 14,526
- 11
- 45
- 51
2
votes
2 answers
Delphi Livebinding object and combobox or radio buttons
I defined the subsequent unit for business logic
unit Models.Person;
interface
Type
TPersonGender = (pgUndefined, pgMale, pgFemale, pgNotApplicable);
TSexOfPerson = class(TPersistent)
private
FGender : TPersonGender;
protected
…
2
votes
1 answer
Threadlist of TObject with Delphi - How to populate?
From my limited knowledge about this subject, the following code should work. But I have not the expected result:
type
TClient = class(TObject)
Host: String;
end;
var
Clients: TThreadList;
const
Hosts: Array[0..5] of String = ('HOST1',…

Guybrush
- 1,575
- 2
- 27
- 51
2
votes
0 answers
Disappearing SubDetail TObjectList when JSonToObject
this is my first question. Sorry my english.
I have a classes like this:
TSFis_S = class(TPersistent)
private
_SFis_MID : Integer;
public
property SFis_MID : Integer read _SFis_MID write _SFis_MID;
end;
TSFis_D = class(TPersistent)
private
…

Ercument Eskar
- 132
- 3
- 15
1
vote
2 answers
Delphi calling a virtual constructor based on the TObject type
I have an object that is derived from the TStringList object that I call a "TAutoString." It allows you to specify an object type when the list is created. Then each time a new entry is added to the string list, it also creates a copy of the object…

Larry
- 13
- 4
1
vote
1 answer
Problem with OnClick event signature in C++Builder
I would like to create a function which replaces the current image with another one. The problem is that I have 64 pictures to replace. I created a function with a TImage* Sender parameter but it works only when I set Sender as TObject* instead.
How…

donefun
- 51
- 5
1
vote
2 answers
Variant record instead of overloaded object type?
I'm working on a problem in which I need to dynamically size an array, upon which numerous operations are needed. I have successfully coded two classes, t_one and t_two:
tarray1 : array of longint;
tarray2 : array of single;
t_one = class(tobject)
…

user3670958
- 29
- 6
1
vote
1 answer
Inno Setup get TObject type/class in event handler
I have an event procedure that checks the OnKeyUp key press for two objects/controls (TNewEdit and TNewComboBox). Both objects need to be completed before a TNewButton gets enabled.
However, I cannot find a way to know how to get the type of the…

Nicolas Epaminonda
- 181
- 1
- 3
- 13
1
vote
1 answer
Delphi FireMonkey TListBox AddObject exception on Android
I'm having a problem adding a TObject value to a FireMonkey TListBox in Delphi 10.0 Seattle.
An exeception is raised when casting an Integer variable to a TObject pointer.
I tried the cast to TFmxObject with no success. On Windows, the cast works…

Eder
- 11
- 2