![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Function calling Topic Summary: Calling an #include function Created On: 7-Aug-2008 09:52 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hi all,
I have managed to cobble together a basic dxl script to create a user option DB and a separate function which copies a Formal module template with the user provided name and description. Both of these DXL scripts run ok independently but I'm having difficulty calling the function from the #include. It is probably obvious but I am a DXL novice on a steep learning curve! My code is attached below: Thanks Mark // Create Test Option Menu /* This script generates an Functional dialog that provides the user the ability to select required function. */ #include <C:\Documents and Settings\Mark Williamson\My Documents\DOORS\My DXL\TTG\includes\Create Adhoc Test.inc> string options[] = {"Create Adhoc test", "Create Baseline test", "Search existing tests", "Add test results","Search Test Results","Create Test Report","Search existing reports"} string user = doorsname DB OptionDB = create("TTG Options", styleFixed|styleCentered|styleFloating) DBE cNameDBE = field(OptionDB, "User: ",user, 20, false) DBE oFrameDBE = frame(OptionDB, "User Options", 200, 280) DBE optionDBE = verticalRadioBox(OptionDB, "Options", options, 0) optionDBE -> "top" -> "inside" -> oFrameDBE void getOption(DB dbe) { int o = get (optionDBE) string opt = options[o]"\n" print opt } apply (OptionDB,"Select",getOption) show OptionDB /// Create Adhoc Test Dialog /* This script generates an Functional dialog that provides the user the ability to create a new test as Adhoc or Baseline and copy a template module with user supplied name and description */ void createTest (DB NewTest) { string user = doorsname DB NewTestDB = create("Create New Adhoc Test", styleFixed|styleCentered|styleFloating) DBE cNameDBE = field(NewTestDB, "User: ",user, 20, true) DBE adhocDBE = field (NewTestDB,"Test Title","Enter test title here",20,false) DBE adhocDescDBE = field (NewTestDB,"Test Description","Enter test description here",20,false) cNameDBE ->"right"->"unattached" string title = (get adhocDBE) string desc = (get adhocDescDBE) confirm (NewTest, "This will create a new formal module in the database for selection of test requirements with the title: "title " and the description " desc) string modname = "/Terminal Test Generator/TTG Application/" title if(!exists module modname) { copy(module "Test Module template",title,desc) refreshDBExplorer hide NewTestDB } else { infoBox "Module already exists" } apply (NewTestDB,"Select",createTest) show NewTestDB } ------------------------- mark_williamson@synthesys.co.uk http://www.synthesys.co.uk ---------------------------------------- |
|
![]() |
|
![]() |
|
Basically, an #include <myFile> statement is used as if the content of 'myFile' was put directly in the source code at the place of the #include statement itself. In your example, in order to 'jump' into the included file, a line à la 'createTest(OptionDB)' after 'print opt' would do the trick.
Please note that my answer assumes that you want to use the 'createTest' routine as a callBack for the man 'OptionDB' dialog box. If that is true, calling the parameter variable in the routine header 'NewTest' is actually slightly obfuscating the code, and it might be confused with the 'DB NewTestDB' variable you are defining below. Regards, Peter |
|
![]() |
|
![]() |
|
Hi Peter,
Many thanks. I was 99% there and just needed to specify OptionDB with createTest. Regards Mark ------------------------- mark_williamson@synthesys.co.uk http://www.synthesys.co.uk ---------------------------------------- |
|
![]() |
|
![]() |
|
One step forward and two steps back. The function is now being called but the 'Apply' button is now not displayed within the DB created by the function. Is this something to do with the OptionDB callback in the function call?
Thanks Mark ------------------------- mark_williamson@synthesys.co.uk http://www.synthesys.co.uk ---------------------------------------- |
|
![]() |
|
![]() |
|
I can't replicate the problem, both buttons are properly displayed. Did you do any more changes to the code compare to what is above? On a side note, I would recommend to put the 'copy module' part into a separate callback routine. As it is now, the copy perm is executed before the user has a chance to provide module name and description.
Cheers, Peter |
|
![]() |
|
![]() |
|
Hello again Peter, thank you for your help and advice. I'm getting there slowly.
The OptionDB is displayed correctly with Select and Close buttons, but when NewTestDB is displayed (selected from OptionDB), only the close button is visible. I had noticed that the confirm and copy perm was being executed prior to the NewTestDB display, but haven't been able to create a separate call back routine where it is in scope. void createTest (DB NewTest) { string user = doorsname DB NewTestDB = create("Create New Adhoc Test", styleFixed|styleCentered|styleFloating) DBE cNameDBE = field(NewTestDB, "User: ",user, 20, true) DBE adhocDBE = field (NewTestDB,"Test Title","Enter test title here",20,false) DBE adhocDescDBE = field (NewTestDB,"Test Description","Enter test description here",20,false) cNameDBE ->"right"->"unattached" string title = (get adhocDBE) string desc = (get adhocDescDBE) confirm (NewTest, "This will create a new formal module in the database for selection of test requirements with the title: "title " and the description " desc) string modname = "/Terminal Test Generator/TTG Application/" title if(!exists module modname) { copy(module "Test Module template",title,desc) refreshDBExplorer show NewTestDB } else { infoBox "Module already exists" } show NewTestDB apply(NewTestDB,"Select",createTest) } Mark ------------------------- mark_williamson@synthesys.co.uk http://www.synthesys.co.uk ---------------------------------------- |
|
![]() |
|
![]() |
|
You accidentally placed the "apply" perm after the "show" perm. Any code after 'show' is never executed, hence the button is never displayed.
Attached a quick hack of your code with the 'copy' perm in a separate callBack routine. Cheers, Peter |
|
![]() |
|
![]() |
|
Hi Peter,
Many thanks for your persistance. I have much to learn. I think I now understand the callback usage and the benefit of creating separate call back routines. Your copyModule perm has given me an excellent example to work from. Thanks Mark ------------------------- mark_williamson@synthesys.co.uk http://www.synthesys.co.uk ---------------------------------------- |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Function calling
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.