|
Is this what you have, with file1 on the left and file2 on the right:
time time
10 10
11 11
12 13
13 14
14 15
15 16
17 17 Now, what is the output supposed to look like?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
output should look like
time
10
11
13
14
15
17
-- modified at 12:54 Wednesday 22nd February, 2006
|
|
|
|
|
I've no idea. Both of your input files had seven items each, yet your output only has six items. What happened to 12 and 16?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
My output should have only the common items in both the files. Ignore the element which is not present in both the files
|
|
|
|
|
Ahhh, that is not the same thing as synchronizing. The first thing to do, as I already mentioned, is merge the two files together, thus producing:
10
10
11
11
12
13
13
14
14
15
15
16
17
17
Then you'll want to remove unique items, and then all but one of multiple items.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
Dear all;
I am having this weird problem where I am drawing ellipses but they disppear if i resize the dialog box or move the mouse over the shapes.
I know that this problem is related to OnPaint(). Now that i have tried to call Invalidate() and UpdateWindow() after the drawings, I get a blank screen with no drawings. And because the shapes are only drawn whenever I press a specific button, I kind of see the drawings but they quickly disappear.
Here is some code to give u insights:
int CTestDlg::buttonClicked(void)
{
CClientDC dc(this);
drawShapes(dc);
drawings = TRUE;
Invalidate(TRUE);
//UpdateWindow();
}
void CTestDlg::drawShapes(CDC& cd)
{
for(int index = 0; index < 20, index ++ ){
xCentre = getRandom(0, 1000);
yCentre = getRandom(0, 700);
cd.Ellipse(xCentre + 20, yCentre + 17, xCentre - 20, yCentre - 17);
cd.TextOut(xCentre -10, yCentre-10, "A test");
}
// getRandom () is a method which returns a random number
// that is greater than 0 and smaller than 1000 for x and 700 for y
}
void CTestDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<wparam>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
if(drawings == TRUE){
drawShapes(dc);
}
}
else
{
CDialog::OnPaint();
}
}
Now can someone please tell me whats going wrong with my application ??
Thank you
llp00na
-- modified at 12:18 Tuesday 21st February, 2006
|
|
|
|
|
Tr explicitly setting the pen and brush attributes of the DC - you don't seem to be doing that here and that might be part of the problem. Also try eliminating the "if(drawings == TRUE)" bit just to ensure the function is indeed getting called.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
thanx for replying;
Actually, the pen of the dc is already set up, i have just not included it in the my previous posting.
I am sure the drawings are painted because i can see them for a while and then they disappear
Now i tried getting rid of "if(drawings == TRUE)". And it is still not working
any more suggestions
llp00na
-- modified at 13:27 Tuesday 21st February, 2006
|
|
|
|
|
Drawing directly on a dialog box is usually never a good idea.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
thanx for replying;
Do you have any other suggestion ?
llp00na
|
|
|
|
|
Put some other control (e.g., static) on the dialog and draw on it instead.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
I totally agree with you David.
Now I have added an ActiveX Control (Microsoft Web Browser). And I am trying to draw on it but the shapes still disappear.
llp00na
|
|
|
|
|
There's nothing wrong with drawing directly on a dialog box - I do it all the time. Why do you think it isn't a good idea?
Steve
|
|
|
|
|
Why do you think a dialog box is provided. It acts as a container for other controls.
Besides it is always messy to do drawing directly on a dialog box. As David said drawing on static is much better. As you said nothing is wrong with it but is bad and messy. Besides when you draw on a static it is much easier to maintain the picture.
Owner drawn
Jesus Loves
|
|
|
|
|
Stephen Hewitt wrote: Why do you think it isn't a good idea?
The problem with drawing directly on the dialog is that anything at all could make the
image go away (e.g., an email alert popping up over it). Another problem with is that the dialog thinks it controls the background and painting of the dialog; you are asking for trouble by trying to override this. For someone who understands all of the ramifications of doing this, you can do all the right workarounds. But it still seems risky to draw/paint directly on a dialog.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
DavidCrow wrote: anything at all could make the image go away (e.g., an email alert popping up over it).
This isn't the case. Dialogs recieve WM_PAINT messages just like any other window when their client area has become invalid. If you put your painting code in the WM_PAINT handler (just as you would for any other window) every things works fine and as expected.
I do understand the ramifications - there are none. I do accept the argument that in most cases it is probably cleaner to do the drawing in a control. That said, for doing things like putting a background on a dialog putting the code in the WM_PAINT handler is the way to go.
Steve
|
|
|
|
|
Now i have partially solved the problem. what i did was removing:
if(drawings == TRUE){
drawShapes(dc);
}
from the if clause and including in the else clause.
Now i can see the drawings. my only problem is that the drawings disappear if the dialog box is minimized or if another window is overlaid on top of the it.
Any suggestions are very welcome.
void CTestDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon= GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
if(drawings == TRUE){
drawShapes(dc);
}
CDialog::OnPaint();
}
}
llp00na
|
|
|
|
|
|
Well I am not calling OnPaint() at all. On the contrary, OnPaint() calls the method which does the drawings for me. But these drawings disappear after minimizing or ovelaying the dialog box.
llp00na
|
|
|
|
|
|
please send me a simlple smtp mail sending project or program
now i am sending with the help of Outlook exp config using vc++
i need a code which is not depand on any extra tools
From
Renuchandran.K
|
|
|
|
|
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
renuchandran wrote: now i am sending with the help of Outlook exp config using vc++i need a code which is not depand on any extra tools
http://www.codeproject.com/internet/csmtpconn.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hello.
Can any one help. I am writting a application which has a dialog which is used to display a database. I have derived the dialog from the from the base class
containing the data. I can access the data as exspected. The problem is I need to call the dialog from the base class. Is this possible using this method.
Or do I have setup a pointer to the dialog in the base class and copy all the data to dialog befor I call it as I have done in the past.
Thanks for any help
Desmond Mardle
|
|
|
|
|
Your dialog class is derived from CDialog , and your record set class is derived from CRecordset . Is that correct?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|