![]() |
Telelogic System Architect (steve huntington) | ![]() |
Topic Title: Opening a definition window using VBA Topic Summary: Created On: 16-Jan-2008 17:11 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hello,
I've been right through the supplied documentation on VBA Extensibility, but can't find any methods capable of opening a definition window from an identified Definition object. It doesn't seem too exotic a thing to want to try, but the documentation is mostly geared towards diagram control, as far as I can see. I'm trying to achieve this for the purposes of an encyclopedia-wide definition name search. I've gotten as far as populating a listbox of search hits and picking-out the selected one from my SAObjects object. I just wondered if I'd be right in thinking that there's no way to open the definition window, and if so, is anyone employing a workaround for definition search? Many thanks for any help, Adam |
|
![]() |
|
![]() |
|
I was just starting to look into this myself, either through a guidebook or executing a macro from a guidebook.
I suspect that it is possible, just not publicly documented but I am aware that the VBA manual does not cover every possibility. I have never attempted to open the standard dialog boxes from within VBA so far but many years ago a Popkin consultant did write us a macro that put a list of definitions into a form and let us update a chosen field for one or many of them. Edited: 17-Jan-2008 at 11:04 by Peter Crabb-Wyke |
|
![]() |
|
![]() |
|
Sorry, I didn't think the first post had submitted.
Edited: 17-Jan-2008 at 11:03 by Peter Crabb-Wyke |
|
![]() |
|
![]() |
|
Thanks for your reply Peter.
I'm still yet to find a solution to the issue, though I have found in the VBA Object Browser a method listed as part of the SA2001.ISAImf class, named SAOpenDefinition and described: Function SAOpenDefinition(lpidDefinition As Long, lphDefHandleRet As Long) - However, the editor/compiler is unable to recognise the ISAImf class, which is very puzzling. It has me wondering about the means through which Telelogic encourage the take-up of their consultancy options. If there are any staff reading this thread, can you please advise whether certain VBA functionality is by default disabled and requires unlocking by a consultant? Or is it merely undocumented as Peter suggested? I'm not sure whether locking-down the capability of a non- paid add-on is reasonable or not, but I think it's important to at least be transparent to the customer about what can be done without assistance, and what needs to be paid for. I'll log my specific question with support meanwhile, and await a more general response if any member of staff is able to share one. Many thanks for any advice. Adam |
|
![]() |
|
![]() |
|
We have several functioning macros using SA2001.ISAImf but we are back level and still using 10.1 so it may have changed since then. I went through the same set yesterday and came away confused.
The documentation problems date back to Popkin days. |
|
![]() |
|
![]() |
|
May not be helpful but I just came across this code snippet which may help identify any syntax errors in your code.
Set imfSA = appSA.Interface("ISAimf") response = imfSA.SAExecuteMenuCommand(328) This invokes the "save as" menu command to save the current diagram with a new name but anything else using ISAimf should presumably be in much the same format. |
|
![]() |
|
![]() |
|
Getting closer, this just opened an existing definition.
response = imfSA.SAEditDefinition(45152, False) Where 45152 was the DDID of the definition I was opening and False means not read-only. |
|
![]() |
|
![]() |
|
Thanks a lot for posting your findings Peter. I've tried a few things based on your code and from looking through the .bas and DLL files in the main System Architect folder.
I can't use appSA.Interface as it is, but I do have a function SA2001.Application.Interface; from the Object Browser: Function Interface(InterfaceName As String) As Object Member of SA2001.Application Returns the requested interface as an object. Currently only accepts "ISAImf" Unfortunately, I'm not able to use this either. The function fails to return an object to the Object variable imfSA on Set. I'm not sure what's preventing it from working. It's possible that it requires another string to access the interface, in case it's been changed. That would go against the description in the Object Browser, but I'm not sure how accurate its data is. The other avenue I've been starting down is using a DLL utility to view the functions of DLLs in the main SA folder, then declare them in a module. There are a few likely candidates, but I'm struggling with DLL initialisation errors at the moment. I'll keep trying meanwhile and update with my findings. |
|
![]() |
|
![]() |
|
I am getting worried that I might have a big rewrite on my hands when we upgrade. What version are you running Adam?
I am now trying to make sense of some of the other options but the variables that they prompt for are seldom intuitive. |
|
![]() |
|
![]() |
|
Getting a bit further with my approach! - I think. I seem to have successfully accessed the _EditDefinition@8 function contained within sadesign.dll using:
Declare Function OpenDefinition Lib "sadesign.dll" Alias "#197" (Optional lpidef As Long, Optional lphdef As Long) As Integer [And variants of this] But no matter how many arguments of whichever data types I give the function, it produces a dialog window, saying "Could not access definition", and returns the integer = 192. Stuck here while I try to find out a bit more about the function; I must be sending inappropriate variables to it. |
|
![]() |
|
![]() |
|
I'm using 10.7 just now. It does seem odd that there'd be such a big difference over a few point-releases. I understand internal representations are due to change quite dramatically in 11, so there will no-doubt be quite a bit of change to accommodate in macros.
|
|
![]() |
|
![]() |
|
Not sure what the problem you're having is here but the following will work in V11 and probably all the way back to version 9.0, I think that's when IMF was changed to an interface call.
There are no big differences or dramatic changes to the API for Version 11.0. Public Sub Test() EditDefinition 1651 End Sub Private Function EditDefinition(ByVal v_lngddId As Long) As Long Dim appSA As New SA2001.Application Dim imfSA As ISAImf Set imfSA = appSA.Interface("ISAimf") EditDefinition = imfSA.SAEditDefinition(v_lngddId, False) End Function ------------------------- Senior Software Developer Telelogic UK Ltd. |
|
![]() |
|
![]() |
|
That is what is working for me but from Adam's posts I think it wasn't working for him.
An underlying problem is that all these calls are undocumented and it takes a lot of trial and error to make them work (or not as the case may be) |
|
![]() |
|
![]() |
|
Agree 100% with you Peter. We are trying our best to position SA as our Enterprise repository and have several customizations and automations - but it is extremely painful to figure out what is available and how it works. Seems like there would be some documentation somewhere that Telelogic could release to customers wanting to exploit the SA capabilities.
|
|
![]() |
|
![]() |
|
We have made extensive use of VBA partly by canibalising samples from a Popkin training course and partly from the VBA manual. This hasn't been a problem until we hit the need to use one of these undocumented interface calls.
I have been looking at making some serious use of guidebooks and trying to put all the user actions into links rather than telling them to go and click somewhere else. I keep coming up against issues with these interface calls and where I have made things work it often involves some convoluted workarounds. |
|
![]() |
|
![]() |
|
Is it possible to programatically change the data in the definition window after it has opened?
|
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.