![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Callbacks in Menus for Formal Module Topic Summary: Created On: 10-Sep-2004 14:35 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: the function alwaysOn_astrium() is defined in the same piece of DXL which is defining the menu, so after this piece of DXL is run it is no longer in memory. At a later stage when you select the menu - the alwaysOn_astrium() function is not available so you get the error. its the same as loading DXL into the DXL editor, running it, then loading some different DXL and expecting the declarations in the original DXL to still be available. what you need to do is to define the callback in the global DXL context so that the function persists for the duration of your session. You can do this by putting it in startupfiles, or even better, baseWindowMenuCallbacks. the main difference between these two is that startup DXL can pop up GUI elements, but baseWindowMenuCallbacks is just for global functions. Also, callbacks for base window menu definitions must go in baseWindowMenuCallbacks. p.s no need to edit startup.dxl or init.dxl etc, the autorun directories are all you need (and they'll save you from lots of potential hassle when you upgrade). | |
![]() |
|
We are setting up some context sensitive for Formal Modules ( DOORS V7.1_003 )
created a menu file in ~\lib\dxl\config\formalFiles as follows: ////////////////////////////////////////////////////////////// // callback int alwaysOn_astrium(){ return menuAvailable_ } // menus const string MENU_TITLE = "Astrium" // menu items const string HELP_A_ITEM = "Help" // status bar messages const string HELP_A_DESC = "Provides specific help for Users" const string INACTIVE_MESSAGE = "Insufficient privileges to run this function" const string HELP_A_PATH = "addins/help/help.dxl" // Build Formal Module menu void createAstriumMenu(){ createMenu(alwaysOn, MENU_TITLE, null, null) // help menu ( available to everyone ) //createItem(alwaysOn, HELP_A_ITEM, null, null, modKeyCtrl, null ,null, HELP_A_DESC, INACTIVE_MESSAGE, HELP_A_PATH) createItem(alwaysOn_astrium, HELP_A_ITEM, null, null, modKeyCtrl, null ,null, HELP_A_DESC, INACTIVE_MESSAGE, HELP_A_PATH) end menu // end of Menu } // end createAstriumMenu createAstriumMenu() // With line 25 'alwaysOn_astrium ( own callback ) get: -R-E- DXL: <Line:0> incorrect return statement // Use alwaysOn all OK ////////////////////////////////////////////////////////////// get error: -R-E- DXL: <Line:0> incorrect return statement If I use 'alwaysOn' as the callback in the createItem all works OK, but using my own calback ( alwaysOn_astrium() ) get the error??? Q. Has anyone successfully got callbacks to work from menus placed in ~\lib\dxl\config\formalFiles ? any help greatfully received, Dave ------------------------- Dave +44 (0)23 9270 5711 david.robbins@astrium.eads.net ~~~~~~~~~~~~~~~~~~~~ EADS Astrium, Anchorage Road Portsmouth. Hampshire. UK PO3 5PU |
|
![]() |
|
![]() |
|
the function
alwaysOn_astrium() is defined in the same piece of DXL which is defining the menu, so after this piece of DXL is run it is no longer in memory. At a later stage when you select the menu - the alwaysOn_astrium() function is not available so you get the error. its the same as loading DXL into the DXL editor, running it, then loading some different DXL and expecting the declarations in the original DXL to still be available. what you need to do is to define the callback in the global DXL context so that the function persists for the duration of your session. You can do this by putting it in startupfiles, or even better, baseWindowMenuCallbacks. the main difference between these two is that startup DXL can pop up GUI elements, but baseWindowMenuCallbacks is just for global functions. Also, callbacks for base window menu definitions must go in baseWindowMenuCallbacks. p.s no need to edit startup.dxl or init.dxl etc, the autorun directories are all you need (and they'll save you from lots of potential hassle when you upgrade). |
|
![]() |
|
![]() |
|
Many thanks Ross, that makes sense.
Rather than use Callbacks, I have now just got simple if-elses to create a menu item ( or not ) and/or change its display (on or greyed-out etc ). I want to minimise the files I have to deploy to the client & so far just got 3. These contain just simple #includes to point to a server whose location is defined in the Registry. This way we can deploy a universal Client and any Server moves are coped with by a deployment of a new .reg file. warm regards, Dave ------------------------- Dave +44 (0)23 9270 5711 david.robbins@astrium.eads.net ~~~~~~~~~~~~~~~~~~~~ EADS Astrium, Anchorage Road Portsmouth. Hampshire. UK PO3 5PU |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Callbacks in Menus for Formal Module
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.