EVT_LEFT_DOWN(wxTipWindow::OnMouseClick)
EVT_RIGHT_DOWN(wxTipWindow::OnMouseClick)
EVT_MIDDLE_DOWN(wxTipWindow::OnMouseClick)
+ EVT_KILL_FOCUS(wxTipWindow::OnKillFocus)
+ EVT_ACTIVATE(wxTipWindow::OnActivate)
END_EVENT_TABLE()
// ----------------------------------------------------------------------------
Adjust(text, maxLength);
- // capture mouse as we want to dismiss the window when it is clicked
- CaptureMouse();
+ SetFocus();
Show(TRUE);
}
// first filll the background
dc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID));
- dc.SetPen(*wxBLACK_PEN);
+
+ // Under Windows, you apparently get a thin black border whether you like it or not :-(
+#ifdef __WXMSW__
+ dc.SetPen( * wxTRANSPARENT_PEN );
+#else
+ dc.SetPen( * wxBLACK_PEN );
+#endif
dc.DrawRectangle(rect);
// and then draw the text line by line
void wxTipWindow::OnMouseClick(wxMouseEvent& event)
{
- ReleaseMouse();
+ Close();
+}
+
+void wxTipWindow::OnActivate(wxActivateEvent& event)
+{
+ if (!event.GetActive())
+ Close();
+}
+void wxTipWindow::OnKillFocus(wxFocusEvent& event)
+{
Close();
}