LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

collapsible regions do not always work properly in CVI2009

Solved!
Go to solution

Hi,

 

I regulary encounter the fact that within the CVI editor, the + marks indicating a collapsible region do not show at all or at the wrong position, indicating that the refresh is working too slow or not at all. I am attaching a sample picture. The red region indicates that there should be a plus sign because some minutes ago I had collapsed the corresponding if structure which now is gone. I cannot make it appear again without restarting CVI.

 

Wolfgang

 

 

 

editor_bug.png

 

 

0 Kudos
Message 1 of 18
(4,481 Views)

What happens if you do "expand all" from the   View -> Collapsible Regions ->  expand all     pull-down menu.

 

Menchar

0 Kudos
Message 2 of 18
(4,462 Views)

Hi Menchar,

 

Thanks for pointing me to the View menu, I wasn't aware of this new entry... I will try it the next time I encounter this behavior and let you know.

 

In the mean time, I can add some more information:

 

1) It appears to me that the collapse indicators are refreshed only after the cursor reaches the corresponding line, see the figure below

 

collapse_2.jpg

 

Obviously, the markers are misplaced (because I have scrolled the window which did not get repainted); the markers only disappear if I move the cursor to or beyond the line showing the marker; i.e. the marker remains in its position while the code is scrolled, and the marker position is updated only later

 

2)Using the newly discovered Collapse all from the View menu almost all regions are collapsed, except one, see below:

 

collapse_3.jpg

 

so all functions have been collapsed and I can see no reason why this QuitCalback function did not get collapsed, too. The code is fine without any errors.

 

Any ideas?

 

Wolfgang

0 Kudos
Message 3 of 18
(4,442 Views)

Nope.  Can't explain it.  I did a collapse all in one of my modules with 20+ functions and every one of them collapsed, included the ones that were commented out.  Exapnsion works OK too.

 

Maybe a cut and paste carried some sort of region tag with it that has the region logic goofed up.

 

I am using CVI 9.1.0 (427)

 

 

0 Kudos
Message 4 of 18
(4,418 Views)

Hi Menchar,

 

thanks for looking into it. I am using the same CVI version as you do. I tried the same procedure on my computer at home where I encounter the same problem, see below. Btw, I am not aware of any region tags in my code.

 

collapse.jpg

 

 

 

 

0 Kudos
Message 5 of 18
(4,410 Views)

Wolfgang -

 

That function is collapsed - the collapsed region is bounded by the curly braces,  what's making it look funny is that for that second callback you've got the function definition spread across several lines due to the parameters being one per line.

 

Menchar

0 Kudos
Message 6 of 18
(4,406 Views)
No, I'm wrong .. doesn't work that way - I see the icon jumps up to the function definition even if I create the block first then add the function definition so I am unable to fool CVI into duplicating what you've posted. 
0 Kudos
Message 7 of 18
(4,400 Views)

I did it :

 

 

int CVICALLBACK QuitCallback ( int panel,
    int control,
    int event,
    void *data,
    int event1,
    int event2)     { return 1;}

{
   
}

 

in this case the region icon is not on the function but rather on the unrelated block below it.   So unless you've got a function block spanning more than one line it doesn't get collapsed or exapnded.

 

In a pure block, 

{

}

 

will not collapse, but

 

func (int param) 

{

}

 

will.

0 Kudos
Message 8 of 18
(4,401 Views)

Hi Menchar,

 

Thanks! Still I am not sure that my problem is what you found out...

 

OK, here is the structure of the function and I have to say: collapsing works under one certain condition: this condition is that I remove the preceding function.... In other words, the collapse algorithm already is confused when arriving at this function...

 

So what makes the collapse algorithm getting confused? After this new insight I have to say: the preceding StartCallback is a function with more than 3000 lines - so I presume that some CVI internal stack taking care of opening and closing braces might have suffered an overflow. Hence it would be nice to hear some opinion from NI 🙂

 

 

 

int CVICALLBACK QuitCallback ( int panel,
                               int control,
                               int event,
                               void *callbackData,
                               int eventData1,
                               int eventData2 )
{
    if ( __ )
    {
        if ( __ )
        {
            ;

            if ( __ )
            {
                ;    
            }
            QuitUserInterface ( 0 );
        }
        else
        {

         ;
        }
    }
    return ( 0 );
}

0 Kudos
Message 9 of 18
(4,384 Views)

Sounds like that might be the problem, the collapse algorithm can't tell that the QuitCallback function isn't part of the preceding function maybe because it's overflowed its ability to track nested blocks.

 

I wouldn't hold my breath waiting for NI - this problably isn't a burning platform issue for them.

 

 

Menchar

0 Kudos
Message 10 of 18
(4,370 Views)