Personal tools
From wiki.swiftlytilting.com
Jump to: navigation, search

WinBinder Manual/wb get control

Returns the handle to a child control in a dialog box or in a menu item

Syntax

int wb_get_control (int wbobject [, int id])

Returns

Returns an integer handle that corresponds to the WinBinder object (control, toolbar item or menu item) wbobject that has the supplied id. This function is typically used to retrieve the handle of a child control in a dialog box or in a menu item.


Examples:
Basic usage. We are refering to the parent control (a window in this case) and the control-id of the child we want to get the handle from.

<?php
 
// the id of our control...
 
define('ID_BUTTON',  200); 
 
 
// which is the child of $mainwin, our window.
 
wb_create_control($mainwinPushButton"My Button"10107020ID_BUTTONWBC_VISIBLE);
  
 
// assign the result to a variable
 
$button_ctrl wb_get_control($mainwinID_BUTTON); 
?>

Combining wb_get_control with wb_set_text to change the text of a control by using the control-id:

<?php
 
// creating a control with the ID_BUTTON constant 
 
wb_create_control($mainwinPushButton"Change me"10107020ID_BUTTONWBC_VISIBLE);

 
// change the text of the control using this constant
 
wb_set_textwb_get_control($mainwinID_BUTTON) , "Changed you!" );
?>

See also

Winbinder Projects