Recent

Author Topic: Delphi7, and BCB6 TSplitter - set parent window  (Read 732 times)

paule32

  • Full Member
  • ***
  • Posts: 199
Delphi7, and BCB6 TSplitter - set parent window
« on: October 17, 2022, 09:10:04 am »
Hello,
I hope the question request is not wrong there, but I can not find a right Forum anymore as BORLAND goes down.
In C++ Builder 6 (32-Bit), I created a Package, that includes a TFrame.
This TFrame, I can use/place into Delphi7 (32-Bit, too) Application without problems.
Except TSplitter's.
When I add TSplitter into the TFrame (C++), and Compile the Delphi RunTime, I get Exception Message, that the
Splitter1 has no parent window.
So the question is:
How can I fix this problem ?

Here are some Code snippet artefacts:

C++ Builder:

Code: C  [Select][+][-]
  1. //---------------------------------------------------------------------------
  2. #pragma package(smart_init)
  3. #pragma resource "*.dfm"
  4. TBCB6_Frame *BCB6_Frame;
  5.  
  6. static int pos_left;
  7. static int pos_width;
  8. static int pos_height;
  9. static int pos_top;
  10.  
  11. static TBCB6_Frame *my_parent = NULL;
  12. //---------------------------------------------------------------------------
  13. __fastcall TBCB6_Frame::TBCB6_Frame(TComponent* Owner)
  14.         : TFrame(Owner)
  15. {
  16.   Width  = pos_width;
  17.   Height = pos_height;
  18.   Top    = pos_top;
  19.   Left   = pos_left;
  20.  
  21.   Panel1   ->Parent = this;
  22.   Panel2   ->Parent = Panel1;
  23.  
  24. }
  25. //---------------------------------------------------------------------------
  26. extern "C"
  27. __declspec(dllexport) TCustomFrameClass
  28. __stdcall getMyCppFrameClass(TScrollBox *hwndParent, int X, int Y, int W, int H)
  29. {
  30.   pos_width  = W;
  31.   pos_height = H;
  32.   pos_left   = X;
  33.   pos_top    = Y;
  34.  
  35.   BCB6_Frame = new TBCB6_Frame(hwndParent);
  36.   BCB6_Frame->Parent = hwndParent;
  37.   BCB6_Frame->Align  = alClient;
  38.  
  39.   my_parent = BCB6_Frame;
  40.  
  41.   return __classid(TBCB6_Frame);
  42. }


Delphi7:

Code: Pascal  [Select][+][-]
  1. type
  2.   TFrameClassFunc =  function(scr: TScrollBox; x,y,w,h:Integer): TCustomFrameClass; stdcall;
  3.  
  4. var
  5.   CppModule: HMODULE = 0;
  6.   FrameClassFunc : TFrameClassFunc;
  7.   FFrame: TCustomFrame;
  8.  
  9.   // debug
  10.   if CppModule = 0 then
  11.   begin
  12.     CppModule := LoadPackage('dbgFrame.bpl');
  13.     if CppModule < 1 then
  14.     begin
  15.       ShowMessage('can''t load: dbgFrame.bpl');
  16.       exit;
  17.     end;
  18.   end;
  19.  
  20.   FrameClassFunc := TFrameClassFunc(
  21.   GetProcAddress(CppModule, 'getMyCppFrameClass'));
  22.  
  23.   if not Assigned(FrameClassFunc) then
  24.   raise Exception.Create(
  25.   'can not find export symbol:  ' +
  26.   'getMyCppFrameClass() in:'      + #13#10 +
  27.   'dbgFrame.bpl');
  28.  
  29.   FFrame := FrameClassFunc(
  30.     ScrollBox29, 0,0,
  31.     ScrollBox29.Width  + 200 ,
  32.     ScrollBox29.Height + 200).CreateParented(Form2.Handle);
  33.   FFrame.Parent := ScrollBox29;
  34.  

Für Alle Hinweise dankend:
paule32

MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
Re: Delphi7, and BCB6 TSplitter - set parent window
« Reply #1 on: October 17, 2022, 10:36:39 am »
Sorry, not our problem.

This forum exists to support the FPC compiler and the Lazarus IDE, and its only interest in Borland products is in retaining compatibility in certain modes.

MarkMLl

p.s. It particularly doesn't exist to support C++, and while we might, out of interest, suggest that you recompile your Delphi code using Lazarus/FPC we can't recommend any compatible C++-based environment.
« Last Edit: October 17, 2022, 10:38:53 am by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018