Hello,
I am a member of a church organization for peoples with
some problems.
My hobby is it, to programming applications for computers.
I master me self in Delphi (beginning with Turbo Pascal 6/7,
GNU C/C++, and finally C++ Builder 1..6 (32-Bit).
I am able to download the Community Versions of Emberracdo
Delphi, and C++ Builder in both (32, and 64-Bit for Windows).
But I have to deal with C, and Pascal code twice.
But, I can only install Delphi, or C++ Builder.
But not the same RAD Tools together - and after a year, I have
to re-new the license, and re-install all Tools again.
This implicit the installing all the RAD Tools (Components)
that I had install before I use them.
And this is a nogo.
So, I back to days, as BORLAND came with his good 32-Bit Tools
of Delphi, and C++ Builder.
My first problem, in the past few days was, that I had a problem
to "parent window" a TSplitter (a component which can be used to
move parts of GUI components vertical, or horizontal on a desktop
window form (TForm), to make more visibility of the components on
the given/underlaying TSplitter componentes.
This problem was done by me, by experiment hours of wasteing time
and stressed lost of hair.
Okay, ...
Now, I have a problem, to "set" the Event Handler of a BORLAND
C++ Builder component (TSpeedButton) - a TSpeedButton is like a
normal Windows Desktop Application Button, except, it would be
*not* appear in the tabular order of selectable items of the
applications "tabable" components (ListBox, ComboBox, Button, ...)
I said: I have to deal with Pascal, and C Code ... :
I created a .DLL project under C++ Builder 6.0, compile it, and
place it in the directory of my application .exe binary.
As code/to comunicate with the C+++ .dll code, I export functions
from the .dll library, and import it in Delphi.
All code goes done.
Till, I would create a OnClick event on a TButton/TSpeedButton.
It seems, that I must have a class that decents from a TControl,
so, the VCL manager knows, which VMT (virtual method table)
proceure, or function can be called within this (TObject) class.
I have to use: extern "C" void foo(void) { /* ... */ }
because C++ mangles functions members in C++ and fit it in space
of the VMT's of it handled TClass.
So, I can not directly call mangled C++ functions in Delphi by
simply "import" them - this came to a caos of the differnt memory
system's between Delphi, and C++ Builder.
That's why, I use pointer between Delphi, and C++ Builder.
Okay, ...
Now, the question is: is it possible, to set a event handler on
the OnClick event of a TButton object without having implicit a
TObject inherited class ?
If the answer YES, then: How can this be done in C++ Builder ?
Under Delphi, I just assign it like:
....
btn := TButton.Create(AOwner);
btn.Parent := AOwner;
btn.OnClick := btnOnClick;
....
In C++ Builder 6.0, i try the similar same procedure, but I fail
with the code:
extern "C"
__declspec(dllexport) void
__stdcall foo(int owner)
{
....
TForm *form = new TForm((HWND)owner);
....
TButton *btn = new TButton(form);
btn->Parent = form;
btn->OnClick = btnOnClick; // <-- this fails
....
}
To make more sense in this posting, I can point You to my
StackOverflow/RetroComputing article with the followin URL:
https://retrocomputing.stackexchange.com/questions/25400/how-to-embeed-c-builder-6-32-bit-tframe-into-a-delphi-7-32-bit-application
This has not directly to do with my (second) part/question about
the described problem in this post.
But it depends on in future step's.
Thanks for reading, and helping hand.
Jens