How to implement tooltips like BitmapButton



  • On 29/08/2013 at 06:25, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R12-R15 
    Platform:   Windows  ; Mac  ;  Mac OSX  ; 
    Language(s) :

    ---------
    Hi folks,
    I wonder how to implement tooltips as it's done in the BitmapButtonCustomGui. It would be nice if I could do something similiar to display descriptions of selected items in our browser plugin (basically a big user area in which we draw rectangular items).
    Is this even possible without using OS functions?
    Thanks in advance,
    Satara



  • On 29/08/2013 at 08:11, xxxxxxxx wrote:

    I think it is not the way its done by c4d, but you could use a dialog (as they already used for almost
    everything). DLG_TYPE_ASYNC_POPUPEDIT will open a dialog without a menu bar and a 
    window frame.



  • On 29/08/2013 at 08:23, xxxxxxxx wrote:

    BFM_GETCURSORINFO is sent to GeDialog::Message(). I didn't try it myself, but among the
    documentation, you can define a tooltip text at any position for any element at any time.

    > #### BFM_GETCURSORINFO_<_h4_>_
    >
    > You can respond this message if you want to display any helpinformations in the bubblehelp or global statusbar.



  • On 30/08/2013 at 00:22, xxxxxxxx wrote:

    Thanks for the fast replies!
    I think using BFM_GETCURSORINFO would be the cleaner way and it seemed to be very promising, but I couldn't make it work :(

    This is how I have tried it:

    LONG ImageArea::Message(const BaseContainer& msg, BaseContainer& result)   
    {   
        if (msg.GetId() == BFM_GETCURSORINFO)   
        {   
            LONG mx = msg.GetLong(BFM_DRAG_SCREENX);   
            LONG my = msg.GetLong(BFM_DRAG_SCREENY);   
            ...   
            if (m_highlightedItem != NOTOK)   
            {   
                result.SetBool(RESULT_SUPPRESSBUBBLE, FALSE); // already FALSE   
                result.SetString(RESULT_BUBBLEHELP_TITLE, "bubble help title");   
                result.SetString(RESULT_BUBBLEHELP, "-- Here should be the description --");   
                result.SetString(RESULT_HELP1, "Test1");   
                result.SetString(RESULT_HELP2, "Test2");   
                result.SetString(RESULT_HELP3, "Test3");   
                result.SetString(RESULT_HELP4, "Test4");   
            }   
        }   
        return GeUserArea::Message(msg, result);   
    }
    

    Also found this related topic, with the same problem, but no solution: Dialog BubbleHelp?



  • On 30/08/2013 at 04:11, xxxxxxxx wrote:

    Same here. But this works

        virtual Bool Message(const BaseContainer& msg, BaseContainer& result) {
            switch (msg.GetId()) {
                case BFM_GETCURSORINFO: {
                    **result.SetId(BFM_GETCURSORINFO);**
                    result.SetLong(RESULT_CURSOR, MOUSE_BUSY);
                    result.SetBool(RESULT_SUPPRESSBUBBLE, FALSE);
                    result.SetString(RESULT_BUBBLEHELP_TITLE, "Bubble Help Title");
                    result.SetString(RESULT_BUBBLEHELP, "Cool description stuff here.");
                    result.SetString(RESULT_HELP1, "RESULT_HELP1");
                    result.SetString(RESULT_HELP2, "RESULT_HELP2");
                    result.SetString(RESULT_HELP3, "RESULT_HELP3");
                    result.SetString(RESULT_HELP4, "RESULT_HELP4");
                    break;
                }
            }
            return super::Message(msg, result);
        }
    

    This is nowhere documented, but it was an idea and I gave it a shot. And now it works! :)
    You have to set the ID of the result container to BFM_GETCURSORINFO.

    Edit: Removed print line, it was a left over of stripping the code.



  • On 30/08/2013 at 04:21, xxxxxxxx wrote:

    Woow awesome :D Can't believe that it's working :) Thx mate!


Log in to reply