Skip to main content

[archive] Grid columns width

  • September 26, 2008
  • 1 reply
  • 0 views

[Migrated content. Thread originally posted on 09 September 2008]

I wrote acu code to implement a "combo" inside a cell grid.

Using a floating windows without border and system menu, containing a simple grid displayed at x,y pixel coordinates where the specific cell is clicked I simulate the combo function. I don't use a list-box because it's impossible to catch the different events of Mouse Click and MsgValidate of up/down arrow.

I succesfully compute exact y pixel for the correct row computing screen line of the window grid line * cell height height of textsize("0") * row separation row divider spacing.

But my problem is to find exact x pixel.

My form and my grid use MS Sans Serif 10 Normal font.

Using width of textsize("0") units, I get unexpected values compared to real cell width.
Example: a 3 column width cell is exact 23 pixel on screen, while a 32 column width cell is 255.
Using textsize("000") I obtain 21 and texsize("00000000000000000000000000000000") = 224.

So, I've tried some compensation like this:
Using textsize(str) using a substring of this special string
str = "0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".
I got more approssimated results, but not exact pixel.

My question is:
Wich algoritmn Acu runtime use to compute exact cell pixel coordinates and widths?

Thank's in advance.
Maurizio Barbagin

1 reply

[Migrated content. Thread originally posted on 09 September 2008]

I wrote acu code to implement a "combo" inside a cell grid.

Using a floating windows without border and system menu, containing a simple grid displayed at x,y pixel coordinates where the specific cell is clicked I simulate the combo function. I don't use a list-box because it's impossible to catch the different events of Mouse Click and MsgValidate of up/down arrow.

I succesfully compute exact y pixel for the correct row computing screen line of the window grid line * cell height height of textsize("0") * row separation row divider spacing.

But my problem is to find exact x pixel.

My form and my grid use MS Sans Serif 10 Normal font.

Using width of textsize("0") units, I get unexpected values compared to real cell width.
Example: a 3 column width cell is exact 23 pixel on screen, while a 32 column width cell is 255.
Using textsize("000") I obtain 21 and texsize("00000000000000000000000000000000") = 224.

So, I've tried some compensation like this:
Using textsize(str) using a substring of this special string
str = "0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".
I got more approssimated results, but not exact pixel.

My question is:
Wich algoritmn Acu runtime use to compute exact cell pixel coordinates and widths?

Thank's in advance.
Maurizio Barbagin
hi, try this.