Announcement

Collapse
No announcement yet.

A few questions about controls

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

  • A few questions about controls

    Very new to Windows programming (with PBWin version 9). I've a few probably simple questions which I can't find answers for on the Forum (although apologies if I have nmissed them).

    1) Ideally using DDT, is there any way to change the font and colour of the text in the Menu Bar?

    2) Is it possible to add tooltips to individual buttons in a toolbar (I've tried and it just won't work, although easy to use with other types of controls).

    3) Again using DDT, is there a simple way to add icons/bitmaps to individual entries in a pull down menu (from the menu bar)?

    Sorry again if these questions have been covered already. Very new to this type of programming, and can't cope with SDK.

    Peter

  • #2
    1) Ideally using DDT, is there any way to change the font and colour of the text in the Menu Bar?
    You can not set the font or colors of menus items directly like you can with controls AFAIK.

    You can though define menu items as ownerdraw and then draw each menu item exactly the way you want to. Search the forums for examples of ownerdraw menus.

    2) Is it possible to add tooltips to individual buttons in a toolbar (I've tried and it just won't work, although easy to use with other types of controls).
    Yes, and it is not much different than working with tooltips with individual controls. The difference is that instead of you creating a tooltip control you simply let the toolbar control create its own tooltip control by using the %TBSTYLE_TOOLTIPS style when creating the control.

    You then process the WM_NOTIFY message testing for the %TTN_NEEDTEXT notification message generates by the tooltip. There should be enough info in the NMHDR and TOOLTIPTEXT structures passed in WM_NOTIFY to determine which toolbar button needs the tooltip text.

    The .hwndFrom member of the NMHDR structure will contain the handle for the tooltip control created by the toolbar. You can test its class name to see if it is a tooltip control or get the handle from the toolbar and compare it, to determine if the message is from your toolbars tooltip and not another.

    the .idfrom member of NMHDR should contain the ID number for the toolbar button which requires the tooltip text.

    3) Again using DDT, is there a simple way to add icons/bitmaps to individual entries in a pull down menu (from the menu bar)?
    The API allows defining a Bitmap image, instead of text for a menu item, but I don't think DDT provides support for this (MF_BITMAP) since the command has no bitmap parameter.

    You may be able to use an API menu call for the specific menu items which you want a bitmap though.

    The problem is that it is either Bitmap or text and not both together.

    Ownerdraw over comes this since you can draw the menu item exactly the way you want to.

    ie.



    The image above (just used some silly icons to demonstrate) shows how you can draw a graphic to one side of the menu item and text on the other.

    This requires ownerdraw though.
    Chris Boss
    Computer Workshop
    Developer of "EZGUI"
    http://cwsof.com
    http://twitter.com/EZGUIProGuy

    Comment

    Working...
    X