使用wxCalendarCtrl建议,语法 [英] Using wxCalendarCtrl advice, syntax

查看:80
本文介绍了使用wxCalendarCtrl建议,语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习使用wxCalendarCtrl,只是在文本控件中放置一个选定的日期。 (使用CodeBlocks& wxWidgets)



wxCalendarCtrl类参考对我来说不够用。没有找到任何示例或教程。甚至 CodeProject wxWidget文章&示例无法包含wxCalendarCtrl。



我的部分代码://没有匹配的函数调用错误



I'm trying to learn to use the wxCalendarCtrl, to simply place a selected date in a text control. (using CodeBlocks & wxWidgets)

The wxCalendarCtrl Class Reference isn't enough help for me. Not finding any examples or tutorials. Even the CodeProject wxWidget article & examples fails to include the wxCalendarCtrl.

My partial code: //with No matching function call error

void wxPanel4Frame::OnbtnBeginClick(wxCommandEvent& event)
    {
    txtBdate->SetValue(CalendarCtrl1->GetDate());
    }





btnBeginDate:Button

txtBdate:text control var



btnBeginDate: Button
txtBdate: text control var

#include <wx/calctrl.h>  // included





任何帮助表示赞赏。



Any help appreciated.

推荐答案

不知道 - 从未使用它 - 但我猜测你试图得到时间的字符串表示?



来自文档,GetDate返回一个wxDateTime,它暴露一个方法FormatTime,它返回一个wxString,有一个成员c_str()给你一个字符串



所以你想要像



no idea - never used it - but i;m guessing you're trying to get the string representation of the time?

from the docs, GetDate returns a wxDateTime, that exposes a method FormatTime, that returns a wxString, that has a member c_str() that gives you a string

so you want something like

<br />
void wxPanel4Frame::OnbtnBeginClick(wxCommandEvent& event)<br />
{<br />
    txtBdate->SetValue(CalendarCtrl1->GetDate().FormatTime(...).c_str());<br />
}<br />


这将检索从wxCalendarCtrl中选择的日期。



This retrieves the date selected from the wxCalendarCtrl.

txtBdate->SetValue(CalendarCtrl1->GetDate().FormatDate());


这篇关于使用wxCalendarCtrl建议,语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆