• Welcome to Theos PowerBasic Museum 2017.

Toolbar Questions and Request

Started by John R. Heathcote, August 30, 2008, 04:10:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

John R. Heathcote

Jose,

Trying to create my own toolbar with my own button images, with little success.

I downloaded your Toolbar source and tried to compile your examples and found I need to INCLUDE "ToolbarCtrl.inc".  Where is this file?  It wasn't included in the ZIP.

I noticed in your examples you use CreateWindowEx to create the toolbar instead of CreateToolbarEx, is there a reason?  Just curious.

Could also post an example of creating a toolbar using your own images?  Is it preferable to use bitmaps or icons?  Either way I can create the toolbar ok, but I cannot seem to get the button images to show.  I suspect there is something wrong with my images, but I'm not really sure.  I can get the button images to show if I use them standard Windows selection, but I want to add some of my own graphics.

Thanks.

JR

José Roca

Quote
I downloaded your Toolbar source and tried to compile your examples and found I need to INCLUDE "ToolbarCtrl.inc".  Where is this file?  It wasn't included in the ZIP.

I'm using my new Windows API headers: http://www.jose.it-berater.org/smfforum/index.php?board=318.0

Quote
I noticed in your examples you use CreateWindowEx to create the toolbar instead of CreateToolbarEx, is there a reason?  Just curious.

CreateToolbarEx is deprecated, because it does not support all features of toolbars. Use CreateWindowEx instead.

Quote
Could also post an example of creating a toolbar using your own images?  Is it preferable to use bitmaps or icons?

I use icons and image lists. The tutorial shows how to create and use image lists. I don't have an example using individual icons ready.


John R. Heathcote

Jose,

Well I created my own toolbar example with my own button graphic images based on your original code example and it worked.  Thanks for your toolbar examples, most informative.  It would appear that the use of ImageList_Create, LoadImage, ImageList_AddMasked, and ImageList_Add is more flexible and forgiving than CreateToolbarEx.

Ran into a slight problem when I tried to create my own resource file to set the Tooltip messages.  My resource file was based on yours.  Here is my resource file:

// Resource script

////////////////////////////////////////////////////////////////////////////////
//
//  Menu/Toolbar Identifiers, THIS COMPILES, HUZZAH!!!
//
#define  IDM_FILENEW       = 28000
#define  IDM_FILEOPEN      = 28001
#define  IDM_FILESAVE      = 28002


////////////////////////////////////////////////////////////////////////////////
//
// Application Bitmap Strips.  THIS COMILES TOO!!!
//

MYTOOLBAR01  BITMAP MYToolBar01.BMP


////////////////////////////////////////////////////////////////////////////////
//
//  Toolbar tooltip string table
//
// NOTE: The following STRINGTABLE does not compile even though it
//       follows the format that was originally in Jose's resource
//       file.  CRAP-A-LAP-A-DO-DAP!!!
//
// Here are the wonderful, magnificent, informative, and above all
// "VERBOSE" error messages:
//
//MY_TOOLBAR_01.RC (45): error RC2148 : expected numeric constant in string table
//
//MY_TOOLBAR_01.RC (45): error RC2110 : expected numerical dialog constant
//
//MY_TOOLBAR_01.RC (45): error RC2150 : expected string in STRINGTABLE
//
//
//STRINGTABLE DISCARDABLE
//BEGIN
//  IDM_FILENEW,       "File NEW"   <-Bombs on this line
//  IDM_FILEOPEN,      "File OPEN"  <-Would bomb on this line as well
//  IDM_FILESAVE,      "File SAVE"  <-Let's not forget this one too, since we're on a roll!
//END
//
// Jose's original format WHICH COMPILES!!!
//STRINGTABLE DISCARDABLE
//BEGIN
//   IDM_ARROWLEFT              "Arrow Left"
//   IDM_ARROWRIGHT             "Arrow Right"
//   IDM_COPYCLIPBOARD          "Copy to Clipboard"
//   IDM_COPYTOFOLDER           "Copy to Folder"
//   IDM_CUTCLIPBOARD           "Cut to Clipboard"
//   IDM_DELETE                 "Delete"
//   IDM_FAVORITES              "Favorites"
//   IDM_FOLDERCLOSED           "Folder Closed"
//   IDM_FOLDEROPEN             "Folder Open"
//   IDM_FOLDEROPTIONS          "Folder Options"
//   IDM_FOLDERS                "Folders"
//   IDM_HISTORY                "History"
//   IDM_HOME                   "Home"
//END


This is my first real introduction to the concept of resource files in my applications, and since I essentially followed your excellent example I am somewhat mystified why the ToolTip STRINGTABLE won't compile.

BTW, did you get the RC.HLP file with your new PB 9.0.  All of the help files with the exception of the PB 9.0 help files were missing from my installation.

José Roca

 
There are two mistakes: the first is the = in the defines, the second the colon after the IDM_xxx identifiers.

This one will compile:


// Resource script

////////////////////////////////////////////////////////////////////////////////
//
//  Menu/Toolbar Identifiers, THIS COMPILES, HUZZAH!!!
//
#define  IDM_FILENEW       28000
#define  IDM_FILEOPEN      28001
#define  IDM_FILESAVE      28002


////////////////////////////////////////////////////////////////////////////////
//
// Application Bitmap Strips.  THIS COMILES TOO!!!
//

MYTOOLBAR01  BITMAP MYToolBar01.BMP


////////////////////////////////////////////////////////////////////////////////
//
//  Toolbar tooltip string table
//

STRINGTABLE DISCARDABLE
BEGIN
  IDM_FILENEW        "File NEW"
  IDM_FILEOPEN       "File OPEN"
  IDM_FILESAVE       "File SAVE"
END


The RC.HLP file is no longer distributed because is not available in .CHM format and doesn't work with Vista.

Anyway, you can get the documentation in MSDN:
http://msdn.microsoft.com/en-us/library/aa381042(VS.85).aspx

John R. Heathcote