Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

default button for mode specific menu

Sanjay Meher

New member
Hi developers


This question is related to Pro/Toolkit of Pro/Engineer 2001


I am learning to develop mode specific menu in Pro/E through Pro/Toolkit.
Now in most of the menu of Pro/E there is a default button which gets selected when middle mouse button is pressed. For e.g. Feature in "Part" Menu


I want to implement the same functionality in my menu. Can any one help me to achieve it.





The Code I am using is as follows :






ProError Action(void *a, int b)
{
ProError status;


status = ProMessageDisplay(L"Menu.txt", "Action Button is clicked");


ProMenuDelete();

return (PRO_TK_NO_ERROR);
}


ProError AddMainMenu()
{
int menuId,action;


ProMenuFileRegister ("newmenu", "newmenu.mnu", &menuId);


ProMenubuttonActionSet ("newmenu", "Action1", (ProMenubuttonAction)Action,NULL, 0);


ProMenubuttonActionSet ("newmenu", "Action2", (ProMenubuttonAction)Action, NULL, 0);


ProMenubuttonActionSet ("newmenu", "Action3", (ProMenubuttonAction)Action, NULL, 1);


ProMenubuttonActionSet("newmenu", "newmenu",(ProMenubuttonAction)ProMenuDelete, NULL, 0);


ProMenuCreate (PROMENUTYPE_MAIN, "newmenu", &menuId);


ProMenuProcess ("newmenu", &action);


return (PRO_TK_NO_ERROR);


}



static uiCmdAccessState TestAccessDefault(uiCmdAccessMode access_mode)
{
return (ACCESS_AVAILABLE);
}


int user_initialize (int argc, char* argv [], char* proe_version, char* build_code)
{
uiCmdCmdId cmd_id,
ProError status;


status = ProCmdActionAdd ("MenuAction", (uiCmdCmdActFn)AddMainMenu,
uiProe2ndImmediate, TestAccessDefault,
PRO_B_TRUE, PRO_B_TRUE, &cmd_id);


status = ProMenubarmenuPushbuttonAdd ("File", "MenuAction", "MenuAction",
"Adds new Menu", "File.psh_backup",
PRO_B_TRUE,cmd_id, L"Menu.txt");


return (PRO_TK_NO_ERROR);
}


void user_terminate ()
{


}



Files are


Menu.txt :
[start]
MenuAction
Add New Menu
#
#
Adds new Menu
Adds new Menu
#
#
Action Button is clicked
Action Button is clicked
#
#
[end]





newmenu.mnu :
[start]
newmenu



Action1
Click for action1


Action2
Click for action2


Action3
Click for action3


[end]


Let say I want to make Action1 as the default button.



Thanks


bye
Abhishek
 

Sponsor

Articles From 3DCAD World

Back
Top