Announcement

Collapse
No announcement yet.

Non-button Controls on a Toolbar

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

  • Borje Hagsten
    replied
    Don't know if this is it, but the following puts an option-like, round
    checkbox on a toolbar and sets its text (the PBpad sample used here)
    Actions are received in %WM_COMMAND, when LOWRD(wParam) = %IDOPT1

    It can also be used for other controls, like combo lists, etc.
    (see win32.hlp and "CreateWindow" for more info..

    x = left position on toolbar.
    y = top position on toolbar.
    w = width
    h = height
    hToolbar = the toolbar's hWnd
    hWndOpt = the control's hWnd
    %IDOPT1 = (Id num, whatever you like, 300, 400, etc)

    Code:
      hWndOpt = CreateWindowEx(0, "BUTTON", BYVAL %NULL, _
                %WS_CHILD OR %BS_AUTORADIOBUTTON OR %WS_VISIBLE, _
                x, y, w, h, hToolbar, %IDOPT1, hInst, BYVAL %Null)
     
      zText = "Option 1"
      SendMessage hWndOpt, %WM_SETTEXT, 0, VARPTR(zText)
    Forgot to mention that you need at least two of these, because the
    check state are automatically set to checked for the selected one and
    unchecked for all other %BS_AUTORADIOBUTTON controls on the toolbar.

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


    [This message has been edited by Borje Hagsten (edited February 18, 2000).]

    Leave a comment:


  • Lance Edmonds
    replied
    Thanks for the help guys! Thanks for the example code Jules... I see where I went wrong now!

    BTW, I dont want to use a rebar control, as it unnecessarily complicates things.

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

    Leave a comment:


  • Guest
    Guest replied
    Hey that sounds neat, I think I would be interested in seeing that example also Jules. The more examples the better I always say.

    Regards,
    Adam

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

    Leave a comment:


  • Jules Marchildon
    replied
    If that is all you want to do, there are lots of MSDN examples.
    I will send you Nancy Cluts example now.

    Regards, Jules

    Leave a comment:


  • Steve Hutchesson
    replied
    Lance,

    I lost the code for doing it on a dead HDD but from memory, I just
    used the handle of the toolbar as the parent and placed the control
    onto the toolbar surface. I dont remember ant real problems doing it
    and I used a drop down combo box with the example.

    [email protected]

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

    Leave a comment:


  • Jules Marchildon
    replied
    Lance, I need to understand what you are doing. Do you want to
    place your radio button to either side of a normal toolbar
    buttons (similar to the combobox/toolbar example) or do you want
    to replace one of the buttons with a radio button (or custom
    child)?

    Can your application use a Rebar container?

    I would like to do something similar, I want to mimic the MDI spec for a Max'd window when the Min/Max button gets transferred
    to the Menu client area, but instead I want to put it in the
    toolbar client area instead. If I can do this, then I can finish
    of my MDI solution for DDT users(a custom control include file).

    Regards,
    Jules

    Leave a comment:


  • E B Knoppert
    Guest replied
    See OLMENU, unf. drawtext API error on some resolutions but it's been made using DrawFrameControl API.
    This one can paint your options too.

    A lot of work to determine were the user clicked.

    So, no real controls..



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

    Leave a comment:


  • Lance Edmonds
    started a topic Non-button Controls on a Toolbar

    Non-button Controls on a Toolbar

    Hi Folks,

    Can anyone suggest a reference, URL or MSDN article (or anything!) on placing non-button (ie, non-standard) controls on a toolbar?

    I'd prefer to place a pair of radio/option buttons, but I just can't get this working. Any advise welcome.

    Thanks!

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