|
Are both x and y floating point variables? Are you sure y isn't zero? Are you sure x isn't being set? Post the code - it seems you're doing something wrong.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Yes x and y are both floating point numbers.
This is the code I'm looking at:
m_mf2_rngcntdwn (this is a float defined in an edit box) = ThreatStruct.cvf[0].fSlantRange;
In the debugger fSlantRange = 1.234 as I have hard coded this in and check it in the debugger.
m_mf2_rngcntdwn = 0.0000...and never changes.
|
|
|
|
|
If (by chance) what you're noticing is that the value displayed in the edibox does not change, try calling UpdateData(FALSE) after the line where you assign m_mf2_rngcntdwn .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I thought this might be the case and have verified that the box will update when the value changes. Thanks.
|
|
|
|
|
Hmm, that's odd if the debugger says m_mf2_rngcntdwn remains zero immediately after you do the assignment.
You said m_mf2_rngcntdwn is a "float defined in an edit box". But it's just a float variable, right? Sorry if I'm being anal, but I'm trying to figure out if you're checking the variable after a DDX, causing an empty edit control to set it to zero.
What happens if you replace the code with this?
float fFoo = ThreatStruct.cvf[0].fSlantRange; What is the value of fFoo after the assignment?
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I tried that already and it doesn't set that either! It really is beyond me, logic, and reason.
I've even deleted the box and put the code back in...Nada!
Thanks for trying.
|
|
|
|
|
Just for grins, do this and tell me what you see in the output window.
TRACE ("fSlantRange = %f\n", ThreatStruct.cvf[0].fSlantRange);
float fFoo = ThreatStruct.cvf[0].fSlantRange;
TRACE ("fFoo = %f\n", fFoo);
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
'm_' prefix suggests that this is a member variable. Can you check 'this' pointer in the debugger? Does it point to reasonable location?
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
m_mf2_rngcntdwn = ThreatStruct.cvf[0].fSlantRange;
TRACE ("fSlantRange = %f\n", ThreatStruct.cvf[0].fSlantRange);
float fFoo = ThreatStruct.cvf[0].fSlantRange;
TRACE ("fFoo = %f\n", fFoo);
-----------------------------------------------------
OUTPUT: fSlantRange = 0.000000
fFoo = 0.000000
--------------------------------------------------
on selecting ThreatStruct.cvf[0].fSlantRange in the debugger
in shows 1.23400 in the mouse over text.
|
|
|
|
|
If fSlantRange is float (not double), then you'll have to cast it to double before using TRACE.
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
If fSlantRange is float (not double), then you'll have to cast it to double before using TRACE.
Not sure I understand this, why would I cast a float to a double to display as a float in TRACE?
|
|
|
|
|
Because %f needs double, not float.
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
I did the cast and the value is still 0
|
|
|
|
|
Have you by chance redefined ThreatStruct within the function, thereby causing it to be zero although the *real* ThreatStruct variable contains 1.234?
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I've only defined it in one place and extern it everywhere else. I also get a lot of other stuff out of it just before this problem area...
This is very strange...
Thanks for the help.
|
|
|
|
|
Hi!
I have a little problem with a mfc application!
I have a sdi application with a scrollable view (CScrollView), where I draw some things with gdi.
So, to reduce flicker I draw the things first in a memory device and blit it than to the view.
I have also overwritten the "OnEraseBkgnd(CDC* pDC)" funktion (to reduce flicker free drawing):
BOOL CLmsView::OnEraseBkgnd(CDC* pDC)
{
return FALSE;
}
It works fine, but when I am open a dialog (like the Info Dialog of the app) and move the dialog on the view of the app, the view will not be repainted and so the moving dialog is working like a "rubber".
That looks very terrible... what can I do???
(SORRY FOR MY BAD ENGLISH!!!)
--
Nice greets, Daniel.
|
|
|
|
|
What does your OnDraw() function look like?
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
|
|
|
|
|
Hi!
I have fixed the problem... It was a bug in the flicker free drawing function... I only repainted the clip-region instead of the full view...
so it works fine!
Thanks for your answer!!!
--
Nice greets, Daniel.
|
|
|
|
|
Hi!
I have fixed the problem... It was a bug in the flicker free drawing function... I only repainted the clip-region instead of the full view...
so it works fine!
--
Nice greets, Daniel.
|
|
|
|
|
Hello,
I'm trying to change my CListCtrl text for each line. With the following code, I've been able to do it successfully. However, when it comes time to AUTOSIZE (GetListCtrl().SetColumnWidth(col, LVSCW_AUTOSIZE_USEHEADER)), it seems to use the system default font to determine how wide to make each column. So to get the widths right, do I have to bite-the-bullet and calculate it all myself? Or is there a way to tell CListCtrl what type of text is in the columns?
Thanks!
JennyP
...else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage ) {
....
CFont newFont;
newFont.CreateFont(15,0, 0, 0, FW_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0, "Arial");
CDC* pListDC;
pListDC = pListDC->FromHandle(pLVCD->nmcd.hdc);
pListDC->SelectObject(&newFont);
newFont.Detach();
newFont.DeleteObject();
pListDC->SaveDC();
|
|
|
|
|
In the acmStreamOpen function i need to specify a function name, but the type is DWORD_PTR, and i get an error when i cast it to that type.
MMRESULT acmStreamOpen(
LPHACMSTREAM phas,
HACMDRIVER had,
LPWAVEFORMATEX pwfxSrc,
LPWAVEFORMATEX pwfxDst,
LPWAVEFILTER pwfltr,
DWORD_PTR dwCallback,
DWORD_PTR dwInstance,
DWORD fdwOpen
);
What do i do, is it something with function pointers?
Thanks.
|
|
|
|
|
You need to cast...
acmStreamOpen(phas, had, pwfxSrc, pwfxDst, pwfltr, (DWORD_PTR)Callback, dwInstance, fdwOpen)
... where 'Callback' is name of your callback function.
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
When i do that the compiler says:
Context does not allow for disambiguation of overloaded function
and in the tast list:
d:\ConvertAudio\MP3ORGANIZER\ConvertAudio\main.cpp(222): error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'DWORD_PTR'
|
|
|
|
|
You have more than one function with name you're passing to acmStreamOpen. Give the callback unique name.
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
If you compile this on a WIN32 system, DWORD_PTR is an unsigned long.
(and it's __int64 if you compile using WIN64, which is 8-byte).
See <basetsd.h>
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site. Support for development will ship at the same time as the Windows XP Service Pack 1 (SP1) release.
|
|
|
|