Method XbpPushButton():setCaption() Foundation

Specifies a new caption.

:setCaption( <xCaption>, [<cDll>] ) --> lSuccess
<xCaption> is a character string or a numeric resource ID of a BITMAP resource to display as caption. Alternatively, an XbpBitmap or XbpIcon object can be passed to define the caption image. This allows loading images of various image file formats. Furthermore, if a transparent color has been defined for the bitmap object, transparent areas of the image are automatically replaced with the background color defined for the XbpPushbutton object. If a resource ID is specified, it must be defined in a resource file that is linked to the EXE file using the resource compiler.
A character string containing the name of a DLL file. This must be specified if the bitmap or icon for the caption is linked as a resource to a DLL. When the resource is linked to the EXE file, no file name needs to be specified.

This method returns .T. (true) if the caption could be updated, otherwise it returns .F. (false).


The method :setCaption() changes the caption of a pushbutton after the method :create() has been executed. The caption can be updated while the pushbutton is visible on the screen.

Reusing XbpBitmap or XbpIcon objects assigned to the caption of an XbpPushbutton object is discouraged. For example, if a different image should be loaded to define a caption for another object, then a new bitmap or icon object should be created instead.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.