Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Ross Morgan, on Thursday, September 16, 2004 7:29 AM

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).
 10-Sep-2004 14:35
User is offline View Users Profile Print this message


Dave Robbins

Posts: 36
Joined: 9-Dec-2003

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
Report this to a Moderator Report this to a Moderator
 14-Sep-2004 13:16
User is offline View Users Profile Print this message


Ross Morgan

Posts: 74
Joined: 15-Apr-2004

Answer 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).
Report this to a Moderator Report this to a Moderator
 16-Sep-2004 07:29
User is offline View Users Profile Print this message


Dave Robbins

Posts: 36
Joined: 9-Dec-2003

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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 0 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.