LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the User Interface without drawing

Hello,
 
I'm having the following problem. I am updating table cell values (table = 16 x 16) in a for-loop. I noticed that it takes a lot of time for CVI to update these cell values. I think this is because CVI redraws the table after each SetTableCellVal function call. Is there any way I can stop CVI from refreshing the table before the for-loop, and then refresh the table after the for-loop. I paste a part of my code to make clear what I mean:
 
---------------------------------------------------------------------------------------------------------------------
 // --> I would like to stop drawing here.
 
 // Update the table.
 for (col_cntr = 1; col_cntr <= 16; col_cntr++){
     for (row_cntr = 1; row_cntr <= 16; row_cntr++){
         switch (table_view){
             case TBL_DEC:
                 Fmt (value_str, "%i[w3p ]", eprom.byte[(col_cntr-1)*16 + (row_cntr - 1)]);
                 break;
            case TBL_HEX:
                Fmt (value_str, "%x[w2p0]", eprom.byte[(col_cntr-1)*16 + (row_cntr - 1)]); 
                StringUpperCase (value_str);
                break;
         }
         SetTableCellVal (tabTable, table_ctrl, MakePoint (row_cntr, col_cntr), value_str);
     }
 }
 
 // --> I would like to start drawing here.

---------------------------------------------------------------------------------------------------------------------
 
Wim
0 Kudos
Message 1 of 8
(3,984 Views)

Wim, you could approach this item in two ways.

1. Use SetTableCellRangeVals passing the whole array of measures to display instead of updating cells one by one. This approach works if all cells to update are contiguous

2. Hide the table before the loop and display it after: digging in my memory I seem to remember that it can speed up cell update. I'll try to search in the forum a thread about it.



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?
Message 2 of 8
(3,976 Views)
Wim,

Try using SetTableCellAttribute with ATTR_CTRL_VAL.  From the function panel help for the attibute:

Using this in SetTableCellAttribute or SetTableCellRangeAttribute is equivalent to calling the SetTableCellVal or SetTableCellRangeVals functions, except that the cell does not display the value until LabWindows/CVI processes draw events.
Note: If the table control in which you are setting a cell value is the active control in the panel, the cell nevertheless displays the value immediately.

The last note suggests that you need to temporarily give the focus to a different control (via SetActiveCtrl) if your table is active in order to ensure you don't get a redraw on every update.

Hope this works for you.

Mert A.
National Instruments
Message 3 of 8
(3,975 Views)
<duplicate removed>

Message Edited by Mert A. on 03-14-2006 10:33 AM

0 Kudos
Message 4 of 8
(3,979 Views)

Got it! Smiley Wink The third answer from LuisG in this thread clarify both Mert and my suggestions.

Hope this helps
Roberto



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 5 of 8
(3,972 Views)

Hello,

using the ATTR_CTRL_VAL Attribute seems to work great.  Now I see all table cell values change at the same time instead of one by one. Thanks a lot for your help Mert and Roberto Smiley Happy

0 Kudos
Message 6 of 8
(3,969 Views)
Just to clarify

A one star rating means that the answer was not satisfactory. 5 stars would imply the answer was exceptional.

I didnt see anything "bad" with Mert's duplicate post (besides that it's a duplicate) and Roberto's post, so I dont know why they got a one star for that. Roberto's post should get atleast a 4 in terms of usefullness.

I've seen people of the forums getting confused about this sometimes, so I'm calling this out as a neutral bystander 🙂

I've spoken my peace.

Thanks


Bilal Durrani
NI
0 Kudos
Message 7 of 8
(3,943 Views)

Hello Bilal,

I noticed my mistake but I don't find any way to adjust it. To compensate, I gave Roberto and Mert's first posts 5 stars.

I'm really sorry for mymistake. I was very happy with Roberto's and Mert's responses...

0 Kudos
Message 8 of 8
(3,940 Views)