On 02/06/2014 at 05:46, xxxxxxxx wrote:
Cinema 4D Version: R15 Stud
Platform: Mac OSX ;
Language(s) : C++ ;
What do SizeChr, SizePix and SizePixChr do? I don't understand what the documentation means when it says... "Bakes a pixel size" and "Bakes a character count". Is it trying to help with average pixels per character for dialog sizing?
Documentation extract follows...
> #### Int32 SizePixChr(Int32 pixels, Int32 chars)_<_h4_>_
> Combines the _s">SizePix() and _chars">SizeChr() functions. The returned value is interpreted as a number of characters/lines plus a number of p_<_h5_>_s.
> #### Int32 Siz_<_h4_>_Int32 pixels)
> Bakes a pixel size so that it can be used to specify dialog co_<_h5_>_l dimension.
> #### _<_h4_>_32 SizeChr(Int32 chars)
> Bakes a character count so that it can be used to specify dialog control dimension. (How many characters that will fit in a control for widths, and how many standard lines that will fit for heights.)
On 02/06/2014 at 13:45, xxxxxxxx wrote:
I think these functions are just simple type converters. And that's all they do.
SizeChr() converts chars to integers.
SizePix() converts pixels to integers.
On 03/06/2014 at 00:52, xxxxxxxx wrote:
These functions help specifying gadgets dimension in dialog layout.
SizePix() converts a number of pixels to a dialog gadget dimension.
SizeChr() converts a number of characters to dialog gadget dimension.
Note that you have to multiply the number of passed characters by 10 (see example below). This information is missing in the documentation.
SizePixChr() combines SizePix() and SizeChr() i.e. it's the same than calling: SizePix()+SizeChr().
// Adds a statictext for 4 characters
AddStaticText(0, BFH_LEFT, SizeChr(40), 0, "Text", BORDER_BLACK);
// Adds a statictext 100 pixels wide
AddStaticText(0, BFH_LEFT, SizePix(100), 0, "Text", BORDER_BLACK);
// Add a statictext 100 pixels + 4 characters wide
AddStaticText(0, BFH_LEFT, SizePixChr(100, 40), 0, "Text", BORDER_BLACK);
On 03/06/2014 at 04:26, xxxxxxxx wrote:
Thanks for the information Yannick.
I had tried to use SizeChr and had assumed it was trying to estimate the width necessary for n chars. Unfortunately without the 10x factor I didn't understand the result. It makes sense now. From my experience with MS Windows, I'd guessed it served the same purpose as Dialog Base Units.
One question though...
As far as I know the initw/h sizes for gadgets are specified in pixels. What does SizePix do since it takes one parameter (the number of pixels) and returns the size in pixels? Or am I mistaken in my understanding of the initw/h parameters? If I am mistaken, what units are they in?