Skip to main content
1-Visitor
March 24, 2016
Question

Exiting a ProMousePick() loop to exit a dialog

  • March 24, 2016
  • 1 reply
  • 1338 views

I have inherited a application which creates a ProUIDialog. One of the pushbuttons activates a loop to allow the user to select items from a 3D display list.

The code for the mouse pick is:

while(1) {

status = ProMousePickGet (PRO_ANY_BUTTON, &button, screen_pt);

if ( button == PRO_MIDDLE_BUTTON || status != PRO_TK_NO_ERROR ) break;

...

}

Picking the middle mouse button exits the loop and makes the dialog active again. Is there any way to set the dialog cancel button (red X) to be enabled? I set ProUIDialogCloseActionSet() but when in the loop, picking the cancel button just rings a bell.

Any ideas?

Thanks,

Bob

    1 reply

    March 28, 2016

    Hi all,

    Bob,

    Without knowing how the loop is constructed it is a shot in a dark...

    I would either insert a dialog close statement in a button check block:

    if( button == PRO_MIDDLE_BUTTON ... ) {

         ProUIDIalogUnload(); // check spelling

         break;

    }

    or use a static module level variable which would be set depending on button pressed and an observer within a dialog code to react on a variable value.

    HIH.

    Feliks.