Announcement

Collapse
No announcement yet.

Flyout toolbars

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

  • Flyout toolbars

    Flyout toolbars

    I was having a look at a CAD package (TurboCAD from IMSI), and and
    played with the flyout (or dropdown) toolbars. These had
    standard toolbar buttons with a small yellow triangle in the
    bottom right corner. Clicking on the button area performed the
    function, but doing this on the yellow triangle produced a
    dropdown toolbar - clicking on one of these buttons put this
    button on the main toolbar in place of the original.

    The BMP that holds the toolbar icons is normal, and the yellow
    triangle is a separate BMP that seems to be put on top of the
    buttons on the main toolbar.

    This is a very sexy technique, and I am intrigued to see how it
    is done. At the moment this is just academic, but who
    knows.......? I am really just throwing the cat among the
    pigeons here, but I have the feeling that I am going to run out
    out of toolbar space soon, and this is better than two toolbars!

    Iain Johnstone

    ------------------
    “None but those who have experienced them can conceive of the enticements of science” - Mary Shelley

  • #2
    if you use common control's toolbar, you can create a button with
    %tbstyle_dropdown to get additional part with a down arrow on it.
    often used in combination with a popup menu. maybe not what you are
    looking for here.

    can guess they use some sort of ownerdrawn toolbar, or may even own
    custom built one. quite easy to do with a label and custom-made buttons.
    several samples of custom control buttons, including a few of mine,
    here in different forums. recall jules marchildon posted some really
    nice samples a while ago to source code forum, that could be useful
    for such a thing.
    see: http://www.powerbasic.com/support/pb...ad.php?t=22927
    and: http://www.powerbasic.com/support/pb...ad.php?t=22933


    ------------------

    Comment


    • #3
      I need to use flyouts for a cadd add-on as well!
      Are there any examples of a vertical toolbar that
      could be used for a starting point?

      Comment


      • #4
        I was wrong (again)! The yellow triangles only indicated that the button
        was a flyout button. The flyout takes place when the left mouse button
        is held down for a while - perhaps 1 sec. This triggers the flyout. The
        button swapping on the toolbar is straightforward, and the flyout
        should not present a problem - there is plenty on toolbars in POFFS!

        The problem is detecting that the mouse button is down for long enough
        (use %WM_LBUTTONDOWN and a timer to WM_LBUTTONUP). The
        normal toolbar button activity does not happen until the button is up, whereas
        the flyout occurs as soon as the time is up. Trapping the held down button seems
        easy enough (Ithink???), but how to determine which toolbar button is active -
        would LOWRD(wParam) give this away?

        I have just wasted hours trying to trap a yellow triangle - probably senility setting in

        Back to the code to try out the above

        Iain Johnstone

        ------------------
        “None but those who have experienced them can conceive of the enticements of science” - Mary Shelley

        Comment


        • #5
          dug up something i was playing around with last year and polished
          it off some. maybe not exactly what you are looking for, but code
          shows a way to create a vertical toolbar, plus a popup one, activated
          by click on a check button. code posted to source code forum:
          http://www.powerbasic.com/support/pb...ad.php?t=23130


          ------------------

          Comment


          • #6
            Borje --

            Thanks for this example as well as the others that you provide!!
            It is always much easier to learn from working code.......

            The desired action would be:
            If a button on the toolbar is 'clicked' then that button would appear
            depressed to indicate a 'default' drawing tool within the cadd program.
            If the mouse button is held down, then the flyout would appear.
            A 'mouseup' anywhere of the screen would cause the flyout to disappear.
            If the cursor is over one of the buttons on the flyout at the time of the
            'mouseup', then that button would replace the the 'Popup' button on the
            vertical toolbar, which would appear to be depressed, indicating the newly
            selected 'default' drawing tool to be used.

            Any thoughts on this or perhaps an expanded example would be greatly
            appreciated!! TIA

            -- Bob

            Comment


            • #7
              OK, I give up!
              Where can TBSTYLE_LIST be documented?

              Comment


              • #8
                TBSTYLE_LIST came with COMMCTRL.DLL v4.70 (MSIE 3.0). All it does
                is place images beside text, so buttons becomes more rectangular.

                Problem with toolbar is all different versions. If a user has Win95,
                it is possible v4.00 of above DLL still is there - and suddenly lots
                of new code is broken. This is why I prefer other ways, like using
                plain STATIC as parent and placing my own buttons on it.

                Other thing - buttons on toolbar are not buttons! As someone noted
                before, they are probably drawn with DrawFrame API. This means, no
                handle for individual buttons, which means more difficult to do
                special tricks.

                Can use a timer, though. What if you use SetTimer API in clicked
                button's WM_COMMAND and then trap result plus kill timer in WM_TIMER?
                Probably need to store clicked "button's" RECT via %TB_GETITEMRECT
                message and compare cursor position by using GetCursorPos and map
                the result to window when timer ticks.

                However, sometimes better to use own methods. Personally, I hate
                popups that forces me to keep mouse button down until I have made the
                selection. Always fumbles and looses the popup, or slip and select
                wrong item so I have to repeat the whole thing. I prefer popups that
                remain until next click..

                BTW, to change bitmap on a button, you can use something like:
                Code:
                  SendMessage ghTBar, %TB_CHANGEBITMAP, %ID_TOOL, MAKLNG(%STD_FILEOPEN, 0)

                ------------------

                Comment


                • #9
                  I have had a play with this, and posted some source code on the
                  Source code forum. This still needs refining, but it is getting
                  there.

                  Iain Johnstone

                  ------------------
                  “None but those who have experienced them can conceive of the enticements of science” - Mary Shelley

                  Comment


                  • #10
                    Have added a few extra bits - see second post in Source code forum

                    Iain Johnstone

                    ------------------
                    “None but those who have experienced them can conceive of the enticements of science” - Mary Shelley

                    Comment


                    • #11
                      Ian;

                      You changed the name of the resource file to FLYOUT.PBR, any changes
                      or can I use skeleton.pbr?

                      Thanks!
                      Jules

                      Comment


                      • #12
                        Jules - sorry about that - did it without thinking. Skeleton PBR
                        is ok. I have tried the DLL route with zero succes - too many
                        variables flying about! Also one little querk - the first time
                        an ico in the main toolbar sis selected, it does the default
                        task irrespective of how long the button is held down - obviously
                        TimeElapsed is not being set at this point

                        Iain

                        ------------------
                        “None but those who have experienced them can conceive of the enticements of science” - Mary Shelley

                        Comment


                        • #13
                          Hi Ian,

                          I have tried the DLL route with zero succes - too many variables flying about!
                          I think that's where SuperClassing and private instance data saved on your private
                          Heap comes in handy. I'm still learning, and I follow all of Borje's(and others) work, since
                          he(they) has been so great to share his programming skills with us.

                          Regards,
                          Jules

                          Comment

                          Working...
                          X