LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, I have a small problem with the uir: I want to change command from the panel to a stop button on the uir. button

Hello,
I have a problem with my uir. I am trying to transferr the respondiblity of closing the uir for the x button in the conrer of the the panel to the stop button on the uit. I tried to do this by chaning the commands in the conttol for the panel. On the portion of the command panel that gives the programmer the optain make the uir refer action to another button, I chosse the command button stop. I also have the panel calling on the callback function quit.
When I tried to make the a callback function stop for the stop function, I recieve an error when running the uir. The error that I recievce is that the server is not intialized. The happe
ns when I press the stop button on the uir. Nothing happans with the start button of the uir.
My questions are the following:

1) What is the best way to add the stop button to the uir?

2) What ways can I avoid using the the callback function (STOP) for the program?

3) Is it possible to tranferr command from the panel to a buttom on the panel (STOP Button) using the data/control panel/information box for the panel?

Thankyou for all of your help, All help is greatly appreacited.

faen9901
0 Kudos
Message 1 of 3
(3,272 Views)
I couldn't make out a lot of what you were saying so I'll just answer your question in general.

If you want any control, such as a button, to stop the user interface, you would just call QuitUserInterface(0) in that callback function. When you create a UIR file, then generate the code for it by selecting Code->Generate->All Code..., you will be asked which controls should call QuitUserInterface, and CVI will automatically insert those function calls in the callbacks for you.

As for the X button in the title bar of the window, that is setup in the panel settings in the UIR editor. Double-click on the panel and you will see a Close Control: entry in the Edit Panel screen. Whatever control is selected here, is the control callback that is executed whe
n the X button on the title bar is pressed. If you select "None" for the Close Control:, the X button on the title bar will not do anything.

Best Regards,

Chris Matthews
National Instruments
Message 2 of 3
(3,272 Views)
Which LW/CVI are you using? For clarity, I understand that the panel callback is named stop, and the STOP button callback is quit. By the way. you may want to use some common notation for callback functions to differentiate them from other functions.

1. Simply add a Command Button and configure it as a STOP (I usually use something like STOPBUTTON as the constant name). Make sure to add a callback function name in the second box down. This should be a unique function, such as exitCB. Then double click the panel and, under the close control pull down, select the STOP button. When you generate the code (I assume you use Generate All Code), just make sure that the main panel is selected to load, and the exitCB is checked in the lower text
box (QuitUserInterface Callbacks). Also make sure that the "Generate WinMain instead of main" is Unchecked.

2. The STOP callback will be generated if you type in a callback for the panel. If you do not want a callback generated for the panel, don't add one in the Callback Function box for the panel. Notice in the example below that I did not enter a callback in the Edit Panel dialog.

3. I assume you mean the Edit Panel dialog. As explained in 1., it is possible.

I am attaching .uir, .h and .c files in LW/CVI 5.5 that does what you request. Create a project and add these files to it. Or create your own .c using the .uir file and the Generate All Code. Compile and run.

Hope this helps.

Craig Leidholm
Download All
Message 3 of 3
(3,272 Views)