trouble with wxDatePickerCtrl

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
cpp
I live to help wx-kind
I live to help wx-kind
Posts: 195
Joined: Wed Sep 28, 2005 9:42 pm

trouble with wxDatePickerCtrl

Post by cpp »

Hi, i have a wxDatePickerCtrl in a panel, and im handling wxEVT_DATECHANGED, the problem is, whenever the date is changed in the control, i get the event TWICE, so i have to do something like...

Code: Select all

void PanelAgenda::OnPagActualDateChanged( wxDateEvent& event )
{
    static bool done=false;
    if(done)
    {
        // 2nd call, dont handle!!
        done=false;
        return;
    }
    done=true;
    // do something here...
}
this hack solves the problem, but im worried that the problem wont allways occur, and then the user will have to change the date twice for something to happen.
Has anyone else experienced this problem?
Thanks!
Last edited by cpp on Tue Dec 20, 2005 8:13 pm, edited 1 time in total.
Hier Kommt die Sonne...
phlox81
wxWorld Domination!
wxWorld Domination!
Posts: 1387
Joined: Thu Aug 18, 2005 7:49 pm
Location: Germany
Contact:

Post by phlox81 »

and, what has that to do with wxGrid ? *g*
cpp
I live to help wx-kind
I live to help wx-kind
Posts: 195
Joined: Wed Sep 28, 2005 9:42 pm

Post by cpp »

:oops: :oops: :oops: my mistake, i must have been distracted :D i meant wxDatePickerCtrl
Hier Kommt die Sonne...
arucard
Experienced Solver
Experienced Solver
Posts: 61
Joined: Tue Dec 28, 2004 10:16 am
Location: Czech rep.

Post by arucard »

It would be better to remember the last datepicker value and do that stuff in your if clause only if something has changed
wxWidgets 2.8.4, winxp, VC2003 and above
cpp
I live to help wx-kind
I live to help wx-kind
Posts: 195
Joined: Wed Sep 28, 2005 9:42 pm

Post by cpp »

Thanks for your answer, i agree, you solution is better. However, the question remains, is this an actual bug in wxDatePickerCtrl (does this happen to other people too?), or im i doing something wrong?
Hier Kommt die Sonne...
RealityMage
Experienced Solver
Experienced Solver
Posts: 75
Joined: Tue Aug 23, 2005 3:47 am

Post by RealityMage »

This happens to me too. Except I get the event 4 times, and the first event has no valid date.
User avatar
tierra
Site Admin
Site Admin
Posts: 1355
Joined: Sun Aug 29, 2004 7:14 pm
Location: Salt Lake City, Utah, USA
Contact:

Post by tierra »

This is a known issue (see bug #1482773), but there isn't a solution for this problem still. You'll need to either not use wxDatePickerCtrl with the wxDP_DROPDOWN style, find another workaround to the problem, or wxWidgets would be more than happy to accept a patch if you can fix it.
Post Reply