原创 Labwindows/cvi8.5 直接创建菜单

2010-6-12 14:00 4896 7 7 分类: 软件与OS

//*********************************************************
// Labwindows/cvi8.5 菜单的使用
// 使用 Edit---Menu Bar...直接创建菜单
// szlihongtao
// 2010-06-11
// 参照 王建新的<Labwindows/cvi测试技术及工程应用> page51
// 稍有改写
//*********************************************************
#include <utility.h>
#include <cvirte.h>  
#include <userint.h>
#include "calc.h"
//*********************************************************
static int panelHandle;
//*********************************************************
int main (int argc, char *argv[])
{
 if (InitCVIRTE (0, argv, 0) == 0)
  return -1; /* out of memory */
 if ((panelHandle = LoadPanel (0, "calc.uir", PANEL)) < 0)
  return -1;
 DisplayPanel (panelHandle);
 RunUserInterface ();
 DiscardPanel (panelHandle);
 return 0;
}
//*********************************************************
int CVICALLBACK panelcb (int panel, int event, void *callbackData,
  int eventData1, int eventData2)
{
 int MenuBarHandle;
 switch (event)
 {
  case EVENT_RIGHT_CLICK:
  { 
   MenuBarHandle=GetPanelMenuBar (panelHandle);
   
   // 设置弹出式菜单
   RunPopupMenu (MenuBarHandle, MENUBAR_EDIT, panelHandle, eventData1, eventData2, 0, 0, 0, 0);
   break;
  } 
  case EVENT_CLOSE:
  {  
   QuitUserInterface (0);
   break;
  }
 }
 return 0;
}
//*********************************************************
int CVICALLBACK cmd_dig (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:
  {
   // control为对应控件的值
   if ((control<=PANEL_CMD_9)      
    &&(control>=PANEL_CMD_0))   
    SetCtrlVal(panel,PANEL_NUMERIC_DIG,control-2);  
   break;   
  }
 }
 return 0;
}
//*********************************************************
int CVICALLBACK cmd_sqrt (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:   
   break;
 }
 return 0;
}
//*********************************************************
int CVICALLBACK cmd_div (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:  
   break;
 }
 return 0;
}
//*********************************************************
int CVICALLBACK clear (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:  
   break;
 }
 return 0;
}
//*********************************************************
int CVICALLBACK cmd_percent (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:


   break;
 }
 return 0;
}
//*********************************************************
int CVICALLBACK cmd_mul (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:  
   break;
 }
 return 0;
}
//*********************************************************
int CVICALLBACK cmd_daoshu (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:


   break;
 }
 return 0;
}
//*********************************************************
int CVICALLBACK cmd_equal (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:


   break;
 }
 return 0;
}
//*********************************************************
int CVICALLBACK cmd_minus (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:


   break;
 }
 return 0;
}
//*********************************************************
int CVICALLBACK cmd_plus (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:


   break;
 }
 return 0;
}
//*********************************************************
int CVICALLBACK cmd_dot (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:


   break;
 }
 return 0;
}
//*********************************************************
void CVICALLBACK editcopy (int menuBar, int menuItem, void *callbackData,
  int panel)
{
}
//*********************************************************
void CVICALLBACK editalwaystop (int menuBar, int menuItem, void *callbackData,
  int panel)
{
}
//*********************************************************
void CVICALLBACK editexit (int menuBar, int menuItem, void *callbackData,
  int panel)
{
}
//*********************************************************
void CVICALLBACK helpabout (int menuBar, int menuItem, void *callbackData,
  int panel)
{
}
//*********************************************************
//*********************************************************
//*********************************************************

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
7
关闭 站长推荐上一条 /3 下一条