wzx304 发表于 2006-4-19 22:10:04

[求助]关于TAB控件的

本人想在TAB控件中显示一个数据的输出,但是函数的路径好象不对,老是调不通.请高手指教啊!

<img src="attachments/dvbbs/2006-4/20064191473811220.bmp" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=\'Click here to open new window\nCTRL+Mouse wheel to zoom in/out\';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=\'hand\'; this.alt=\'Click here to open new window\nCTRL+Mouse wheel to zoom in/out\';}" onclick="if(!this.resized) {return true;} else {window.open(\'attachments/dvbbs/2006-4/20064191473811220.bmp\');}" onmousewheel="return imgzoom(this);" alt="" />
程序段如下:
#include <cvirte.h>
#include <userint.h>
#include "SHUCHU.h"
static int panelHandle;
int PANEL_TABPANEL_SHUCHU;
int TAB;
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "SHUCHU.uir", PANEL)) < 0)
return -1;
DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
return 0;
}
int CVICALLBACK XIANSHICALLBACK (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{

int value;
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal (PANEL, PANEL_SHURU, &value);
SetCtrlVal (PANEL, PANEL_SHUCHU, value);
SetCtrlVal (PANEL, PANEL_TABPANEL_SHUCHU, value);

   break;
}
return 0;
}
int CVICALLBACK QUITCALLBACK (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
   QuitUserInterface (0);
   break;
}
return 0;
}
调试错误如下::
NON-FATAL RUN-TIME ERROR:   "SHUCHU.c", line 33, col 9, thread id 0x00000F74:   Library function error (return value == -13 ). Invalid control ID
请高手指点啊?????????????????

cpubbs 发表于 2006-4-20 17:22:11

它这里提示说某一个控件的无效!你双击这个出错提示的地方,看它停留在哪个地方出错呢?

cpubbs 发表于 2006-4-20 17:35:17

<P>我刚才做了一下试验,是可以的,没有出错,但是显示在TAB里面的NUMERIC不行,需要改你的这句话:</P>
<P>SetCtrlVal (PANEL, PANEL_TABPANEL_SHUCHU, value);<BR></P>
<P>这里的第一个panel需要更改为你的TABPANEL,因为我不知道你的TABPANEL定义为什么名字,这里我将我的程序贴出来,如下:</P>
<P>#include &lt;cvirte.h&gt;<BR>#include &lt;userint.h&gt;<BR>#include "cpubbs_tab.h"</P>
<P>static int panelHandle;</P>
<P>int main (int argc, char *argv[])<BR>{<BR> if (InitCVIRTE (0, argv, 0) == 0)<BR>return -1; /* out of memory */<BR> if ((panelHandle = LoadPanel (0, "cpubbs_tab.uir", PANEL)) &lt; 0)<BR>return -1;<BR> DisplayPanel (panelHandle);<BR> RunUserInterface ();<BR> DiscardPanel (panelHandle);<BR> return 0;<BR>}</P>
<P>int CVICALLBACK cpubbs_display_callback (int panel, int control, int event,<BR>void *callbackData, int eventData1, int eventData2)<BR>{<BR> int cpubbs_input_data;<BR> switch (event)<BR> {<BR>case EVENT_COMMIT:<BR>   GetCtrlVal (panelHandle, PANEL_INPUT_NUMERIC, &amp;cpubbs_input_data);<BR>   SetCtrlVal (panelHandle, PANEL_outNUMERIC, cpubbs_input_data);<BR>   //SetCtrlVal (panelHandle, TABPANEL_TABNUMERIC, cpubbs_input_data);<BR>   SetCtrlVal (TABPANEL_TABNUMERIC, TABPANEL_TABNUMERIC, cpubbs_input_data);</P>
<P>   break;<BR> }<BR> return 0;<BR>}</P>
<P>int CVICALLBACK quit (int panel, int control, int event,<BR>void *callbackData, int eventData1, int eventData2)<BR>{<BR> switch (event)<BR> {<BR>case EVENT_COMMIT:<BR>   QuitUserInterface (0);<BR>   break;<BR> }<BR> return 0;<BR>}<BR></P>

cpubbs 发表于 2006-4-20 17:36:09

对了兄弟,上传前把图片保存成JPG或JPEG格式,比BMP小很多,打开和上传的速度都会比较快的,BMP体积大,打开慢些!

wzx304 发表于 2006-4-20 19:36:11

<P>十分感谢版主,照你的方法,我已调试成功这个程序。这是我的设计的简化版,但是实际的我整个上午还是没调试通过,同样的错误。我都快气炸了。再次感谢版主!</P>

wzx304 发表于 2006-4-20 21:47:27

哦。错了。不是斑竹啊,不好意思。总之,感谢!

cpubbs 发表于 2006-4-21 07:41:35

呵呵,没关系的!怎么叫都可以,欢迎有空常来CPUBBS论坛玩,也多介绍朋友们过来玩哈,谢谢支持!
页: [1]
查看完整版本: [求助]关于TAB控件的