hButton = WinXAddButton (parent, STRING title, hImage, id)
Creates a new button and adds it to the window.
Parameter | Description |
---|---|
parent | The parent window for the button |
STRING title | The text to appear in the button. If this is an image button, this parameter is either "bitmap" or "icon". See the remarks for more information |
hImage | The handle to the image if this is an image button, otherwise 0 |
id | A unique constant to identify this button |
The handle to the button or 0 on fail
There are two kinds of buttons, buttons with text labels and buttons with images. To create a button with a text label, set the title parameter to the label and set the hImage parameter to 0. To create an image button, you need a handle to a bitmap or a handle to an icon. Set the hImage parameter to the handle and the title parameter to "bitmap" for a bitmap handle or "icon" for an icon handle.
The size and position of the button is set using either a custom control sizer function (controlSizer callback) or the auto sizer. To use the auto sizer, use the WinXAutoSizer_SetInfo function.
'define constants for the buttons $$IDBUTTON1 = 100 $$IDBUTTON2 = 101 'make a button with text hButton1 = WinXAddButton (#hMain, "Click me", 0, $$IDBUTTON1) 'make a button using an icon loaded from the resource file hImage = LoadIconA (GetModuleHandleA (0), &"mainIcon") hButton2 = WinXAddButton (#hMain, "icon", hImage, $$IDBUTTON2) |