Dialog box is not updating...

So in one of my DXLs, I have a list of Modules to chose from as a list and then to the right of it, there is a list of the baselines for the selected module. At the bottom, once you click on the add button it gives you the option to create a new baseline. It is creating the new baseline, but it is not updating the baselines for the selected module. For me to get it to update, I have to click on one of the modules in the left hand list. I've been looking for something that may update said Dialog box, but with no luck. Is there maybe a function or something I would have to do to get this dialog box to update without me having to click on a module?

Thanks

Eric
Eric_Hillen - Fri Mar 11 16:17:33 EST 2011

Re: Dialog box is not updating...
Mathias Mamsch - Sat Mar 12 16:46:22 EST 2011

How about just calling the select callback of the list, after creating the baseline? Or am I thinking to simple? Regards, Mathias
 

DB modulesBox = create "Modules" 
string moduless[] = {"Module 1", "Module2","Module 3"} 
DBE modulesList = list(modulesBox, "Choose one of:", 5, moduless) 
 
void getBaselines(DBE modulesList) { ack "Updating list!" } 
void cbAddOne (DBE x) { getBaselines(x) /* update the list */ }
// Button updates the list too!
button (modulesBox, "make baseline", cbAddOne) 
 
set(modulesList, getBaselines) 
show modulesBox

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: Dialog box is not updating...
Eric_Hillen - Tue Mar 15 10:45:44 EDT 2011

Mathias Mamsch - Sat Mar 12 16:46:22 EST 2011

How about just calling the select callback of the list, after creating the baseline? Or am I thinking to simple? Regards, Mathias
 

DB modulesBox = create "Modules" 
string moduless[] = {"Module 1", "Module2","Module 3"} 
DBE modulesList = list(modulesBox, "Choose one of:", 5, moduless) 
 
void getBaselines(DBE modulesList) { ack "Updating list!" } 
void cbAddOne (DBE x) { getBaselines(x) /* update the list */ }
// Button updates the list too!
button (modulesBox, "make baseline", cbAddOne) 
 
set(modulesList, getBaselines) 
show modulesBox

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

There is something like that already in the DXL that orignally gets the baselines when you SElECT a module from the list. The function is declared as follows:

void on_moduleselect (DBE modlst) {

No where in the function is modlist being used. Inside this DXL there is only one instance in which this function is called. The time this function is called is as follows:

set(moduleList, on_moduleselect)

Where moduleList is the dialog box that lists the modules.

My intention was to run the function on_moduleselect on it's own as soon as the new baseline is being created. Except when I do this, I get on_module select to be an undeclared variable. I've tried many things such as just copying and pasting the instance in which it is already called, but I still get the error of it being an undeclared variable.

Any help would be appreciated.
Thanks

Eric

Re: Dialog box is not updating...
Mathias Mamsch - Tue Mar 15 12:38:27 EDT 2011

Eric_Hillen - Tue Mar 15 10:45:44 EDT 2011
There is something like that already in the DXL that orignally gets the baselines when you SElECT a module from the list. The function is declared as follows:

void on_moduleselect (DBE modlst) {

No where in the function is modlist being used. Inside this DXL there is only one instance in which this function is called. The time this function is called is as follows:

set(moduleList, on_moduleselect)

Where moduleList is the dialog box that lists the modules.

My intention was to run the function on_moduleselect on it's own as soon as the new baseline is being created. Except when I do this, I get on_module select to be an undeclared variable. I've tried many things such as just copying and pasting the instance in which it is already called, but I still get the error of it being an undeclared variable.

Any help would be appreciated.
Thanks

Eric

Probably the function moduleselect is declared inside another function or after the function where you are trying to call it. If this is the case its scope is limited to the function, and any try to call it will result in an undeclared variable error. Example:
In the following code the on_moduleselect cannot be found from the ButtonCallback, because the scope of on_moduleselect is "make-Dialog-only".

void ButtonCallback (DBE x) {
  // make baseline ...
  create (m, nextMajor(""), ...) 
 
  // call update function - undeclared variable! 
  on_moduleselect  (lv) 
}
 
DB makeDialog () {
   void on_moduleselect (DBE x) {
      // update the baseline listview 
      ...
   }
 
   DB dialog = create "..."
   DBE lv = listView (...) 
 
   // set the callback 
   set(lv, on_moduleSelect, doNothing, doNothing) 
 
   // 
   button (dialog, "Make Baseline", ButtonCallback) 
}

 


Solution: Move your functions to the same scope, make sure the on_moduleselect function is before the other function. If necessary, for example if the makeBaseline function is in another include, you need to insert a proxy-function, which will call the make baseline and then do the update, or move the on_moduleselect before the #include statement.

 

 

 

void on_moduleselect (DBE x) {
   // update the baseline listview 
   ...
}
 
void ButtonCallback (DBE x) {
  // make baseline ...
  create (m, nextMajor(""), ...) 
 
  // call update function - undeclared variable! 
  on_moduleselect  (lv) 
}
 
DB makeDialog () {
 
   DB dialog = create "..."
   DBE lv = listView (...) 
 
   // set the callback 
   set(lv, on_moduleSelect, doNothing, doNothing) 
 
   // 
   button (dialog, "Make Baseline", ButtonCallback) 
}

 


If this does not work, I guess you need to post some example code. Regards, Mathias

 

 

 

 

 

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: Dialog box is not updating...
llandale - Tue Mar 15 13:32:23 EDT 2011

Eric_Hillen - Tue Mar 15 10:45:44 EDT 2011
There is something like that already in the DXL that orignally gets the baselines when you SElECT a module from the list. The function is declared as follows:

void on_moduleselect (DBE modlst) {

No where in the function is modlist being used. Inside this DXL there is only one instance in which this function is called. The time this function is called is as follows:

set(moduleList, on_moduleselect)

Where moduleList is the dialog box that lists the modules.

My intention was to run the function on_moduleselect on it's own as soon as the new baseline is being created. Except when I do this, I get on_module select to be an undeclared variable. I've tried many things such as just copying and pasting the instance in which it is already called, but I still get the error of it being an undeclared variable.

Any help would be appreciated.
Thanks

Eric

Mathias is probably right about the scope.

Nested functions don't work so well in DXL mostly because the nested function cannot use variables declared in the MAIN function. The following gets this DXL error:
-E- DXL: <Line:10> non local variable access (LocalToMain)

string    s_Global = ""
 
void    FunctionMain()
{
        string  LocalToMain = ""
 
        void    FunctionSub()
        {     // Function embedded in FunctionMain()
                string a = s_Global             // OK, can see s_Global
                string b = LocalToMain          // FAIL
                FunctionMain()                  // OK 
        }     // end FunctionSub()
}


The main purpose of these nested functions is to share the data with the main function, although hiding them from other function calls is useful. Anyway, I'm pretty sure I have never deployed any production code with any nested functions; except in one case where I chose to use nesting as part of a silly Recursive algorithm which I later corrected.

Besides DXL limits, nested functions are hard to read and follow and should be avoided unless there's a compelling reason to use them. Huge programs will want to cleverly name their functions based on their topic, the "Find" capability of your DXL can feature functions whose name starts with "Find_", the "Update" capability can have functions prefixed "Update_".

 

 

  • Louie


I suppose Mathias can come up with a clever addr_ of addr_ schema to allow use of non-global variables (LocalToMain above). That's cool, but I'm a "Keep It Simple Stupid" KISS kind o' guy.

 

 

Re: Dialog box is not updating...
Eric_Hillen - Tue Mar 15 14:07:23 EDT 2011

llandale - Tue Mar 15 13:32:23 EDT 2011

Mathias is probably right about the scope.

Nested functions don't work so well in DXL mostly because the nested function cannot use variables declared in the MAIN function. The following gets this DXL error:
-E- DXL: <Line:10> non local variable access (LocalToMain)

string    s_Global = ""
 
void    FunctionMain()
{
        string  LocalToMain = ""
 
        void    FunctionSub()
        {     // Function embedded in FunctionMain()
                string a = s_Global             // OK, can see s_Global
                string b = LocalToMain          // FAIL
                FunctionMain()                  // OK 
        }     // end FunctionSub()
}


The main purpose of these nested functions is to share the data with the main function, although hiding them from other function calls is useful. Anyway, I'm pretty sure I have never deployed any production code with any nested functions; except in one case where I chose to use nesting as part of a silly Recursive algorithm which I later corrected.

Besides DXL limits, nested functions are hard to read and follow and should be avoided unless there's a compelling reason to use them. Huge programs will want to cleverly name their functions based on their topic, the "Find" capability of your DXL can feature functions whose name starts with "Find_", the "Update" capability can have functions prefixed "Update_".

 

 

  • Louie


I suppose Mathias can come up with a clever addr_ of addr_ schema to allow use of non-global variables (LocalToMain above). That's cool, but I'm a "Keep It Simple Stupid" KISS kind o' guy.

 

 

The function on_moduleselect isn't declared inside another function. It is declared at the end of the DXl along with all of my other functions. I have found out that if I paste the contents of the function, so everything inside the brackets, where I want the function to run, it works. I've tried creating a new function with a different name and having no parameters. So at this point I'm just going to keep the contents of the function, although lengthy, at their respective spots.

Thanks

Eric

Re: Dialog box is not updating...
Mathias Mamsch - Tue Mar 15 18:32:54 EDT 2011

llandale - Tue Mar 15 13:32:23 EDT 2011

Mathias is probably right about the scope.

Nested functions don't work so well in DXL mostly because the nested function cannot use variables declared in the MAIN function. The following gets this DXL error:
-E- DXL: <Line:10> non local variable access (LocalToMain)

string    s_Global = ""
 
void    FunctionMain()
{
        string  LocalToMain = ""
 
        void    FunctionSub()
        {     // Function embedded in FunctionMain()
                string a = s_Global             // OK, can see s_Global
                string b = LocalToMain          // FAIL
                FunctionMain()                  // OK 
        }     // end FunctionSub()
}


The main purpose of these nested functions is to share the data with the main function, although hiding them from other function calls is useful. Anyway, I'm pretty sure I have never deployed any production code with any nested functions; except in one case where I chose to use nesting as part of a silly Recursive algorithm which I later corrected.

Besides DXL limits, nested functions are hard to read and follow and should be avoided unless there's a compelling reason to use them. Huge programs will want to cleverly name their functions based on their topic, the "Find" capability of your DXL can feature functions whose name starts with "Find_", the "Update" capability can have functions prefixed "Update_".

 

 

  • Louie


I suppose Mathias can come up with a clever addr_ of addr_ schema to allow use of non-global variables (LocalToMain above). That's cool, but I'm a "Keep It Simple Stupid" KISS kind o' guy.

 

 

I don't agree with Louie, regarding nested functions. Especially in dialog callbacks in can make sense to be able to reuse the same callback names for standard callbacks, like "on_close", without wanting to clutter the global namespace.

Did you check that the on_moduleselect is actually defined before the piece of code, where you want to call it? This is supposed to work, and I really cannot think about another reason other than misspelling or wrong scope for a "undeclared variable" message. In very rare cases you can get pseudo DXL error messages from DXL layouts, or attribute DXLs that seem to belong to your program but really occur in a Layout or Attribute DXL when your module opens another module.

Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS