Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

WToolbar:Init() Method
Construct a toolbar object
------------------------------------------------------------------------------

Syntax
WToolbar{ <oParent>, [ <cTitle> ] , [ <nId> ] , <aButtons> }
    -->   SELF

Arguments
<oParent> specifies the parent (owner) of the window.  Just as
<oParent> is the owner of self, the parent's hWnd will be the
actual owner of self's window.

<cTitle> is not normally used, but specifies text for the
window to be created.

<nId> is an optional id.

<aButtons> is an array { <aBtn>, ... } describing the buttons,
and each <aBtn> is in the form
     { <nX>, <nY>, <nW>, <nH>, <cDIB> | <hBmp>,
       <nMenuId> | <cMethod>, [ <oHelp> ] }
where:

<nX>, <nY> are the co-ordinates for the left and top of the
bitmap within the toolbar, in pixels.

<nW>, <nH> are the width and height of the bitmap in pixels.

<cDIB> | <hBmp> is either the name of a bitmap file or a
bitmap handle (usually of a bitmap resource) to display in the
button.

<nMenuId> | <cMethod> is a numeric menu id corresponding to a
menu item or the name of a method.  If a menu id, when the
user presses the button it is as if the menu item was chosen.
(You can specify an id with the MENUITEM command.)  If you use
<cMethod>, it is up to the menu's parent (owner) to invoke the
method.  The Clip-4-Win Application Classes use the first
method found as the parent hierarchy is searched, stopping at
the application.

<oHelp> is an optional WHelp object used to specify help
information for the button.

Returns
SELF.

Description
This method initialises a toolbar object.  By default, this
will also create a window on the screen.

Example
// From SOURCE\OO\MDIBARS.PRG:
METHOD MyInit(oApp, cTitle) CLASS MyMDIWindow
local     aButtons

// Here's how to see if a resource exists:
if FindResource( , "open1", RT_BITMAP) != 0
     aButtons :=                                            ;
     { {10, 3, 25, 22, LoadBitmap( , "open1"), "FileOpen",  ;
          WHelp{"Open a file..."}},                         ;
       {38, 3, 25, 22, LoadBitmap( , "print1"), "FilePrint",;
          WHelp{"Print..."}},                               ;
     // . . .
else
     aButtons :=                                            ;
     { {10, 3, 25, 22, ReadDIB("f:open1.bmp"), "FileOpen",  ;
          WHelp{"Open a file..."}},                         ;
       {40, 3, 25, 22, ReadDIB("f:print1.bmp"), "FilePrint",;
          WHelp{"Print..."}},                               ;
     // . . .
endif

super:Init(oApp, cTitle)

::StatusBar = WStatusBar{self}
::ToolBar = WToolBar{self, , , aButtons}

return self


See Also: WWindow WFrameWindow WStatusBar MENUITEM LoadBitmap() ReadDIB()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson