Hello,
 
I'd like to forbid to create new classes in certain cases. I've tried to do this by deleting the class after a newModelElement event but rose crashes. That is somewhat comprehensible because I have to delete the RoseItem of which afterwards a pointer might still be used. Now I try a "softer" solution, i. e. I try to relocate the class in a sort of trashcan.
The trashcategory is properly initialized (global), as well as the delclass. But still the RelocateClass doesn't work. The class is afterwards just in the same category where it was created.
 
Anyone knowing a solution?
 
 
Public Sub OnNewModelElement(objRoseApp As RoseApplication, objItem As RoseItem)
    Dim retval As Boolean
    Dim modellname As String
       
    interneAenderung = True
   
    'MsgBox "NewModelElement"
    'MsgBox "Neuer Item " + objItem.Name
   
    If aktuelleAnsicht <> ANSICHT.MODELL Then
        Dim delclass As RoseClass
        Dim res As VbMsgBoxResult
        Dim res2 As Boolean
       
        res = MsgBox("Bitte wechseln Sie zum Anlegen neuer Klassen in die Modellansicht.", vbOKOnly, "Fehler")
       
        Set delclass = objRoseApp.CurrentModel.GetAllClasses.GetWithUniqueID(objItem.GetUniqueID)
        
        trashCategory.RelocateClass (delclass)
       
    Else
        ...
    End If
   
    interneAenderung = False
   
End Sub
 

Alexander

Reply via email to