Objective Grid: Setting column widths based on string size

Article ID: 692
Last updated: 11 Jun, 2018
Article ID: 692
Last updated: 11 Jun, 2018
Revision: 3
Views: 3059
Posted: 23 Jan, 2001
by Meltreger B.
Updated: 11 Jun, 2018
by Meltreger B.

Problem


How do I set the column widths based on the size of my strings?


Cause



Action


You can call:

m_pGrid->SetColWidth(nCol, nCol, m_pGrid->Width_LPtoDP(nChars * GX_NXAVGWIDTH));

where nChars is the number of characters in the string and GX_NXAVGWIDTH is the average width of a character.

Another possibility is to override GetColWidth(). See gridapp/browsevw.cpp for an example.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 692
Last updated: 11 Jun, 2018
Revision: 3
Views: 3059
Posted: 23 Jan, 2001 by Meltreger B.
Updated: 11 Jun, 2018 by Meltreger B.

Others in this category