Hi,
I was wondering if anybody has figured out how to obtain the user selections from a MultiList?
I am a student working on a project and I know that there is a "get" function, but I have tried using this before and am stumped on how I would obtain MULTIPLE selections from a multi list as defined by the user. Anything would help thank you. Also if anyone know how to display these selected attributes in the open module as new columns that would greatly help. My goal is to create a Requirements Tracibility Matrix without using the wizard that is already in doors. I have created a GUI for this already(although its only partially done)what im having trouble is with the set display method, this would have to attain the user choices and then display them in the source module.
/create a gui dialog box
//add the proper dialog box entries
DB db
DBE dbeBrowseSource
DBE dbeSourceModule
DBE dbeBrowseTarget
DBE dbeTargetModule
DBE dbeBrowseLink
DBE dbeLinkModule
//doSourceBrowse will open up an explorer to allow the user to select the Source Module
void doSourceBrowse(DBE dbe)
{
string sourceModuleName = miniExplorer(db, current Folder, MINI_EXP_FORMAL_MODS)
set(dbeSourceModule, sourceModuleName)
}
//doTargetBrowse will allow the user to select the Target Module by using a browse
void doTargetBrowse(DBE dbe)
{
string targetModuleName=miniExplorer(db,current Folder,MINI_EXP_FORMAL_MODS)
set(dbeTargetModule, targetModuleName)
}
//doLinkBrowse will allow the user to select the link module
void doLinkBrowse(DBE dbe)
{
string linkModuleName=miniExplorer(db, current Folder, MINI_EXP_LINK_MODS)
set(dbeLinkModule, linkModuleName)
}
void doAttributeBrowse(DB db1,DBE targetAttributes)
{
string targetAttribute = miniExplorer(db1, current Folder, MINI_EXP_ATTRIBUTE)
set(targetAttributes, targetAttribute)
}
void setDisplay(DB attrShow)
{
int i=0
destroy(attrShow)
destroy(db)
}
void doNext(DB db)
{
DB attrShow = create("Attributes",styleCentered)
string attrNames100
int noOfAttrs = 0
AttrDef attribute
if (null current Module)
{
ack "Please run this function from a module" halt
}
string targetModuleName = get( dbeTargetModule )
ModName_ targetModRef = module( targetModuleName )
Module targetModule = read(fullName targetModRef, false)
for attribute in targetModule do
attrNamesnoOfAttrs++ = attribute.name
DBE attrList = multiList(attrShow, "Select Attribute(s) for the Target Document:", 50, attrNames, noOfAttrs)
apply(attrShow,"Set and Display in Source Module",setDisplay)
realize attrShow
show attrShow
}
db = create("Select the Proper Modules")
dbeSourceModule = field(db, "Source Module", "", 50, true)
dbeBrowseSource = button(db, "Browse...", doSourceBrowse)
dbeTargetModule = field(db, "Target Module", "", 50, true)
dbeBrowseTarget=button(db, "Browse...", doTargetBrowse)
dbeLinkModule=field(db, "Link Module", "", 50, true)
dbeBrowseLink=button(db, "Browse...", doLinkBrowse)
apply(db, "Next", doNext)
realize db
show db
Ari226 - Tue Jul 27 12:48:42 EDT 2010 |
Re: DOORS Attribute Display doors36677 - Wed Jul 28 08:53:04 EDT 2010
Perhaps an example will help you.
DB attrShow = create
"Attributes" string attrNames[100]
int noOfAttrs = 0 string an
if (
null current Module)
{ ack
"Please run this function from a module" halt
}
for an in current Module
do attrNames[noOfAttrs++] = an DBE attrList = multiList(attrShow,
"Attributes:", 5, attrNames, noOfAttrs)
void printAttrs(DB box)
{ string attrName
for attrName in attrList
do
{ print attrName
" = " ((current Object).attrName)
"\n"
}
} apply(attrShow,
"Print", printAttrs)
void clearSelection(DB box)
{
int i
for i in 0:noOfAttrs
do set(attrList, i,
false)
} apply(attrShow,
"Clear", clearSelection) show attrShow
|
Re: DOORS Attribute Display doors36677 - Wed Jul 28 13:50:51 EDT 2010 Ari226 - Wed Jul 28 13:26:27 EDT 2010
Ok,
But I am nearly done writting this code. Do you by any chance have any examples of just how to display a selected attribute in a new column in the source module. I am doing this as part of a project. The source module would already be opne, so in essence I just need a little info in how to display a new column(or various columns) in the current Module. Thanks for your help :)
// view DXL example
/* construct a new view containing a selection of attributes. Save as the view 'View DXL example". */ string viewName =
"View DXL example" DBE attrList
// contains selection of attributes to display
void buildFn(DBE dbe)
{
// construct view of attributes chosen string attr Column c
int n = 0
// number of existing columns
int i
// column index
for c in current Module
do n++
// count the columns
for i in 1:n
do delete(column 0)
// delete n column 0s i=0
for attr in attrList
do
{ insert(column i) attribute(column i, attr) width(column i, 100) justify(column i, center) i++
} refresh current
// important! (last column does not appear otherwise). save view viewName
}
// Main program
// first look to see if we have an old view to display
if (load view viewName) ack
"we have just loaded the last constructed view for this example program"
else ack
"first run of view dxl example" DB viewDB = create
"Create View" string empty[] =
{
} attrList = multiList(viewDB,
"Attributes:", 5, empty) button(viewDB,
"Build View", buildFn) realize viewDB
// populate attrList string attr
for attr in current Module
do insert(attrList, 0, attr) show viewDB
|