Hi to all suffering from the thorns of Rose!

I am trying to use scripting to reposition messages in a sequence diagram.
I am trying to move the messages on Y axis (bring them higher up), but Rose behaves 
strangely.
It seams that the following adds the new value instead of setting it (?!)

print aMessage.Yposition       // will print 416
aMessage.Yposition = 200       //
print aMessage.Yposition       // will print 624 !!!!

the .Yposition property will not accept negative values, so whatever one does the 
message will move down instead of up.

Is that a bug or do I do something wrong?

thanks for any help and ideas.
konstantinos


PS. For anyone curious to reproduce the problem:

1. Create a new model
2. make a new sequence diagram
3. add two objects
4. draw a message between the two objects
5. select the package that contains the diagram in the browser
6. select the message in the sequence diagram.
7. run the following script:

Sub Main
     Dim newSequenceDiagram   As ScenarioDiagram
     Dim TheSelectedCategory As Category
     Dim cardinality          As Integer
     Dim newY            As Integer

     viewport.open
     viewport.clear

            Set TheSelectedCategory      = 
RoseApp.CurrentModel.GetSelectedCategories().GetAt(1)
               cardinality         = TheSelectedCategory.ScenarioDiagrams.count
               If  cardinality >0 Then
               Set newSequenceDiagram    = 
theSelectedCategory.ScenarioDiagrams.GetAt(1)
                    For i =  newSequenceDiagram.ItemViews.count To 1 Step -1
                         If ((newSequenceDiagram.ItemViews.GetAt(i).IsSelected) ) Then
                              newY = newSequenceDiagram.ItemViews.GetAt(i).Yposition /2
                              Print "original: 
",newSequenceDiagram.ItemViews.GetAt(i).Yposition ,
                              Print "new     : ",newY
                              Set newSequenceDiagram.ItemViews.GetAt(i).Yposition = 
newY
                              newSequenceDiagram.ItemViews.GetAt(i).Invalidate 'To 
redraw
                              newSequenceDiagram.Invalidate' To redraw
                              Print "new values: 
",newSequenceDiagram.ItemViews.GetAt(i).Yposition
                         End If
                    Next i
               End If
End Sub



************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Post or Reply to: [EMAIL PROTECTED]
* Subscription Requests: [EMAIL PROTECTED]
* Archive of messages:
*    http://www.rational.com/support/usergroups/rose/rose_forum.jsp
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
*    To: [EMAIL PROTECTED]
*    Subject: <BLANK>
*    Body: unsubscribe rose_forum
*************************************************************************

Reply via email to