edittable cell height (OpenInsight Specific)
At 25 MAR 1999 04:50:00PM brian wick wrote:
Is there any way to determine the cell height in an edit table ?
As far as I know, the only way to change the height is by changing the font of the column headers…but I have no way of knowing the new height of the box.
What I am after is what I thought the LIMIT property could do.
Example: I have 15 rows of edittable data I only want to display the first 4 rows. My Cell height differs based on the font used.
Any ideas ? tx Brian
At 26 MAR 1999 09:36AM Oystein Reigem wrote:
Brian,
I'm not quite certain what you want to do, but assume it's something like your program at runtime might set or change the font (size) of the edit table, whereafter the program needs to know the new height of each cell, so it can resize the edit table accordingly.
There is a way you can find the height in pixels of text displayed in a certain font. Then if the extra cell space above and beneath the text is independent of the font size, you're in luck. You ought to check that first.
Here is some code for finding pixel height of text I got from Don Bakke. Or was it Dave Pociu?:
function TextWidthAndHeight( Text, Font )
/*Calculates the width and height in pixelsof a text Text shown in font Font.Font must be like the value that CHOOSEFONT would return.Or you can get it with Font=Get_Property( ..., "FONT" ).
/declare function Utilityequ DT_CALCREC$ to 1024equ DT_WORDBREAK$ to 16 /* (not used) */Rect=Utility( "TEXTRECT", "", Text:@FM:(0+DT_CALCREC$):@FM:@FM:Font ) /* (= width:@FM:height) */return Rect
I think got the code originally with
Rect=Utility( "TEXTRECT", "", Text:@FM:(0+DT_CALCREC$+DT_WORDBREAK$):@FM:WWWW:@FM:Font )where the WWWW was the width of a rectangle where you wanted to show the text. You see Utility TEXTRECT can handle line wrapped text. But you don't need that for your pourpose. I just mention it in case… …erm… …for reasons of intellectual rights or something.
I don't think it matters what characters you feed the function with. E.g I don't think it needs to contain characters extending beneath the baseline.
- Oystein -
At 26 MAR 1999 01:18PM Brian Wick wrote:
Oystein,
Worked like a charm. Tx for the idea. Somehow I missed it in the manual. I appreciate all the help……tx..Brian