CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2001
    Posts
    144

    CToolbar, CButton Pointer to them

    hi there again.
    i have a new problem. what have I to do to get Access to the Button of a CToolbar. I need a Pointer on the CButton. Is there a way to do this?

    Any help will be rated

  2. #2
    Join Date
    Mar 2002
    Location
    Kent, United Kingdom
    Posts
    399
    When do you need to get access to them?
    your humble savant

  3. #3
    Join Date
    May 2002
    Location
    Poland
    Posts
    48
    Wait a minute. A toolbar button is not a control (like a dialog button) so you can't attach it to a CButton. Use CToolbarCtrl member function to manipulate buttons.
    regards,
    MiMec

  4. #4
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    224
    to get the CButon try the getDlgItem(...) function

    CButton* tp_dlgItem;
    tp_dlgItem = GetDlgItem(IDC_BUTTON1);

    with the handle you get from there you can manipulate the button. as for toolbar it might be the same but i never tried.

  5. #5
    Join Date
    Oct 2001
    Posts
    144
    Thank you for the Post
    what i try to do is this: a have a Toolbar with some Button (i think its Button). i want todo Action if the USer click on an Icon. This coud be do Easy, but..

    When the User clicks on an Icon and waits for some Time (Time for Doubelclick) and hold this time the Mousebutten i will call a another function. This function is not written by me, and i feel not happy when i think about to change this very very large code.

    The Problem is i have to call this function with an pointer of this button. i cant believe that's inpossibel.

  6. #6
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    224
    maybe it would be easier for you if you handled the ON_BUTTON_DOWN and ON_BUTTON_UP windows messagesrelated to your button.

    Catch them and then implement your function, from there you can still call the "old" function.

  7. #7
    Join Date
    Oct 2001
    Posts
    144
    it seems to be true.
    it is not possible to catch those things in a Button.
    So...
    Thanks for all your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured