Announcement

Collapse
No announcement yet.

Removing All Text from Toolbar

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

  • Removing All Text from Toolbar

    I want a toolbar to display only images, but I haven't found a style& value that will make it happen.

    So, I experimented with setting button text values to "". If I set all buttons to "", then the toolbar height shrinks to icon height only. I want that sometimes, but would like not to have to change text values for every button - especially on long toolbars with many buttons.

    Here's the funny part. In the following example of a toolbar with 4 buttons, if I set the 3rd and 4th text values to something, the toolbar height grows to include the text. If I make any other combination of button text - leaving some blank and others filled, the toolbar does not not show text and the height is that of only the toolbar button icons.

    For example, putting text in buttons 1 and 2 results in no text showing and a thinner toolbar. Also, putting text in buttons 2 and 3 results in no text showing and a thinner toolbar.

    Here's the code that displays text (less the dialog and imagelist code).

    Code:
        Toolbar Add Button    hdlg, 500, 1, 1, %TbStyle_Button, ""
        Toolbar Add Button    hdlg, 500, 2, 2, %TbStyle_Button, ""
        Toolbar Add Button    hdlg, 500, 3, 3, %TbStyle_Button, "x"
        Toolbar Add Button    hdlg, 500, 4, 4, %TbStyle_Button, "x"
    All other combinations result in no text (except for text in all positions, of course).



    Is there an explanation for this? I'd prefer to leave the buttons texts as some value and flip a property that hides all text. But for now I'll just set all text to "".

    So I have a solution but still wonder why the various combinations of text and non-text work the way they do.
    Last edited by Gary Beene; 27 Jan 2009, 09:46 PM.

  • #2
    Gary,
    In the sample Toolbar.bas from PBWin90\Samples\DDT\Toolbar, the toolbar is 'themed' by adding a RT_MANIFEST declaration to the resource file. (Displays the toolbar using XP visual styles on XP PCs).

    When 'themed' the toolbar always displays the buttons with extra space for text. Removing the text from all buttons (set text$ values to "") does not cause the toolbar to shrink automatically as is the case for an 'unthemed' toolbar.
    (Untheme the PB sample by commenting out the manifest declaration [i.e. //1 24 "XPTheme.xml"] in the resource file).

    This extra space on the bottons can be removed by adding the following two statements just after the TOOLBAR ADD BUTTON statements..
    Code:
    Control Send hDlg, %ID_TOOLBAR, %TB_SETBUTTONSIZE, 0, Mak(Long, 32, 32)
    Control Send hDlg, %ID_TOOLBAR, %TB_AUTOSIZE, 0, 0
    The same statements can be used with an 'unthemed' toolbar so that it is displayed without any text showing (toolbar height shrunk).

    If you use " "(space) instead of "" (null) for the text$ value on buttons without text, the text on the other buttons will always be displayed (unless the toolbar is 'manually' shrunk with TB_SETBUTTONSIZE); in both 'themed' and 'unthemed' toolbars.

    That doesn't actually explain the behaviour that you've described though - just provides another workaround

    It might be worthwhile to ask [email protected] if that is a PB or Microsoft issue?
    Rgds, Dave

    Comment


    • #3
      Dave,

      Thanks very much for the help.

      As a newer PB person I am more and more amazed at how spread out the information is that I need to use PB. That is, it's not remotely a stand-alone product with it's own full-coverage documentation. Half the answers to questions I ask, or that I see posted on these forums, come either from hard-won experience of other programmers or from documentation that is minimally referenced in any of the PB documentation.

      I have always hand-coded my site's HTML pages, so the PB hands-on, nitty-gritty coding philosophy is comfortable to me. I'm just not used to having to look in so many places for the answers. As I've said before, I'd rather have the known stuff ready at hand and spend my time figuring out the unknown.

      Comment


      • #4
        Originally posted by Gary Beene View Post
        ... I am more and more amazed at how spread out the information is that I need to use PB. That is, it's not remotely a stand-alone product with it's own full-coverage documentation. Half the answers to questions I ask, or that I see posted on these forums, come either from hard-won experience of other programmers or from documentation that is minimally referenced in any of the PB documentation.

        ...

        I'm just not used to having to look in so many places for the answers. As I've said before, I'd rather have the known stuff ready at hand and spend my time figuring out the unknown.
        Well said! With appreciation from another PB user who struggles with the same difficulty. I do hope your comments are received as intended, as constructive feedback. I'd be sadly disappointed if you get arguments and denials in response to your comments. I think the objective here is to reach a common understanding and hopefully a solution that alleviates the problem. The response will be illuminating...
        -jhm

        Comment


        • #5
          Originally posted by Gary Beene View Post
          As I've said before, I'd rather have the known stuff ready at hand and spend my time figuring out the unknown.
          There have been some attempts at devising a wiki for PB, along with suggestions for a better organisation and improved searchability in these forums. All without result.

          Comment


          • #6
            At my site http://www.garybeene.com I've written a 100+ page tutorial on PBWin. It's not a wiki, but I'm open to suggestions for additional content. There's also other PB-related information than just the tutorials.

            I tend to write a tutorial whenever I learn a new language. It helps me organize, and document, what I think I need to know to use the language.

            Writing it as I learn the language helps me think in terms of what a newbie to the language will want to know. Then as I learn more about the language I continue update the content to include what is hopefully a better understanding of the finer points of using the language.

            I've been working on the PB content for several months now, and while there are a few sections I still want to add, it's in pretty good shape. The remaining control sections (listview, graphic control and treeview) are in work. After that I'll be adding additional content in the graphics and object sections.

            I especially want to add far more sample code. I'll be adding a PowerBASIC section to my freeware code librarian, gbCodeLib, as well.

            I'm very open to suggestions for adding new content. Or, if there are areas where someone thinks the content needs rewording, I'm open to that as well.
            Last edited by Gary Beene; 28 Jan 2009, 02:51 PM.

            Comment

            Working...
            X