Watch, Follow, &
Connect with Us
Public Report
Report From:    [ Add a report in this area ]  
Report #:  9291   Status: Reported
Event "Include" method name collision when using Managed DirectX
Project:   Build #:  7.1.1523.17956
Version:    1.0 Submitted By:   Christopher McGinnis
Report Type:  Basic functionality failure Date Reported:  10/9/2004 1:18:46 PM
Severity:    Commonly encountered problem Last Updated: 10/17/2004 2:44:56 AM
Platform:    All versions Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (2 Total Ratings)
5.00 out of 5
Total Votes: 5
Description
The Managed DirectX assembly Microsoft.DirectX.Direct3DX.dll contains a class called INCLUDE which is loaded into the Microsoft.DirectX.Direct3D namespace.

The issue arises when want to add an event to a control such as as BUTTON.  

Example:
"Include(Self.Button1.Click, Self.Button1_Click);"

Delphi attempts to use the Microsoft.DirectX.Direct3D.Include class instead of the Borland.Delphi.System.Include method.

To resolve the conflict you can expand the "Windows Form Designer generated code" region and change the INCLUDE statement to:
"Borland.Delphi.System.Include(Borland.Delphi.System.Include(Self.Button1.Click, Self.Button1_Click);"

The problem with the changing the generated statement to the one above is that the IDE will change it back to be "Include(Self.Button1.Click, Self.Button1_Click);"
Steps to Reproduce:
1.  Download and install the Microsoft DirectX SDK http://www.microsoft.com/downloads/details.aspx?FamilyId=FD044A42-9912-42A3-9A9E-D857199F888E&displaylang=en
or ensure that you have Managed DirectX installed (usually found in "%WINDOWS%\Microsoft.NET\Managed DirectX").  Versions v9.00.0900, v9.00.1126, v9.00.2904 all have the same problem.

2. Open Delphi 8 for .NET

3. Start a new Windows Forms Project using the main menu  (File | New | Windows Forms Application)

4. Add a reference to the Managed DirectX assemblies Microsoft.DirectX, Microsoft.Directx.Direct3D, Microsoft.DirectX.Direct3DX

5. Add "Microsoft.DirectX, Microsoft.DirectX.Direct3D, Microsoft.DirectX.Direct3DX" to your USES clause

6. Switch to the form designer and place a control on the form, such as a BUTTON

7. Add any event to the button (or FORM if you prefer)

8. Compile

9. The compiler should give you this error message
[Error] WinForm.pas(58): read/write not allowed for CLR events.  Use Include/Exclude procedure
Workarounds
Move all statments such as "Include(Self.Button1.Click, Self.Button1_Click);" out of the form designer region into the forms CREATE method after the call to "InitializeComponent" and explicitly declare "Borland.Delphi.System.Include(Self.Button1.Click, Self.Button1_Click);"

An alternate Workaround would be to place all Managed DirectX code in a separate unit which does not have Designer assigned events.
Attachment
DirectXIncludeError.zip
Comments

Takuo Nakamura at 9/18/2006 8:50:08 PM -
IDE should generate Full Qualified Name 'Borland.Delphi.System.Include'.

Yuya Kamidu at 11/13/2006 7:21:14 AM -
Bug still exists in build 10.0.2288.42451

Takuo Nakamura at 12/7/2006 1:12:51 AM -
I think using Full Qualified Name(Borland.Delphi.System.Include) is very very simple
and easy solution.

Please fix this bug quicjly.

Alex Andre at 1/12/2009 4:22:21 PM -
Same with SlimDX (SlimDX.Direct3D9).
1 hour lost.

Server Response from: ETNACODE01