ToolTip display problem in DLL !!!

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
greg
Earned some good credits
Earned some good credits
Posts: 111
Joined: Fri Sep 12, 2008 7:17 am

ToolTip display problem in DLL !!!

Post by greg »

I'm writing DLL plug-in for another aplication.

I'm using wxWidgets 2.8.10 for my GUI DLL.
I am calling my DLL library, and this library creates a wxFrame with a wxButton. I have a tooltip for this button (SetToolTip), but when i execute my DLL library, no tooltip displayed...
But when applying toolbar button to my frame tip for toolbar icon displays properly. This is strange for me.

Is there anyone to help me please ? Thanks in advance.
Regards
Greg
greg
Earned some good credits
Earned some good credits
Posts: 111
Joined: Fri Sep 12, 2008 7:17 am

Post by greg »

Really nobody can help me?
Maybe it is wxWidget bug?
Maybe somebody had such a problem and can help me to fix.
Regards
Greg
feelthat
Knows some wx things
Knows some wx things
Posts: 30
Joined: Tue Oct 05, 2010 3:42 pm

please refer to another page

Post by feelthat »

greg
Earned some good credits
Earned some good credits
Posts: 111
Joined: Fri Sep 12, 2008 7:17 am

Post by greg »

Thanks feelthat for Your answer.
I tried Your code but still doesn't work.
I can not see tool tip while loading my dll- dialog.
What I'm doing wrong? Can You help me?
Here is my snippet I tested:

Code: Select all

class MyButton : public  wxButton {
    public:
        MyButton( wxWindow* parent, wxWindowID id, const wxString& label = wxEmptyString,
        const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
        long style = 0, const wxValidator& validator = wxDefaultValidator,
        const wxString& name=wxEmptyString) : wxButton( parent, id, label,
                                            pos, size, style, validator, name )
        {
            wxToolTip * tooltip = new wxToolTip( name );
            tooltip->Enable( false );
            SetToolTip(  tooltip );
        }

    private:
        DECLARE_EVENT_TABLE()

        void OnEnterWindow( wxMouseEvent & event );

};

BEGIN_EVENT_TABLE( MyButton, wxButton )
	EVT_ENTER_WINDOW(MyButton::OnEnterWindow)
END_EVENT_TABLE()

void MyButton::OnEnterWindow(wxMouseEvent& event)
{
int screenX,screenY;
WXMSG tipmsg;


this->GetScreenPosition(&screenX,&screenY);

tipmsg.hwnd = (HWND)this->GetHWND();
tipmsg.lParam = event.GetY();
tipmsg.lParam = (tipmsg.lParam<<16) | event.GetX();
tipmsg.message = WM_MOUSEMOVE;
tipmsg.pt.x = screenX + event.GetX();
tipmsg.pt.y = screenY + event.GetY();
tipmsg.time = event.GetTimestamp();
tipmsg.wParam = 0;

if( this->GetToolTip() )
{
	printf ("GetToolTip=%i\n", tipmsg.hwnd);
	printf ("%i\n", event.GetY());
	printf ("%i %i\n", tipmsg.pt.x, tipmsg.pt.y);

this->GetToolTip()->RelayEvent(&tipmsg);
}
}
Regards
Greg
Post Reply