![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Listview callbacks Topic Summary: nested functions for listview data extraction Created On: 13-Oct-2008 21:53 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: In general, the DBEs need to be global. All the callbacks follow a pre-determined syntax, with only the "current" DBE passed in as a variable. So, if you want to have a dialog box where a user clicks a button, and information is extracted from the listView, the listView must be global, because the pre-determined syntax for the button callback is "void fnButtonClick(DBE xButton) {}". The only variable passed to the callback is the button DBE (which is worthless....EDIT: well, almost worthless... you can use setParent and make the listView the parent of the button; then within the callback, you can use getParent to get the parent of the button, i.e., the listView). There is no way to pass in another DBE, such as the listView. The attached code shows a listView with some callbacks. If is possible to declare the listView and the set(listSelect,listDeselect,listActivate) callbacks locally within some function, as long as you attach the callbacks to the list view within the same function. This works because these callbacks pass in the listView you want, i.e., these callbacks follow the syntax: "void fnListSelect(DBE xListView, int i)". But, of course, you won't be able to have any other callbacks interact with the listView, because now the listView is a local variable. | |
![]() |
|
Hello All,
I have created a DB with only two DBE's, a list view and a FileName. The list view is being correctly populated on the basis of a user selection and the fileName DBE is no problem. I thought that was the hard work done but I have not been able to figure out how to extract the value of the single list view selection within a call back. I simply want to create an external link from a module based upon the link view selection to a file specified by the fileName DBE. How hard can it be??? When attempting to create call back functions, the variables required are invariably out of scope? Any pointers in the right direction would be much appreciated. Thanks in advance Mark ------------------------- mark_williamson@synthesys.co.uk http://www.synthesys.co.uk ---------------------------------------- |
|
![]() |
|
![]() |
|
Since callbacks routinely access DBE that are not part of the call parameter, the DBE declarations need to be global; as does often the DB declaration. Declare them at the top, use them at the bottom. Most of my scripts use a Dialog, and ALL of them are structured like this:
[] Normal global variable and constant declarations [] DB and DBE declarations [] Various functions [] Dialog callbacks [] Main create-dialog function, that creates the DB and DBEs - Louie |
|
![]() |
|
![]() |
|
In general, the DBEs need to be global.
All the callbacks follow a pre-determined syntax, with only the "current" DBE passed in as a variable. So, if you want to have a dialog box where a user clicks a button, and information is extracted from the listView, the listView must be global, because the pre-determined syntax for the button callback is "void fnButtonClick(DBE xButton) {}". The only variable passed to the callback is the button DBE (which is worthless....EDIT: well, almost worthless... you can use setParent and make the listView the parent of the button; then within the callback, you can use getParent to get the parent of the button, i.e., the listView). There is no way to pass in another DBE, such as the listView. The attached code shows a listView with some callbacks. If is possible to declare the listView and the set(listSelect,listDeselect,listActivate) callbacks locally within some function, as long as you attach the callbacks to the list view within the same function. This works because these callbacks pass in the listView you want, i.e., these callbacks follow the syntax: "void fnListSelect(DBE xListView, int i)". But, of course, you won't be able to have any other callbacks interact with the listView, because now the listView is a local variable. Edited: 13-Oct-2008 at 23:20 by David Jakad |
|
![]() |
|
![]() |
|
Here is a similar sample, but with the listView declared locally within a function.
You will see this will run you into some issues. With a listView, you must add the columns after you realize the dialog box. But, with the listView declared locally, the only solution is to add the realize() and insertColumn() functions within the same function, because the listView is no longer global. If you need to add anything else to this dialog box, it's going to be difficult. Global DBEs is the basic solution. However, I found that with larger, more-complex dialog boxes (50, 100, 150+ DBEs), it can get difficult to manage all the global variables and all the functions that depend on those global variables. My solution was to create a single global Skip List, declare the DBEs locally, but then "register" these DBEs into that one global Skip List. Then, you can create functions that extract the DBEs from the Skip List. This is essentially the same as declaring all the DBEs globally; however, now you can declare them locally, which allows you to make more-portable functions. |
|
![]() |
|
![]() |
|
Louie and David,
Thanks very much for your comprehensive and valued responses. With a fresh pair of eyes this morning and the benefit of your postings, I realised that I actually had all the constituent elements in place but not in the right order/sequence. The key was in the global declaration of the DB & DBE. Please find attached a snippet of the functioning dxl. It's not pretty but it works! Thanks again Mark ------------------------- mark_williamson@synthesys.co.uk http://www.synthesys.co.uk ---------------------------------------- |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Listview callbacks
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.