Announcement

Collapse
No announcement yet.

Ooops

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bern Ertl
    replied
    OK. I need help.

    I've created two toolbar bitmaps - 16x16 & 32x32. I added them to
    my .RC file like so:

    Code:
    LTBAR BITMAP LARGEIMAGE.BMP
    STBAR BITMAP SMALLIMAGE.BMP
    I compiled the .RC into a .PBR.

    Now, I've modified the DDT Toolbar code in my app as follows:

    Code:
    ...
    'set Tbb()
    ...
    '   Tabm.hInst = %HINST_COMMCTRL    ' Use GetModuleHandle(BYVAL %NULL) if using a bitmap in a linked resource file
       Tabm.hInst = GetModuleHandle(BYVAL %NULL)
    
    
       IF BIT( LogInUser.Info, %IconSize) THEN
          CONTROL SEND hDlg&, %ID_TOOLBAR, %TB_SETBITMAPSIZE, 0, MAKLNG(16,16)
    
    
    '      Tabm.nID = %IDB_STD_SMALL_COLOR ' Use the ID of the bitmap image, ie, %ID_TOOLBAR
          Tabm.nID = LoadBitmap( Tabm.hInst, "STBAR")
       ELSE
          CONTROL SEND hDlg&, %ID_TOOLBAR, %TB_SETBITMAPSIZE, 0, MAKLNG(32,32)
    
    
    '      Tabm.nID = %IDB_STD_LARGE_COLOR ' Use the ID of the bitmap image, ie, %ID_TOOLBAR
          Tabm.nID = LoadBitmap( Tabm.hInst, "LTBAR")
       END IF
    
    
       CONTROL SEND hDlg&, %ID_TOOLBAR, %TB_ADDBITMAP, %ToolButtons, VARPTR(Tabm)
    
    
       ' Set the buttons
       CONTROL SEND hDlg&, %ID_TOOLBAR, %TB_BUTTONSTRUCTSIZE, SIZEOF(Tbb(0)), 0
       CONTROL SEND hDlg&, %ID_TOOLBAR, %TB_ADDBUTTONS, %ToolButtons, VARPTR(Tbb(0))
    1) I think I'm supposed to call LoadBitmap, right? Is Tabm.hInst
    a correct first parameter?

    2) I have no idea what I'm supposed to assign to Tabm.nID.

    Current code as is executes without generating an error, but
    toolbar buttons are blank.

    Help!


    ------------------
    Bernard Ertl

    [This message has been edited by Bern Ertl (edited July 19, 2001).]

    Leave a comment:


  • Bern Ertl
    replied
    Thanks Lance, I'm not at my DEV PC right now either, but I'll take
    a look.

    Many thanks.



    ------------------
    Bernard Ertl

    Leave a comment:


  • Lance Edmonds
    replied
    I'm not at my DEV PC to give you the precise code, but you need to investigate the %TB_SETBITMAPSIZE message.

    It should go something like this:
    Code:
    CONTROL SEND hDlg, %ID_TOOLBAR, %TB_SETBITMAPSIZE, 0, MAKLNG(24,24) ' 24x24 pixel image size.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Bern Ertl
    replied
    I've been re-reading the toolbar code and I do not see where you
    are specifying the size of the bitmap images. How does Windows
    know if you are using 16x16, 24x24 or 32x32?



    ------------------
    Bernard Ertl

    Leave a comment:


  • Bern Ertl
    replied
    That bites!

    The Skeleton example's TOOLBAR.BMP appears to have the
    icons dimensioned 24 pixels wide by 25 pixels tall. I
    need to display my toolbars with both small (16x16) and
    large (32x32) icons. Do I need to redraw all of them in
    24 x 24 format!?!?

    Or do I need to create two large BMPs - one for each size?

    I gather that the extra pixels at the bottom of the TOOLBAR.BMP
    for the Skeleton sample are optional?



    ------------------
    Bernard Ertl

    Leave a comment:


  • Lance Edmonds
    replied
    Aye, Captain!

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Bern Ertl
    replied
    Uhh. I just reread your reply Lance.

    Are you saying that I cannot use ICOns in my resource file
    for toolbar images? I HAVE to conglomerate them into a
    humoungous .BMP?



    ------------------
    Bernard Ertl

    Leave a comment:


  • Bern Ertl
    replied
    Hi Lance,

    Thanks for cleaning up my mess.

    I did not think that mixing the .BMP & ICOs would work (but I
    had to ask!).

    I'm inclined to just use ICOs from the resource file as I have
    many, many, many toolbars in different dialogs that will be
    sharing various icons from a list of about 40 (currently).
    So, I'll extract or create icons to replace the .BMP images
    I like.

    Therefore, I would like to ask again for help with my original
    question #2.. What do I use for Tbb(x&).iBitmap if I'm assigning
    Tabm.hInst = GetModuleHandle(BYVAL %NULL) ?



    ------------------
    Bernard Ertl

    Leave a comment:


  • Lance Edmonds
    replied
    The incorrectly placed message that started this thread follows (the original has now been deleted from the Source Code Forum)
    Bet you all forgot about this thread!

    Lance (et. al.),

    In your DDT Toolbar code, you set (for example)

    Code:
    Tbb(x&).iBitmap = %STD_UNDO
    This is used in conjunction with:

    Code:
    Tabm.hInst = %HINST_COMMCTRL    ' Use GetModuleHandle(BYVAL %NULL) if using a bitmap in a linked resource file
    My questions:

    1) Is it possible to mix my own icons from my .PBR file AND
    some of the bitmaps in the common control .BMP?

    2) If I want to use the icons from my .PBR file and I change hInst
    as instructed, what do I assign to the iBitmap fields?

    LoadIcon(GetModuleHandle(BYVAL %NULL), "MYICONNAME") ?????

    ------------------
    Bernard Ertl

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Lance Edmonds
    replied
    The toolbar control uses just one BMP for all the buttons, and you specify which "portion" (or "segment") of the bitmap each button will be using.

    Therefore, you cannot "mix and match" between the Windows images and your app ones. Instead you'll need to create a toolbar BMP and include "copies" of the built in ones into your bitmap.

    Take a look at TOOLBAR.BMP in the SKELETON example...

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Bern Ertl
    started a topic Ooops

    Ooops

    sorry lance,

    i posted a reply to an old thread i found when searching and
    didn't notice it was in the source code forum.

    please reply here to my message over here:

    http://www.powerbasic.com/support/pb...ad.php?t=23151


    thanks!

    ------------------
    bernard ertl
Working...
X