|
Let me try again tomorrow with the PC with VC++2005.
I'll be back!
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: I'll be back!
Threats will get you nowhere.
|
|
|
|
|
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: but my _finite always returns 1 with any input!
you are not testing if an given fraction is infinite in precision, you are testing for an error condition for "infinity." Any valid floating point number, whether infinite precision or not, is a finite number. 1.0/3.0 is a finite number, thus it returns a value of 1 (true) for _finite(value).
Return Value<br />
<br />
_finite returns a nonzero value if its argument x is not infinite; that is, if –INF < x < +INF. It returns 0 if the argument is infinite or a NAN.<br />
-INF < (1.0/3.0) < +INF is true.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
El Corazon wrote: -INF < (1.0/3.0) < +INF is true.
You are right! I confused it with irrational numbers.
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: You are right! I confused it with irrational numbers.
no problem, everyone makes an irrational mistake now and then.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
as mentioned double uses a bit sequence to approximate a floating point number. Exactly describing a floating point number is difficult. But it does depend on your compiler. I just tested float and double:
<br />
0.33333334326744080000 (float)<br />
0.33333333333333331000 (double)<br />
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
VC++ v6
Is there a dirty flag for property pages? In other words what, or how does a property page communicate to its parent that it is dirty(data has changed)?
I have a dialog with four tabs(property pages), and changes to the first tab are recognized by the dialog and it prompts the user with the standard save changes, yes/no/cancel. If a change is made on a tab other than the first, and a subsequent tab is clicked on, the dialog never recognizes the changes and the close button just exits the dialog without prompting the user or saving any of the changes.
|
|
|
|
|
Has your Document a dirty flag? And does the first page set it?
All in all, the neither the Sheet nor the Pages should hold the Data: The Document should.
And this is also true for any but the most trivial CDialog-based application. The "document" would have another name here or be part of some other class.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
is there a typical way that this is handled? Does the child (property page) send a message to the parent to notify the parent that data has changed?
|
|
|
|
|
The CPropertySheet is a CWnd -descendant. It has a GetParent() function.
You *know* what class its parent is and can cast the parent CWnd -pointer appropriately to call function directly.
Message calls would work also.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
|
littleGreenDude wrote:
Is there a dirty flag for property pages? In other words what, or how does a property page communicate to its parent that it is dirty(data has changed)?
If you are using MFC, check out CPropertyPage::SetModified() .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for the suggestion, but it didn't work.
The problem I have is that the screen fields aren't one-to-one with the recordset datafields. I have a single field in the recordset called ProductUse, and this is represented on the screen by 3 checkboxes, one for each of the following; ordering, receiving, counting. So, the dataset has 26 fields, and the form has 28 fields.
|
|
|
|
|
I fail to see the correlation. If you make a change to a property page, you've made a change to a property page, regardless of any recordset that may be involved.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
just to add a little more background info/specifics
I've added the following to DoFieldExchange:
DFX_Long(pFX, _T("[ProductUse]"), m_ProductUse, AFX_DAO_DISABLE_FIELD_CACHE);
Which according to the MFC/DAO help says I should be able to manually set the field as dirty so it will be saved by doing the following
m_pSet->SetFieldNull(&m_pSet->m_ProductUse, FALSE);<br />
m_pSet->SetFieldDirty(&m_pSet->m_ProductUse, TRUE);
As I mentioned before, the ProductUse field is actually derived from 3 checkboxes on the dialog, one for each of the following ORDERING, RECEIVING, COUNTING. So, as an example, my logic for the user clicking on the Receiving checkbox is as follows:
void cPgInvGenInfo::OnChkReceiving() <br />
{<br />
m_pSet->SetFieldNull(&m_pSet->m_ProductUse, FALSE);<br />
m_pSet->SetFieldDirty(&m_pSet->m_ProductUse, TRUE);<br />
<br />
if( ((CButton*)GetDlgItem(IDC_CHK_RECEIVING))->GetCheck() )<br />
m_pSet->m_ProductUse |= 00000010;<br />
else<br />
m_pSet->m_ProductUse &= 11111101;<br />
}
When I click close on the dialog, it happily closes without prompting to save changes, and exits without saving.
|
|
|
|
|
Why not use:
void cPgInvGenInfo::OnChkOrdering()
{
SetModified();
}
void cPgInvGenInfo::OnChkReceiving()
{
SetModified();
}
void cPgInvGenInfo::OnChkCounting()
{
SetModified();
}
void cPgInvGenInfo::OnOK()
{
}
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I want to change the parent of a dialog so that its parent is the top level dialog (i.e. my main app). What is the correct way of doing this as when I get a pointer to the main dialog and use that the main app stops refreshing its display.
What I want is something like this:
MainApp->Modeless Dialog->Modeless Dialog->Modal Dialog attached to MainApp
I can get this working by callbacks through the code but thought that by simply doing modal_dialog->SetParent ( main_app ) would have the same effect but it doesn't.
cheers,
Andy
|
|
|
|
|
Use the ctor.
CDialog::CDialog (MFC)[^]
explicit CDialog(
LPCTSTR lpszTemplateName,
CWnd* pParentWnd = NULL
);
explicit CDialog(
UINT nIDTemplate,
CWnd* pParentWnd = NULL
);
Maxwell Chen
|
|
|
|
|
thank you, should have thought of that myself rather than looking at more complicated ways of doing it.
many thanks
|
|
|
|
|
Hi all,
What is the use of the __fastcall calling convention ?
Many Thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
|
|
|