LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

je cherche un moyen pour sortir d'une boucle While a l'aide d'un bouton en face avant sous labwindows/CVI 6.0?

bonjour, j'ai cr" une boucle while infini dans ma face arriére .c et je voudrais pouvoire en sortir ou l'arréter avec un bouton placer sur ma face avant .uir
0 Kudos
Message 1 of 2
(2,549 Views)
(I apologize for answering in English. My French is barely good enough to read, impossible to write..)

The answer depends on whether you already have a User Interface panel in your program and how you are processing events for it. There are two possibilities:

Option 1 - RunUserInterface

Using this option, your program would look something like this:

main ()
{
...
panel = LoadPanel (...);
DisplayPanel (panel);
RunUserInterface();
...
}

int done = 0;
void YourFunc (void)
{
while (!done)
{
...
// do your work here
...
}
}

int ButtonCallback (int event, ...)
{
if (event == EVENT_COMMIT)
done = 1;

return 0;
}

If you use this option, you'll have to ass
ociate ButtonCallback with your button in the UI Editor.

Option 2 - GetUserEvent

Using this option, your program would look something like this:

void YourFunc (void)
{
int done = 0;

....
panel = LoadPanel (...);
DisplayPanel (panel);

while (!done)
{
...
// do your work here
...
GetUserEvent (0, &panel, &control);
switch (control)
{
...
case PANEL_YOURBUTTON:
done = 1;
break;
...
}

}
}

I hope this makes sense. If you'd like test this, I'd suggest that you look through some of the simple example programs in samples\userint

Luis
NI
Message 2 of 2
(2,549 Views)