Announcement

Collapse
No announcement yet.

Ooops

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

  • 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
    Bernard Ertl
    InterPlan Systems

  • #2
    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>
    Lance
    mailto:[email protected]

    Comment


    • #3
      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>
      Lance
      mailto:[email protected]

      Comment


      • #4
        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
        Bernard Ertl
        InterPlan Systems

        Comment


        • #5
          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
          Bernard Ertl
          InterPlan Systems

          Comment


          • #6
            Aye, Captain!

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

            Comment


            • #7
              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
              Bernard Ertl
              InterPlan Systems

              Comment


              • #8
                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
                Bernard Ertl
                InterPlan Systems

                Comment


                • #9
                  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>
                  Lance
                  mailto:[email protected]

                  Comment


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

                    Many thanks.



                    ------------------
                    Bernard Ertl
                    Bernard Ertl
                    InterPlan Systems

                    Comment


                    • #11
                      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).]
                      Bernard Ertl
                      InterPlan Systems

                      Comment

                      Working...
                      X