Hi,
//Source Module should be OPEN!
pragma runLim, 0
Module mCurrent = current
if (null mCurrent) {
infoBox "Open the source module first and Edit DXL!"
halt
}
string smName = name mCurrent
Module mAttr = read (smName)
AttrDef attr
// Define array size
int counter2 = 0
for attr in mAttr do counter2++
string sAttr[counter2]
counter2 = 0
// Define array
for attr in mAttr do {
string stName = attr.(name)
sAttr[counter2] = {stName}
counter2++
}
// Define array size
int counter1 = 0
Item i
for i in current Folder do counter1++
string moduleList[counter1]
counter1 = 0
// Define array
for i in current Folder do {
string sName = name i
moduleList[counter1] = {sName}
counter1++
}
DB dylgBx = create ("My dialog box")
DBE dbeSrc = choice (dylgBx, "Select Source Module", moduleList, sizeof(moduleList), 0, 20, true)
DBE dbeAttr = list (dylgBx, "Select the attribute including link numbers", 100, 5, sAttr, sizeof (sAttr))
void getValues (DB dylgBx) {
string nameSrc = get dbeSrc
string nameAttr = get dbeAttr
Module sourceModule = edit(nameSrc)
}
apply (dylgBx, "Accept!", getValues)
show dylgBx
ozguraltay - Tue Jan 31 11:49:24 EST 2012 |
Re: How to go step-by-step in DialogBox It allows you to select a target module and then updates a list of attributes for that module from which you can make a selection. I find this file on my machine at C:\Program Files(x86)\IBM\Rational\DOORS\9.3\lib\dxl\example\LinkByKey.dxl. |
Re: How to go step-by-step in DialogBox Rolan - Tue Jan 31 12:14:52 EST 2012 I need a simple code to select a module first, and get the attributes of it. That example is hard to simplify for me... |
Re: How to go step-by-step in DialogBox The 2nd part should be "blocked" to make sure the user doesn't close the module while the dialog is open. I would make this two small dialogs, the first is hidden and destroyed during the "read the module" part, and then "block" the second. I suggest you skip the first step and make this script one that requires a "Module" as scope. Open the module edit, then run the script from it. Following code will help. Module g_mCurr = current if (null g_mCurr or !isEdit(g_mCurr)) { errorBox("Run from edited open module") halt } -Louie Be advised that your dialog code can get activated via a button the user pushes, but you can also assign a callback to a DBE, so when the user clicks in the DBE your code auto-fires. void clbkModuleSelect(DBE dbeXX) { int iModNum = read(dbeModuleList) figure out which module if invalid // then show (again) the dialog else hide and destroy dialog, open, read, present 2nd dialog } ... dbeList = the module list DBE set(dbeList, clbkModuleSelect) // assign callback |
Re: How to go step-by-step in DialogBox llandale - Tue Jan 31 13:56:41 EST 2012
I think I coulnd't explain my problem well.
pragma runLim, 0
Module mCurrent = current
string smName = name mCurrent
Module mAttr = read (smName)
AttrDef attr
// Define array size
int counter2 = 0
for attr in mAttr do counter2++
string sAttr[counter2]
counter2 = 0
// Define array
for attr in mAttr do {
string stName = attr.(name)
sAttr[counter2] = {stName}
counter2++
}
// Define array size
int counter1 = 0
Item i
for i in current Folder do counter1++
string moduleList[counter1]
counter1 = 0
// Define array
for i in current Folder do {
string sName = name i
moduleList[counter1] = {sName}
counter1++
}
DB dylgBx = create ("My dialog box")
DBE dbeSrc = choice (dylgBx, "Select Source Module", moduleList, sizeof(moduleList), 0, 20, true)
DBE dbeAttr = list (dylgBx, "Select the attribute including link numbers", 100, 5, sAttr, sizeof (sAttr))
void getValues (DB dylgBx) {
string nameSrc = get dbeSrc
string nameAttr = get dbeAttr
Module sourceModule = edit(nameSrc)
}
apply (dylgBx, "Accept!", getValues)
show dylgBx
|
Re: How to go step-by-step in DialogBox ozguraltay - Wed Feb 01 04:23:35 EST 2012
I think I coulnd't explain my problem well.
pragma runLim, 0
Module mCurrent = current
string smName = name mCurrent
Module mAttr = read (smName)
AttrDef attr
// Define array size
int counter2 = 0
for attr in mAttr do counter2++
string sAttr[counter2]
counter2 = 0
// Define array
for attr in mAttr do {
string stName = attr.(name)
sAttr[counter2] = {stName}
counter2++
}
// Define array size
int counter1 = 0
Item i
for i in current Folder do counter1++
string moduleList[counter1]
counter1 = 0
// Define array
for i in current Folder do {
string sName = name i
moduleList[counter1] = {sName}
counter1++
}
DB dylgBx = create ("My dialog box")
DBE dbeSrc = choice (dylgBx, "Select Source Module", moduleList, sizeof(moduleList), 0, 20, true)
DBE dbeAttr = list (dylgBx, "Select the attribute including link numbers", 100, 5, sAttr, sizeof (sAttr))
void getValues (DB dylgBx) {
string nameSrc = get dbeSrc
string nameAttr = get dbeAttr
Module sourceModule = edit(nameSrc)
}
apply (dylgBx, "Accept!", getValues)
show dylgBx
OK. User selects module A and you react by opening it invisibly, reading its attribute names, and displaying them in the list. When user selects module B then you erase the previous list and build a new one.
for (iRow = NumCurrentRows-1; iRow >= 0; iRow--)
{ delete(dbeList, iRow)
}
// or this
for (i = 0; i < NumCurrentRows; i++)
{ delete(dbeList, 0)
}
// when you delete row zero, the other rows are demoted and there is a new row zero.
int iRow = 0
for NameAttr in the module I want to display
{ set(dbeList, iRow, NameAttr)
iRow++
put(skpListNames, iRow, NameAttr)
}
Store iRow globally (NumCurrentRows = iRow) so the remove code above knows how many rows there are.
When a user selects an attribute, you read the list number and can deduce the attribute name selected:
iRowSelected = get(dbeList) find(skpListNames, iRowSelected, NameAttr) -Louie
|
Re: How to go step-by-step in DialogBox llandale - Wed Feb 01 14:29:16 EST 2012
OK. User selects module A and you react by opening it invisibly, reading its attribute names, and displaying them in the list. When user selects module B then you erase the previous list and build a new one.
for (iRow = NumCurrentRows-1; iRow >= 0; iRow--)
{ delete(dbeList, iRow)
}
// or this
for (i = 0; i < NumCurrentRows; i++)
{ delete(dbeList, 0)
}
// when you delete row zero, the other rows are demoted and there is a new row zero.
int iRow = 0
for NameAttr in the module I want to display
{ set(dbeList, iRow, NameAttr)
iRow++
put(skpListNames, iRow, NameAttr)
}
Store iRow globally (NumCurrentRows = iRow) so the remove code above knows how many rows there are.
When a user selects an attribute, you read the list number and can deduce the attribute name selected:
iRowSelected = get(dbeList) find(skpListNames, iRowSelected, NameAttr) -Louie
I'm working on the code you give to integrate into my code, but no success. Can you help me with that? And I think there must be another way to do this. the example code in "C:\Program Files (x86)\Telelogic\DOORS_8.3\lib\dxl\example" linkbykey.dxl has the function I need, but I coulnd't simplify it... |