wb_get_size

array wb_get_size (mixed object [, bool param])

Gets the dimensions of a control, window, image or string. The image handle must have been obtained with wb_create_image(), wb_create_mask() or wb_load_image().

This function generally returns an array where the first element is the width and the second is the height. Measurements are in pixels. If param is TRUE, the area returned will not include the title bar and borders. Default is FALSE. The function will return the integer WBC_MINIMIZED instead of an array if the requested window is minimized, or NULL on error.

If object is a ListView handle and param is TRUE, the function returns an array with the widths of the column headers. If param is omitted or FALSE, the function behaves normally like described above

If object is a text string, param is optionally used to pass the handle to a font created with wb_create_font(). If param is null or not used, the default font is used.

Object types accepted

object may be one of the following:

Example

// Obtain and print out various dimensions

define("PATH_RES", "../resources/");

// Get bitmap dimensions

print_r(wb_get_size(PATH_RES . "toolbar.bmp"));
$img = wb_load_image(PATH_RES . "toolbar.bmp");
print_r(wb_get_size($img));

// Get icon dimensions

$img = wb_load_image(PATH_RES . "ttf.ico");
print_r(wb_get_size($img));
print_r(wb_get_size(PATH_RES . "ttf.ico"));

// Get window dimensions

$mainwin = wb_create_window(NULL, PopupWindow, "Tests", 530, 320);
print_r(wb_get_size($mainwin));

// Get control dimensions

$label = wb_create_control($mainwin, Label, "", 10, 20, 120, 20);
print_r(wb_get_size($frame));

// Get column widths of a ListView

print_r(wb_get_size($list, true));

// Get the size of a text string, in pixels

print_r(wb_get_size(wb_get_text(wb_get_control($window, ID_TEXT)))); 

See also

wb_create_image
wb_create_mask
wb_load_image
wb_get_position
wb_set_size
wb_create_font
Image functions
Control functions
Window functions