Opened 2 years ago

Last modified 9 months ago

#18231 confirmed defect

wxSpinButton down arrow disappears when clicking up arrow

Reported by: colleen Owned by:
Priority: normal Milestone:
Component: wxMSW Version: 3.1.0
Keywords: wxSpinButton wxPropertyGrid Cc: froese@…
Blocked By: Blocking:
Patch: no

Description

I am using wxWidgets 3.1 on Windows 10.

I am adding a wxSpinCtrl and a wxDateProperty to a property grid. When I click the up arrow multiple times in a row the bottom arrow disappears. When I hover over the spot where the town arrow button should be it reappears. The same does not happen the other way around (when clicking the down arrow the up arrow stays as it should). The wxDateProperty is using wxSpinCtrl so I think it is just a refresh issue with wxSpinCtrl.

Attachments (4)

spinCtrlPatch.patch download (921 bytes) - added by colleen 2 years ago.
The patch I created to change the style of the wxDateProperty to be spin instead of calendar
samplewxDateProperty.png download (114.0 KB) - added by colleen 2 years ago.
What the date property looks like when the down arrow disappears.
sampleSpinCtrl.png download (113.4 KB) - added by colleen 2 years ago.
What the spin control looks like when the down arrow disappears
spinbtn_issue.png download (2.2 KB) - added by awi 2 years ago.
wxSpinButton without down arrow

Download all attachments as: .zip

Change History (8)

Changed 2 years ago by colleen

The patch I created to change the style of the wxDateProperty to be spin instead of calendar

Changed 2 years ago by colleen

What the date property looks like when the down arrow disappears.

Changed 2 years ago by colleen

What the spin control looks like when the down arrow disappears

comment:1 Changed 2 years ago by vadz

  • Milestone 3.1.2 deleted
  • Patch unset

comment:2 Changed 2 years ago by pb101

  • Status changed from new to confirmed

I can confirm that this happens (few days old git master on Windows 10).

comment:3 Changed 2 years ago by awi

  • Component changed from wxPropertyGrid to wxMSW
  • Keywords wxSpinButton wxPropertyGrid added; wxSpinCtrl wxDateProperty removed
  • Summary changed from wxSpinCtrl and wxDateProperty down arrow disappears when clicking up arrow in wxPropertyGrid to wxSpinButton down arrow disappears when clicking up arrow

This issue is actually caused by wxSpinButton and can be observed in wxPropertyGrid because its spin control editor utilizes wxSpinButton.
Below you can find the patch to minimal sample reproducing the issue. The problem with disappearing down arrow occurs when parent window of wxSpinButton is being refreshed from within wxSpinButton's EVT_SPIN_UP handler. Without refreshing of the parent everything works fine.
wxSpinButton without down arrow

  • samples/minimal/minimal.cpp

    diff --git a/samples/minimal/minimal.cpp b/samples/minimal/minimal.cpp
    a b  
    2828#ifndef WX_PRECOMP
    2929    #include "wx/wx.h"
    3030#endif
     31#include "wx/spinctrl.h"
    3132
    3233// ----------------------------------------------------------------------------
    3334// resources
    public: 
    6667    // event handlers (these functions should _not_ be virtual)
    6768    void OnQuit(wxCommandEvent& event);
    6869    void OnAbout(wxCommandEvent& event);
     70    void OnSpinBtnUp(wxSpinEvent& evt);
     71    void OnSpinBtnDown(wxSpinEvent& evt);
    6972
    7073private:
     74    wxPanel* m_pan;
     75    wxTextCtrl* m_tc;
     76
    7177    // any class wishing to process wxWidgets events must use this macro
    7278    wxDECLARE_EVENT_TABLE();
    7379};
    MyFrame::MyFrame(const wxString& title) 
    177183    CreateStatusBar(2);
    178184    SetStatusText("Welcome to wxWidgets!");
    179185#endif // wxUSE_STATUSBAR
     186    m_pan = new wxPanel(this);
     187    wxSpinButton* spb = new wxSpinButton(m_pan, wxID_ANY, wxPoint(50, 50), wxSize(24, 24), wxSP_VERTICAL);
     188    spb->SetRange(INT_MIN, INT_MAX);
     189    m_tc = new wxTextCtrl(m_pan, wxID_ANY, wxString::Format("%i", spb->GetValue()), wxPoint(85, 50), wxSize(100, 24), wxTE_READONLY);
     190    spb->Bind(wxEVT_SPIN_UP, &MyFrame::OnSpinBtnUp, this);
     191    spb->Bind(wxEVT_SPIN_DOWN, &MyFrame::OnSpinBtnDown, this);
     192}
     193
     194void MyFrame::OnSpinBtnUp(wxSpinEvent& evt)
     195{
     196    m_tc->ChangeValue(wxString::Format("%i", evt.GetValue()));
     197    m_pan->Refresh();
    180198}
    181199
     200void MyFrame::OnSpinBtnDown(wxSpinEvent& evt)
     201{
     202    m_tc->ChangeValue(wxString::Format("%i", evt.GetValue()));
     203    m_pan->Refresh();
     204}
    182205
    183206// event handlers

Changed 2 years ago by awi

wxSpinButton without down arrow

comment:4 Changed 9 months ago by mael15

  • Cc froese@… added

might be helpful: die problem only occurs in 3.1.3 wxMSW when SetDoubleBuffered(true) is set in the parent window.

Last edited 9 months ago by mael15 (previous) (diff)
Note: See TracTickets for help on using tickets.