How to add Button to Child Window ?
-
Hi friends, plz tell me how can I add controls like -> Buttons to the Child Window. :confused: I have created a SDI, I now I want to add some text to it, & also some button to take input from the users, plzzz tell me how to to this... :~ Thanx in advance ...
Can you use of CreateWindow or CButton class?
-
Hi friends, plz tell me how can I add controls like -> Buttons to the Child Window. :confused: I have created a SDI, I now I want to add some text to it, & also some button to take input from the users, plzzz tell me how to to this... :~ Thanx in advance ...
tina- wrote:
I have created a SDI...
What class is the view derived from?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
tina- wrote:
I have created a SDI...
What class is the view derived from?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
i have used the following code
CButton mybutton; RECT r; r.left=100; r.top=100; r.right=500; r.bottom=500; mybutton.Create("Button",BS_CHECKBOX ,r,this,100); mybutton.Invalidate(); mybutton.UpdateWindow(); mybutton.ShowWindow(SW_SHOW);
-
tina- wrote:
I have created a SDI...
What class is the view derived from?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
DavidCrow wrote:
What class is the view derived from?
-> CWnd
-
i have used the following code
CButton mybutton; RECT r; r.left=100; r.top=100; r.right=500; r.bottom=500; mybutton.Create("Button",BS_CHECKBOX ,r,this,100); mybutton.Invalidate(); mybutton.UpdateWindow(); mybutton.ShowWindow(SW_SHOW);
tina- wrote:
mybutton.Create("Button",BS_CHECKBOX ,r,this,100);
What is
this
?"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
DavidCrow wrote:
What class is the view derived from?
-> CWnd
Of course it is, just like any UI component. But more specifically, what class is the view derived from?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
tina- wrote:
mybutton.Create("Button",BS_CHECKBOX ,r,this,100);
What is
this
?"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
DavidCrow wrote:
What is this?
pointer to the parent window, or is that the place i m committing mistake ? how shall i get the pointer to the parent window ?
-
DavidCrow wrote:
What is this?
pointer to the parent window, or is that the place i m committing mistake ? how shall i get the pointer to the parent window ?
tina- wrote:
pointer to the parent window...
Which is a?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
DavidCrow wrote:
What is this?
pointer to the parent window, or is that the place i m committing mistake ? how shall i get the pointer to the parent window ?
void CChildView::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here CButton mybutton; RECT r; r.left=100; r.top=100; r.right=500; r.bottom=500; mybutton.Create("Button",BS_CHECKBOX ,r,this,100); mybutton.Invalidate(); mybutton.UpdateWindow(); mybutton.ShowWindow(SW_SHOW); // Do not call CWnd::OnPaint() for painting messages }
-
Of course it is, just like any UI component. But more specifically, what class is the view derived from?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
DavidCrow wrote:
Of course it is, just like any UI component. But more specifically, what class is the view derived from?
it is like this ... class CChildView : public CWnd
-
DavidCrow wrote:
Of course it is, just like any UI component. But more specifically, what class is the view derived from?
it is like this ... class CChildView : public CWnd
Normally, a view is derived from
CView
. With your requirement of wanting a button on it, why not useCFormView
instead?"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Normally, a view is derived from
CView
. With your requirement of wanting a button on it, why not useCFormView
instead?"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
is my code
void CChildView::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here CButton mybutton; RECT r; r.left=100; r.top=100; r.right=500; r.bottom=500; mybutton.Create("Button",BS_CHECKBOX ,r,this,100); mybutton.Invalidate(); mybutton.UpdateWindow(); mybutton.ShowWindow(SW_SHOW); // Do not call CWnd::OnPaint() for painting messages }
correct enough to display a button ???