LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Table text font size changes in fullscreen (extremly small)

Solved!
Go to solution

I have a table with fixed font size of 11 and font Microsoft YaHei UI. If the panel is not maximized the font looks good. If I maximize the panel, all controls incl. the table are scaled to the new size (looks sometimes weird but its ok). The font seems also be ok, but If I update the table (delete all rows and add new) the font is very tiny. I add a picture of the problem.

 

macksel_0-1763976211144.png

 

 

0 Kudos
Message 1 of 8
(228 Views)

Looks like a strange effect of panel scaling during resize: you can exclude panel scaling by unchecking Scale Contents On Resize checkbox in Other Attributes... window i panel settings, or programmatically by calling SetPanelAttribute with ATTR_SCALE_CONTENTS_ON_RESIZE attribute and value 0.



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 2 of 8
(201 Views)

Thanks for your answer. Scale contents on resize is active, because I want that all controls are scaled, so I cant deactivate it. The table is ony of many controls on the panel.

 

The problem is rather strange somehow because If I maximize the panel the table is fine. But after updating the contents of the table the size is small.

0 Kudos
Message 3 of 8
(186 Views)

An alternative approach to panel scaling could be the use of splitters to define how the panel is changed when its dimensions change. Splitter permits to choose between sizing or moving controls, giving you a more flexible approach to resizing. I personally don't like the effect of rescaling and prefer to use splitters.

 

You can either manually add splitters to your panel and attach controls to them in the UIR editor or you may want to take a look at the good code provided by NickB long time ago:

LabWindows/CVI Tip: Use Splitter Controls to Handle Panel Sizing 



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 4 of 8
(174 Views)

Thanks for the splitter example. I tried to implement it but I cannot use it with my big panel. Because I have lot of different controls and the results are looking very weird. For only few buttons and a graph its ok.

 

 

0 Kudos
Message 5 of 8
(100 Views)

I understand, there may be several possible solutions to almost any problem. The fact is that I don't like the aspect panels take when simply rescaled, so I followed the splitter way short after these controls were added to CVI. For this reason I cannot help you a lot with this problem.

 

A rude approach to it could be to trap the panel size event and:

  • Read actual table columns attributes after the scaling
  • Explicitly reapply those attributes

hoping that this at least avoids that the table font changes after redraw.



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 6 of 8
(95 Views)
Solution
Accepted by topic author macksel

Thanks, this was a good hint. I changed my update table function. This works for me 🙂

 

GetPanelAttribute(panel, ATTR_WINDOW_ZOOM, &iFullscreen);
if (iFullscreen) //Fullscreen Textsize Bugfix/Workaround
   iTextSize = 20;
else
   iTextSize = 11;
 
...
SetTableCellAttribute ( panel, control, MakePoint(1,row), ATTR_TEXT_POINT_SIZE, iTextSize );
SetTableRowAttribute ( panel, control, row, ATTR_LABEL_POINT_SIZE, iTextSize);
0 Kudos
Message 7 of 8
(78 Views)

Great! I'm glad to have helped you.

Pay attention to SetTableRowAttribute (), as it affects only new cells added to the row.

For existing cells in the table you may use SetTableCellRangeAttribute () passing VAL_TABLE_ENTIRE_RANGE macro as the range.



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 8 of 8
(73 Views)