03-21-2013 08:52 PM
Hello,
Now I was presented with a confused problem. When I design the interface, all the command buttons are useful. Now I add some graph-drawing code and begin to compile the program, the command buttons are all disabled. Can you tell me the reason? whether did the callback function be called?
Thank you for your answer.
03-22-2013 01:17 AM
I would assume that something with your UI constants may have gone wrong. Did you modify the UI include file manually? Can you provide a short sample showign the problem?
03-22-2013 01:52 AM
I didn't modify the UI include file. It occured only when I compiled all the code , it has not this problem when complied seperately.And I am sorry I don't know how to show you a sample, it is too complex. Does it have other reasons?
03-24-2013 05:41 PM
If it's too complex for you to narrow down the code to a limited version that exposes the misbehaviour, it may well be too complex for us to guess what's happening!
You may start explaining the difference between "compile all" and "compile separately": are you creating or integrating libraries in your app? Or what you mean by that?
03-25-2013 03:41 AM
like this, the command control's callback function is ClosePanel, when click it, this panel will be closed. Now when running the program and clicking the button, there's no response. And the panel has been defined to be run.
The callback function is:
int CVICALLBACK ClosePanel (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
DiscardPanel(run);
break;
}
return 0;
}
03-25-2013 03:52 AM
A general hint: use and evaluate the return value of functions, they can give you a clue of what might be wrong, i.e. use
status = DiscardPanel ( panel_handle );
if ( status < 0 ) // check for error
Is your application multi-threaded? DiscardPanel must be called from the thread that created the panel.
03-25-2013 04:48 AM
I second wolfgang hint on error trapping. Which value has the variable 'run'? How is defined? If the variable value is incorrect you are likely to receive an error and the function won't do what you expect it to do.
Are you aware that every control callback automatically receives the handle of the owning panel in 'panel' variable? Your code could then be modified in DiscardPanel (panel);