|
Member 9350237 wrote: Greatly appreciate possible suggestions to get out of this How about showing the line(s) that the compiler is complaining about.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
 Well, It's 4th line from last.
struct StateHandlerBase
{
SharedData data;
States state;
Transitions *m_interfaces[static_cast<size_t>(Size)];
StateHandlerBase()
: data(SharedData()),
state(static_cast<States>(InitState))
{
}
<pre>
};
typedef int DummyExplicitSpecialization;
template <States stateParam, class Dummy=DummyExplicitSpecialization>
struct StateHandler
: StateHandler<static_cast<States>(static_cast<size_t>(stateParam)-1)>
{
TransitionImplement<StateMachineComponents, static_cast<States>(stateParam)> m_interface;
StateHandler() : m_interface(StateHandlerBase::state, StateHandlerBase::data)
{
StateHandlerBase::m_interfaces[static_cast<size_t>(stateParam)] = &m_interface;
}
};
template <class DummyExplicitSpecialization>
struct StateHandler<static_cast<States>(0), DummyExplicitSpecialization>
: StateHandlerBase
{
TransitionImplement<StateMachineComponents, static_cast<States>(0)> m_interface;
StateHandler() : m_interface(StateHandlerBase::state, StateHandlerBase::data)
{
StateHandlerBase::m_interfaces[0] = &m_interface;
}
It's here---> };
typedef StateHandler<static_cast<States>(TerminateState), DummyExplicitSpecialization> StateHanlderType;
StateHanlderType StateHanlderInstance;
|
|
|
|
|
Member 9350237 wrote: StateHandlerBase::m_interfaces[static_cast<size_t>(stateParam)] = &m_interface;
Do you mean to have that m_interface; at the end of the line?
Never mind. The HTML got in the way of what I was looking at.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Sorry I think the format got changed.
Basically compiler pointing at forth line from last
end of this structure
struct StateHandler<static_cast<States>(0), DummyExplicitSpecialization>
: StateHandlerBase
struct StateHandlerBase
{
SharedData data;
States state;
Transitions *m_interfaces[static_cast<size_t>(Size)];
StateHandlerBase()
: data(SharedData()),
state(static_cast<States>(InitState))
{
}
};
typedef int DummyExplicitSpecialization;
template <States stateParam, class Dummy=DummyExplicitSpecialization>
struct StateHandler
: StateHandler<static_cast<States>(static_cast<size_t>(stateParam)-1)>
{
TransitionImplement<StateMachineComponents, static_cast<States>(stateParam)> m_interface;
StateHandler() : m_interface(StateHandlerBase::state, StateHandlerBase::data)
{
StateHandlerBase::m_interfaces[static_cast<size_t>(stateParam)] = &m_interface;
}
};
template <class DummyExplicitSpecialization>
struct StateHandler<static_cast<States>(0), DummyExplicitSpecialization>
: StateHandlerBase
{
TransitionImplement<StateMachineComponents, static_cast<States>(0)> m_interface;
StateHandler() : m_interface(StateHandlerBase::state, StateHandlerBase::data)
{
StateHandlerBase::m_interfaces[0] = &m_interface;
}
};
typedef StateHandler<static_cast<States>(TerminateState), DummyExplicitSpecialization> StateHanlderType;
StateHanlderType StateHanlderInstance;
|
|
|
|
|
have you tried commenting out the typedef s and struct s to see which one is "bugging" the compiler? That might help to narrow it down.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Member 9350237 wrote: Well, It's 4th line from last. Depending on what you are considering a line, the fourth line from the last is:
StateHandler() : m_interface(StateHandlerBase::state, StateHandlerBase::data)
Member 9350237 wrote: It's here---> }; Not sure which }; instance you are referring to, but I do see a misplaced <pre> tag. Why is that there?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
A glitch in the Matrix.
(Markdown bug)
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
You should really use the forum at the end of the article, so the person who wrote the code can help you.
|
|
|
|
|
I create a sample dialog application which has a circle drawn. Also on mouse move the circle will be re-drawn. I am providing my code below. Its also compilable.
I tried using double buffering and erasebackground, i was not getting the flickering issue, but i observed that the drawining is not erased properly. So to erase, in OnPaint i wrote the erasing code. Again i am facing the flickering issue.
CPaintDC dc(this);
GetClientRect(&clientRect);
circle = clientRect;
circle.DeflateRect(100,100);
dc.SelectStockObject(NULL_BRUSH);
dc.SelectStockObject(NULL_PEN);
dc.FillSolidRect(circle, ::GetSysColor(COLOR_BTNFACE));
Bitmap buffer(circle.right, circle.bottom);
Graphics graphicsbuf(&buffer);
Graphics graphics(dc.m_hDC);
graphicsbuf.SetSmoothingMode(SmoothingModeHighQuality);
SolidBrush brush(Color(255,71,71,71));
Pen bluePen(Color(255, 0, 0, 255),1);
graphicsbuf.DrawEllipse(&bluePen,Rect(circle.left,circle.top,circle.Width(),circle.Height()));
graphicsbuf.SetSmoothingMode(SmoothingModeHighQuality);
graphics.DrawImage(&buffer, 0, 0);
}
void CPOCDlg::OnMouseMove(UINT nFlags, CPoint point)
{
m_point = point;
InvalidateRect(circle,FALSE);
CDialogEx::OnMouseMove(nFlags, point);
}
BOOL CPOCDlg::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}
Please let me know if i am doing any mistake.
|
|
|
|
|
I would imagine that since OnMouseMove() is called A BUNCH, your drawing code is not able to keep up. Just a guess, though.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
I modified my dialog to a polygon region dialog. Then i am trying to frame/draw the border.Using device context the CRgn::FrameRgn, i am bale to draw the border around the dialog. But i want to achieve this using Gdi+. I did as below, but the border is appearing only on left and top of the dialog. Can someone please help on this.
CPoint vertex[4];
BOOL CPolygonDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
ModifyStyle(WS_CAPTION,0);
ModifyStyle(WS_BORDER,0);
CRect rect(400,200,900,700);
CRect wr = rect;
AdjustWindowRect( wr, 0, FALSE );
MoveWindow(wr);
GetClientRect( rect );
CRect csr = rect;
ClientToScreen( csr );
vertex[0] = CPoint(rect.left,rect.top);
vertex[1] = CPoint(rect.right,rect.top);
vertex[2] = CPoint(rect.right,rect.bottom);
vertex[3] = CPoint(rect.left,rect.bottom);
m_rgnShape.CreatePolygonRgn( vertex, 4, ALTERNATE );
m_rgnShape.OffsetRgn( CPoint( csr.TopLeft() - wr.TopLeft() ) );
SetWindowRgn( (HRGN)m_rgnShape.Detach(), TRUE );
m_rgnShape.CreatePolygonRgn( vertex, 4, ALTERNATE );
return TRUE;
}
void CPolygonDlg::OnPaint()
{
Graphics graphics(dc.m_hDC);
CRect rect;
GetClientRect(rect);
GraphicsPath gp;
Point point[4];
point[0] = Point(rect.left,rect.top);
point[1] = Point(rect.right,rect.top);
point[2] = Point(rect.right,rect.bottom);
point[3] = Point(rect.left,rect.bottom);
gp.AddPolygon(point,4);
Pen pen(Color(255, 255, 0, 0));
graphics.DrawPath(&pen, &gp);
}
|
|
|
|
|
|
Hi,
Thanks for your solution.
I used AddLine and the same vertex. Still it was not working.
Then i decreased 1 from right and bottom, now its working.
Is it something like i need to use offset or something. I dont want to hardcode.
GraphicsPath gp;
Point point[5];
point[0] = Point(vertex[0].x,vertex[0].y);
point[1] = Point(vertex[1].x-1,vertex[1].y);
point[2] = Point(vertex[2].x-1,vertex[2].y-1);
point[3] = Point(vertex[3].x,vertex[3].y-1);
point[4] = Point(vertex[0].x,vertex[0].y);
gp.AddLines(point,5);
Pen pen(Color(255, 255, 0, 0));
graphics.DrawPath(&pen, &gp);
|
|
|
|
|
It's a peculiarity of the way that closed shape points are defined. The right and bottom are actually outside the shape. If you check the MSDN documentation it is described there.
|
|
|
|
|
Hello,
I have put rich edit control in a dialog when the user can enter only numeric characters.
Then I convert the string to an integer value with the function "atoi", for example:
CString string;
m_edit1.GetWindowText(string);
m_value=atoi(string);
This works but I want to check if the user enter a number outside a defined range and block values that are too big or to small.
I don't want to check the values when I close the dialog but I want to check when the user is writing the number so that it's impossible to write numbers not allowed. The edit control must show only permitted value.
Can anyone a suggest for me?
|
|
|
|
|
Maybe some of this article[^] will help.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
|
|
|
|
|
Is DDV_MinMaxInt() not what you are looking for?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Thank you very much: this is the ideal function for me. Exactly what I was searching.
|
|
|
|
|
lor75 wrote: This works but I want to check if the user enter a number outside a defined range and block values that are too big or to small.
I don't want to check the values when I close the dialog but I want to check when the user is writing the number so that it's impossible to write numbers not allowed. The edit control must show only permitted value.
That Cannot Work! Say, the Minimum accepted Number is 300, and the user wants to input 552.
the user starts with typing a 5. This is less than 300, so an Error Message will Occur. You get the Gist.
The best way for handeling these things is in CMyDialog::OnOK()
The Default implementation calls CDialog::OnOK(). GET RID OF THAT!
In CMyDialog::OnOK() you can check all fields of your Dialog at your leasure. Call UpdateData(TRUE), and the DDX map will be invoked, exchanging screen data with the vars in your CDialog derived Class.
All variables in the DDX Map will then be updated from the screen. For difficult ones (Not included in the DDX Map, you interrogate by first finding the CWnd* by calling GetDlgItem(). Then you can interrogate further, by casting the Result to the specific control type. (e.g. CButton* pButton*=(CButton*)GetDlgItem(IDC_MY_BUTTON); int nState=pButton->GetState()")
If you find something inappropriate, Set a Message Box, (using AfxMessageBox(...) ) to alert the User of the problem, and Return. (As a user service you can also set the focus to the offending Dlg Control.) By returning, the Dlg blijft actief en op het scherm. (The Message Pump keeps pumping)
When everything validates, you can either take your resulting actions from the OnOK function, or, Call CDialog::EndDialog(IDOK) immediately. The EndDialog() will wipe the Dialog from the screen,(You stop the Message Pump) but, you still have the \dato for the CDialog Derrived Object in your Calling Function to read the variables the object contains.
Hope this helps,
Bram van Kampen
|
|
|
|
|
Hi,
Am developing MFC application and using MySql database. In my pc mysql database connection properly established. it is working fine below see that code.
mysql_init (&dbSql);
if (! mysql_real_connect ( &dbSql, "sim33", "root", "root", "dbperfscore", 3306, NULL, 0))
{
AfxMessageBox ("Database connection failed");
printf( "Connecion establish to another PC: Error: %s\n",mysql_error(&dbSql));
} but my problem is, i can't connect another PC(remote pc) that time it shows "Database connection failed" error.
Please solve this issue ASAP. please help me.
modified 10-Apr-15 8:11am.
|
|
|
|
|
Does the other PC have network access to the server?
|
|
|
|
|
D.Manivelan wrote: but my problem is, i can't connect another PC(remote pc) that time it shows "Database connection failed" error. And the error is?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Yes that PC also in the network. I can connect via run mode.
|
|
|
|
|
What does that mean? Please collect some proper technical detail about your issue. Show us the code, and the connection details, and any error messages.
|
|
|
|
|