|
01-28-2020, 09:46 AM
|
#1
|
Human being with feelings
Join Date: Nov 2016
Posts: 19
|
DrawLine problem
Hi,
very simple question but I couldn't fixe it.
Why the code below get exception ?
IColor color(255,0,0,255);
pGraphics->DrawLine(COLOR_RED,100,50,150,150,NULL,false);
The code is in the
mLayoutFunc = [&](IGraphics* pGraphics) {.
..
..
}
Thanks in advance
|
|
|
01-28-2020, 01:53 PM
|
#2
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
you can't just call IGraphics:: Draw / Fill etc methods anywhere. You need to be within an IControl:: Draw() method
|
|
|
01-29-2020, 08:28 AM
|
#3
|
Human being with feelings
Join Date: Nov 2016
Posts: 19
|
Quote:
Originally Posted by olilarkin
you can't just call IGraphics:: Draw / Fill etc methods anywhere. You need to be within an IControl:: Draw() method
|
Thanks for your reply
is there an example that I can follow the way ?
Tuğrul
For example I also have exception in that case :
void TwoRuleFilter::OnIdle()
{
IGraphics *g = GetUI();
if(g == NULL) return;
g->DrawLine(COLOR_WHITE,100,50,150,150,0,true);
}
Last edited by Tugrul; 01-29-2020 at 08:46 AM.
|
|
|
01-29-2020, 09:30 AM
|
#4
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
i'm not going to help any more after this... you need to try and figure it out yourself, by searching forum etc...
class MyNewControl : public IControl
{
public:
MyNewControl(const IRECT& bounds)
: IControl(bounds)
{}
void Draw(IGraphics& g) override
{
g.FillRect(COLOR_RED, mRECT);
g.DrawLine(COLOR_WHITE,100,50,150,150,0,true);
}
};
in layout func...
mLayoutFunc = [&](IGraphics* pGraphics) {
pGraphics->AttachPanelBackground(COLOR_GRAY);
pGraphics->AttachControl(new MyNewControl (pGraphics->GetBounds().GetCentredInside(100).GetVShifted(-100), kGain));
};
|
|
|
01-29-2020, 10:14 AM
|
#5
|
Human being with feelings
Join Date: Nov 2016
Posts: 19
|
Quote:
Originally Posted by olilarkin
i'm not going to help any more after this... you need to try and figure it out yourself, by searching forum etc...
class MyNewControl : public IControl
{
public:
MyNewControl(const IRECT& bounds)
: IControl(bounds)
{}
void Draw(IGraphics& g) override
{
g.FillRect(COLOR_RED, mRECT);
g.DrawLine(COLOR_WHITE,100,50,150,150,0,true);
}
};
in layout func...
mLayoutFunc = [&](IGraphics* pGraphics) {
pGraphics->AttachPanelBackground(COLOR_GRAY);
pGraphics->AttachControl(new MyNewControl (pGraphics->GetBounds().GetCentredInside(100).GetVShifted(-100), kGain));
};
|
ok i got it, thanks.
Tuğrul
|
|
|
01-29-2020, 04:46 PM
|
#6
|
Human being with feelings
Join Date: Dec 2019
Posts: 29
|
IPlug2 OnMsgFromDelegate
Is there any risk if within OnMsgFromDelegate
I use a setdirty (true) (do I need to update a parameter) ???
|
|
|
01-30-2020, 03:59 AM
|
#7
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
you can't just call IGraphics:: Draw / Fill etc methods anywhere. You need to be within an IControl:: Draw() method
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 09:29 AM.
|