LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

command button disable

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.

0 Kudos
Message 1 of 7
(3,772 Views)

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?

0 Kudos
Message 2 of 7
(3,758 Views)

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?

0 Kudos
Message 3 of 7
(3,753 Views)

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?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 7
(3,726 Views)

未命名.jpg

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;
}

0 Kudos
Message 5 of 7
(3,717 Views)

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.

0 Kudos
Message 6 of 7
(3,713 Views)

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);



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 7 of 7
(3,703 Views)