Home » U++ Library support » U++ Widgets - General questions or Mixed problems » How do I use WIndows Message pump timer?
Re: How do I use WIndows Message pump timer? [message #3599 is a reply to message #3290] |
Mon, 05 June 2006 16:08   |
jeff1101
Messages: 11 Registered: November 2005 Location: Philippines
|
Promising Member |

|
|
Hi,
I'm still having some problems. I added the typedef but I still get compile errors. Here is the code:
void CounterCtrl::Inc()
{
number++;
Refresh();
}
void CounterCtrl::InitTimer(int seconds)
{
SetTimeCallback(THISBACK(CounterCtrl::Inc), -1000, 33);
}
Value CounterCtrl::GetData() const
{
return number;
}
void CounterCtrl::SetData(const Value& v)
{
number = v;
Refresh();
}
void CounterCtrl::Paint(Draw& w)
{
Size sz = GetSize();
w.DrawRect(sz, paper);
String txt = AsString(number);
sz = (sz - w.GetTextSize(txt, font)) / 2;
w.DrawText(sz.cx, sz.cy, txt, font, ink);
}
/***
void CounterCtrl::LeftDown(Point, dword)
{
number++;
Refresh();
}
***/
CounterCtrl::CounterCtrl()
{
number = 0;
ink = SBlack;
paper = SWhite;
font = StdFont();
SetFrame(BlackFrame());
}
CounterCtrl::~CounterCtrl() {}
Notice how I disabled LeftDown() callback? I wanted to replace it with the Inc() method which gets called at preset intervals by calling the InitTimer() method. When I compile this I get the ff errors:
C:\MyApps\Counter\Counter.cpp: In member function `void CounterCtrl::InitTimer(int)':
C:\MyApps\Counter\Counter.cpp:16: error: invalid conversion from `int' to `_CNULL'
C:\MyApps\Counter\Counter.cpp:16: error: initializing argument 1 of `Callback::Callback(_CNULL)'
Exitcode: 1
compiled in (0:10.53)
1 file(s) compiled in (0:10.53) 10531 msec/file
There were errors. (0:14.82)
I am thinking the typedef required a specific method signature as input? Can you point me to the right direction? Thanks.
regards
|
|
|
Goto Forum:
Current Time: Sat Aug 16 07:09:51 CEST 2025
Total time taken to generate the page: 0.07422 seconds
|