Book a Demo

Author Topic: Roundtrip engineering breaks VB class declaration  (Read 2259 times)

Tonu

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Roundtrip engineering breaks VB class declaration
« on: August 13, 2007, 04:17:29 am »
Hi All,

I was trying to get a VB 6.0 ActiveX project in sync with model and suddenly discovered the classes I used to export from my ActiveX DLL where not exported any more !!! What I did was to import code, fix comments of attributes and operations (as well as add some attributes) and synchronize changes back to code.

The reason was easy to find -- EA generates VB_Creatable and VB_Exposed attributes (as well as some others) based on global settings and ignores completely what I had before in the file. That is OK when generating new code. However in synchronizing with the old code it is unacceptable.
The correct way would be to import the attributes from source file and use global defaults only in case of generating new code (or when there was no specification in the existing file).

Question 1: Can I fix it somehow by modifying the code generation template? The absolute minimum I wanted to see is that the code generator would not touch the Attribute VB_* lines when I already heave something written there!
This part of the declaration is generated by template
--------
Attribute VB_Name = "%className%"
Attribute VB_GlobalNameSpace = %genOptVBGlobal == "T" ? "True" : "False"%
Attribute VB_Creatable = %genOptVBCreatable == "T" ? "True" : "False"%
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = %genOptVBExposed == "T" ? "True" : "False"%
Attribute VB_Ext_KEY = "SavedWithClassBuilder" , "Yes"
Attribute VB_Ext_KEY = "Top_Level" , "Yes"
--------
If I remove problematic rows, it deletes my old code also. Is there any other way to make script conditional so that it would generate code only when the section is missing?

Question 2: (a more general one) What would be semantically correct way to import those attributes. The easiest would be to import them as tagged values. However, may be there are some "more visible" attributes of a class that have the same semantics.

Best regards,
Tonu
« Last Edit: August 13, 2007, 04:21:22 am by naks »