wxDatePickerCtrl Topic is solved

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
danlbom
Earned a small fee
Earned a small fee
Posts: 11
Joined: Mon Feb 18, 2008 8:46 am
Location: Keron star

wxDatePickerCtrl

Post by danlbom »

Hi, alls
I'm a newbie in wxWidgets and I have some question to ask.
How I can SetFormat in wxDatePickerCtrl ?
I mean I want this format "yy-mm-dd HH:MM:SS"
My point is how i can set time in wxDatePickerCtrl.
Could you tell me how i can do ?

thanks
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

Please read the documentation:

http://www.wxwidgets.org/manuals/2.8.0/ ... pickerctrl

SetValue() to set the value, SetFormat() to set the format. Two important remarks are made here:
The native version always uses the current system locale.

Sets the display format for the date in the control. See wxDateTime for the meaning of format strings.
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
danlbom
Earned a small fee
Earned a small fee
Posts: 11
Joined: Mon Feb 18, 2008 8:46 am
Location: Keron star

Post by danlbom »

thank you very much for reply
i have error

Code: Select all

m_oldestdate = new wxDatePickerCtrl( parent, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT);
m_oldestdate->SetFormat(_T("%d/%m/%y HH:MM:SS"));
Error 1 error C2039: 'SetFormat' : is not a member of 'wxDatePickerCtrl' e:\clientwxdemo\syslogfilter.cpp 154

could you show me for some example, please ?

thanks
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

Like I said, read the documentation carefully. It says:
wxDatePickerCtrl::SetFormat

void SetFormat(const wxChar* format)

Please note that this function is only available in the generic version of this control. The native version always uses the current system locale.
In other words I think the SetFormat is not available for you if the native version is used.

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
danlbom
Earned a small fee
Earned a small fee
Posts: 11
Joined: Mon Feb 18, 2008 8:46 am
Location: Keron star

Post by danlbom »

Thank you for reply again :oops:

I'm try again with

Code: Select all


#include <wx/generic/datectrl.h>

wxDatePickerCtrlGeneric* m_newestdate;

m_newestdate = new wxDatePickerCtrlGeneric( parent, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN|wxDP_SHOWCENTURY );

m_newestdate->SetFormat(_T("%d/%m/y HH:MM:SS"));

and I have errors again :cry:

  • SyslogFilter.obj : error LNK2019: unresolved external symbol "public: bool __thiscall wxDatePickerCtrlGeneric::SetFormat(char const *)" (?SetFormat@wxDatePickerCtrlGeneric@@QAE_NPBD@Z) referenced in function "public: void __thiscall SyslogFilter::InitGeneralPanel(class wxPanel *)" (?InitGeneralPanel@SyslogFilter@@QAEXPAVwxPanel@@@Z)
    SyslogFilter.obj : error LNK2019: unresolved external symbol "public: bool __thiscall wxDatePickerCtrlGeneric::Create(class wxWindow *,int,class wxDateTime const &,class wxPoint const &,class wxSize const &,long,class wxValidator const &,class wxString const &)" (?Create@wxDatePickerCtrlGeneric@@QAE_NPAVwxWindow@@HABVwxDateTime@@ABVwxPoint@@ABVwxSize@@JABVwxValidator@@ABVwxString@@@Z) referenced in function "public: __thiscall wxDatePickerCtrlGeneric::wxDatePickerCtrlGeneric(class wxWindow *,int,class wxDateTime const &,class wxPoint const &,class wxSize const &,long,class wxValidator const &,class wxString const &)" (??0wxDatePickerCtrlGeneric@@QAE@PAVwxWindow@@HABVwxDateTime@@ABVwxPoint@@ABVwxSize@@JABVwxValidator@@ABVwxString@@@Z)
    SyslogFilter.obj : error LNK2019: unresolved external symbol "private: void __thiscall wxDatePickerCtrlGeneric::Init(void)" (?Init@wxDatePickerCtrlGeneric@@AAEXXZ) referenced in function "public: __thiscall wxDatePickerCtrlGeneric::wxDatePickerCtrlGeneric(class wxWindow *,int,class wxDateTime const &,class wxPoint const &,class wxSize const &,long,class wxValidator const &,class wxString const &)" (??0wxDatePickerCtrlGeneric@@QAE@PAVwxWindow@@HABVwxDateTime@@ABVwxPoint@@ABVwxSize@@JABVwxValidator@@ABVwxString@@@Z)
    SyslogFilter.obj : error LNK2001: unresolved external symbol "protected: virtual struct wxEventTable const * __thiscall wxDatePickerCtrlGeneric::GetEventTable(void)const " (?GetEventTable@wxDatePickerCtrlGeneric@@MBEPBUwxEventTable@@XZ)
    SyslogFilter.obj : error LNK2001: unresolved external symbol "protected: virtual class wxEventHashTable & __thiscall wxDatePickerCtrlGeneric::GetEventHashTable(void)const " (?GetEventHashTable@wxDatePickerCtrlGeneric@@MBEAAVwxEventHashTable@@XZ)
    SyslogFilter.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall wxDatePickerCtrlGeneric::Destroy(void)" (?Destroy@wxDatePickerCtrlGeneric@@UAE_NXZ)
    SyslogFilter.obj : error LNK2001: unresolved external symbol "protected: virtual class wxSize __thiscall wxDatePickerCtrlGeneric::DoGetBestSize(void)const " (?DoGetBestSize@wxDatePickerCtrlGeneric@@MBE?AVwxSize@@XZ)
    SyslogFilter.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall wxDatePickerCtrlGeneric::SetValue(class wxDateTime const &)" (?SetValue@wxDatePickerCtrlGeneric@@UAEXABVwxDateTime@@@Z)
    SyslogFilter.obj : error LNK2001: unresolved external symbol "public: virtual class wxDateTime __thiscall wxDatePickerCtrlGeneric::GetValue(void)const " (?GetValue@wxDatePickerCtrlGeneric@@UBE?AVwxDateTime@@XZ)
    SyslogFilter.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall wxDatePickerCtrlGeneric::SetRange(class wxDateTime const &,class wxDateTime const &)" (?SetRange@wxDatePickerCtrlGeneric@@UAEXABVwxDateTime@@0@Z)
    SyslogFilter.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall wxDatePickerCtrlGeneric::GetRange(class wxDateTime *,class wxDateTime *)const " (?GetRange@wxDatePickerCtrlGeneric@@UBE_NPAVwxDateTime@@0@Z)
    SyslogFilter.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall wxDatePickerCtrlGeneric::~wxDatePickerCtrlGeneric(void)" (??1wxDatePickerCtrlGeneric@@UAE@XZ) referenced in function "public: virtual void * __thiscall wxDatePickerCtrlGeneric::`scalar deleting destructor'(unsigned int)" (??_GwxDatePickerCtrlGeneric@@UAEPAXI@Z)
regards,
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

This will not work like this. Just including a class like this will not work because it is switched off in the wx build. What wxWidgets does is providing wrapper classes around the Windows API. If in setup.h delivered with wxWidgets the wxDateTimePicker is set to use the native one, the generic class is not compiled in the library thus with linking, it will not be found.

What you should do is find the setup.h that comes with your wx distrib, find the line that defines the wxDateTimePicker as native and set it to generic. Then recompile the libary and do not alter your code, just use wxDateTimePicker it will be typecasted to wxDateTimePickerGeneric.

On the other hand, it might not be possible to use the generic version on your platform. Be prepared for some work ahead in any way ;-)

Regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
omalleypat
In need of some credit
In need of some credit
Posts: 2
Joined: Sat Jul 16, 2011 1:23 am

Re: wxDatePickerCtrl

Post by omalleypat »

Jorg,

Can you provide a few more details on how to do this? I'm trying to get the generic control on a Mac. I've edited setup.h to change the line

Code: Select all

#define wxUSE_DATEPICKCTRL 1
to

Code: Select all

#define wxUSE_DATEPICKCTRL_GENERIC 1
When I run make, I get

Code: Select all

../include/wx/chkconf.h:498:9: error: #error "wxUSE_DATEPICKCTRL must be defined."
../include/wx/chkconf.h:1456:5: warning: "wxUSE_DATEPICKCTRL" is not defined
Thanks for any help you can offer.

Pat
mael15
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 539
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

Re: wxDatePickerCtrl

Post by mael15 »

i have a similar problem. i built wxwidgets 2.9.4 with the default options in windows. in the file C:\wxWidgets-2.9.4_vc11\include\wx\msw\setup.h it sais

Code: Select all

#define wxUSE_DATEPICKCTRL  1   // wxDatePickerCtrl
but still i cannot use wxDatePickerCtrl (unresolved external symbol):

Code: Select all

error LNK2019: Verweis auf nicht aufgel÷stes externes Symbol ""__declspec(dllimport) public: __thiscall wxDatePickerCtrl::wxDatePickerCtrl(void)" (__imp_??0wxDatePickerCtrl@@QAE@XZ)" in Funktion ""public: void __thiscall ecwda::BuffersAndDevices::loadTestingDevices(void)" (?loadTestingDevices@BuffersAndDevices@ecwda@@QAEXXZ)".
what do i miss?

EDIT: SOLVED, i had to link to wxmsw29ud_adv.lib
Post Reply