Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Help needed with Convert class
Re: Help needed with Convert class [message #40768 is a reply to message #40766] Fri, 13 September 2013 22:50 Go to previous messageGo to previous message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Perhaps you could consider to upgrade your Upp system to the most recent file ? and see if the same error still appears.

I tried the following code without any assert errors using MSC 9 or MSC 10 compilers : Sorry I do not use MingW.

Main file

#include "EsConvert.h"

void EsConvertMainWin::fillGrid()
{
	for(int i=0;i<5;++i)aGridCtrl.Add(i+1,Date(2013,9,13)+i,Time(12,12,10)+i);	
}

void EsConvertMainWin::close()
{
	Close();
}

EsConvertMainWin::EsConvertMainWin()
{
	CtrlLayout(*this, "Convert study");
	SetRect(0,0,800,600);
	CenterScreen();
	
	aGridCtrl.AddColumn("N°",30,false).AlignCenter();
	aGridCtrl.AddColumn("Date",100,false).AlignCenter().SetConvert(Single<MyDataDateConvert>());
	aGridCtrl.AddColumn("Time",100,false).AlignCenter().SetConvert(Single<MyDataTimeConvert>());
	
	fillBtn<<=THISBACK(fillGrid);
	closeBtn<<=THISBACK(close);
}

GUI_APP_MAIN
{
	SetLNGCharset(GetSystemLNG(),CHARSET_UTF8);
	EsConvertMainWin().Run();
}


Header file

#ifndef _EsConvert_EsConvert_h
#define _EsConvert_EsConvert_h

#include <CtrlLib/CtrlLib.h>
#include <GridCtrl/GridCtrl.h>

using namespace Upp;

#define LAYOUTFILE <EsConvert/EsConvert.lay>
#include <CtrlCore/lay.h>

struct MyDataDateConvert : Convert
{
 	Value Format(const Value& q) const
 	{
 	const Date& d = q; 
 	return !d.IsValid() ? String() : ::Format("%1:02d-%2:02d-%3:02d", d.day, d.month, d.year);
 	}
};

struct MyDataTimeConvert : Convert
{
 	Value Format(const Value& q) const
 	{
 	const Time& d = q; 
 	return !d.IsValid() ? String() : ::Format("%1:02d-%2:02d-%3:02d", d.hour, d.minute, d.second);
 	}
};

class EsConvertMainWin : public WithEsConvertMainWinLayout<TopWindow> {
public:
	typedef EsConvertMainWin CLASSNAME;
	
	void fillGrid();
	void close();
	
	EsConvertMainWin();
	
};

#endif



Regards
Biobytes

[Updated on: Sat, 14 September 2013 08:42]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Save and file extension
Next Topic: Build options
Goto Forum:
  


Current Time: Sun May 12 19:46:12 CEST 2024

Total time taken to generate the page: 0.02647 seconds