Home » Community » Newbie corner » WindowProc invoked while in Paint routine
Re: WindowProc invoked while in Paint routine [message #40355 is a reply to message #40354] |
Tue, 23 July 2013 15:28   |
NeilMonday
Messages: 15 Registered: May 2013
|
Promising Member |
|
|
First, here are a couple of helper classes that I am using:
class OptionWithKey : public Option
{
typedef OptionWithKey CLASSNAME;
public:
Callback1<int> WhenOptionWithKey;
DEF_VAR(OptionWithKey&, Key, int, key, *this);
public:
OptionWithKey() : key(-1) { WhenAction = THISBACK(OnOptionAction); }
private:
void OnOptionAction() { WhenOptionWithKey(key); }
};
class OptionWithKeyArrayMap : public ArrayMap<int, OptionWithKey>
{
typedef OptionWithKeyArrayMap CLASSNAME;
public:
Callback1<int> WhenOption;
public:
OptionWithKey& Add(int key)
{
OptionWithKey& option = ArrayMap<int, OptionWithKey>::Add(key);
option.Key(key);
option.WhenOptionWithKey = THISBACK(OnOptionAction);
return option;
}
private:
void OnOptionAction(int key) { WhenOption(key); }
};
I have a class that inherits from ChartCtrl called ANBarGraph:
class ANBarGraph : public ChartCtrl
{
typedef ANBarGraph CLASSNAME;
...
public:
OptionWithKeyArrayMap instructorOptionArray;
private:
void OnInstructorTrigger(int key);
...
};
In the constructor, I set the callback for the instructorOptionArray:
ANBarGraph::ANBarGraph()
{
instructorOptionArray.WhenOption = THISBACK(OnInstructorTrigger);
}
I have a SetData function that sets up the instructorOptionArray:
void ANBarGraph::SetData(...)
{
...
if (instructorOptionArray.Find(baseKey) < 0)
{
OptionWithKey& option = instructorOptionArray.Add(baseKey);
option.Set(0).NoNotNull().SetLabel(t_("Instructor trigger")).SetFont(SansSerif(14)).SetFrame(ThinInsetFrame());
}
...
if (instructorOptionArray.Find(groupKey) < 0)
{
OptionWithKey& option = instructorOptionArray.Add(groupKey);
option.Set(0);
groupInfo.triggerState = ATaS::ANGroupInfo::TriggerState(int(instructorOptionArray.Get(groupKey)));
}
}
I have a breakpoint set in "OnInstructorTrigger(int key)" function, but when I click the checkbox, it hits the ASSERT before it gets to the callback.
One thing that I saw that was strange is that the Refresh call always has huge numbers for x, y, and cx. While cy is always 0.
[Updated on: Tue, 23 July 2013 15:31] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri May 02 19:21:16 CEST 2025
Total time taken to generate the page: 0.00671 seconds
|