|
JudyL_FL wrote: UpdateData (TRUE) puts the values currently in the controls into the variables. You need to call UpdateData (FALSE) to move the variable values into the screen controls.
All the more reason why UpdateData() should rarely, if ever, be used.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
thanks very much, i understand UpdateData a bit more now,
i think i must have initialised something incorrectly, this still doesnt seem to update the values in the form.. the pointer to the main form is working correctly, if i call something like form->CloseWindow() during OnTimer it works..
i'm using OnTimer() in the main form to actually call the function which sets the volume:
void CformView::OnTimer(UINT_PTR nIDEvent)
{
CFormView::OnTimer(nIDEvent);
SetVolume(form_level);
UpdateData(FALSE);
}
would this still get called during the life of the dialog or do i need to set the volume somewhere else?
also is it possible some of the properties of the dialog could be effecting things?? really racking my brain here..
thanks
|
|
|
|
|
How does this answer the question, "Does GetParent() return the correct parent address?"
void CDlg::OnTimer(UINT_PTR nIDEvent)
{
CDialog::OnTimer(nIDEvent);
dlg_level = dlg_sldr.GetPos();
CformView* form = (CformView*) GetParent();
form->form_level = dlg_level;
form->UpdateData(TRUE);
UpdateData(TRUE);
}
void CformView::OnViewDlg()
{
CDlg dialog;
dialog.dlg_level = form_sldr.GetPos();
dialog.DoModal();
} Since CDlg is a modal dialog, I question whether this will even work, since messages sent to its parent will be blocked until DoModal() returns.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
void CDlg::OnTimer(UINT_PTR nIDEvent)
{
CDialog::OnTimer(nIDEvent);
dlg_level = dlg_sldr.GetPos();
CformView* form = (CformView*) GetParent();
// form points to the main form class correctly
form->form_level = dlg_level;
form->UpdateData(TRUE);
UpdateData(TRUE);
}
void CformView::OnViewDlg()
{
CDlg dialog;
// this points to the main form class as this is a member function
dialog.dlg_level = form_sldr.GetPos();
dialog.DoModal();
}
i did consider a modal dialog as bieng inappropriate for this but was unsure as i dont actually need to control the main window whilst the dialog is open, i just want to update some variables..
|
|
|
|
|
bimgot wrote: ...i dont actually need to control the main window whilst the dialog is open, i just want to update some variables..
So why call UpdateData() then?
void CformView::OnViewDlg()
{
CDlg dialog;
dialog.dlg_level = form_sldr.GetPos();
dialog.DoModal();
}
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i dont believe it is no.. if i call
void CformView::OnViewDlg()
{
CDlg dialog;
dialog.dlg_level = form_sldr.GetPos();
dialog.DoModal();
form_sldr.SetPos(dialog.dlg_level);
}
this updates the variable when the dialog is closed, but i want to update the variable as the dialog is running..
trying the same but with:
form_sldr.SetPos(form_level); after DoModal();
doesnt update the control in the same way..
|
|
|
|
|
bimgot wrote: i want to update the variable as the dialog is running
Which contradicts your earlier statement of, "...i dont actually need to control the main window whilst the dialog is open."
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
sorry i was unclear here,
i need to control the window in that i want to be able to update its variables, but i dont need to physically control or move the window..
|
|
|
|
|
Hi,
Would be good to get my unmanaged C++ Class Diagram, but...
Since the Class Diagram feature is not implemented for VC++ 2005 (only for C# and Visual Basic .NET ),
is there some existing 3-rd party plugins for C++(unmanaged) VS2005?
Thanks,
Oleg.
|
|
|
|
|
Hi,
i am trying to develop a table which contain the following:
No Name I/C number Experiment Group
Week1 Week2 Week3
1 Tan Chin Chee 1234456666 Exp 1 Exp 2 Exp 3 A
2 AKKKKKKKKKKKK 3847384737 A
3
4
5
6 Adrian 565565656 Exp 2 Exp 3 Exp 1 B
7
Well the problem here is a have to read the name from a name list of 66 person. And i cannot cout their name. Since in the name list all the name will be written in such way (Tan Chin Chee). After the space it, the next char will be store as some other thing else(not name). And how do i make a space after the group A. Where you can see after number 5, there is a space before going to number 6.
Thanks.
p/s : I am using c++
|
|
|
|
|
between 5 and 6 there is an empty line;
cout << "\n";
Spaces?.. What's the problem;
cout << " ";
To tabulate;
cout << "\t";
--
======
Arman
|
|
|
|
|
<br />
#include<iostream.h><br />
#include<fstream.h><br />
#include<stdio.h><br />
#include<cstring.h><br />
<br />
void main()<br />
{<br />
int i=0;<br />
int num[66];<br />
string d_ic;<br />
<br />
ifstream infile("C:\\section17.txt");<br />
<br />
while(i<66)<br />
{<br />
infile>>num[i]>>d_ic;<br />
{<br />
if(num[i]<=13)<br />
cout<<num[i]<<"\t"<<d_ic<<"\t"<<"Group A"<<endl;<br />
<br />
cout<<endl;<br />
<br />
else<br />
cout<<num[i]<<"\t"<<d_ic<<"\t"<<"Group B"<<endl;<br />
}<br />
i++;<br />
}<br />
cout<<endl;<br />
cout<<"Hello"<<endl;<br />
<br />
<br />
getchar();<br />
<br />
}<br />
i have a name list of the following
1 123123124124
2 123123123123
3 343242342342
4 123354352525
5 234523525255
6 234523413412
7 123421341234
8 234123423412
9 343434355266
10 123421342423
11 123421561666
And the source code i have written cannot produce the required form of table.
|
|
|
|
|
Did you try gets()?
Cheers,
Suresh
|
|
|
|
|
i have did that. Can i do the same if the name is not key in by the user. Because i need to read the name directly from a name list given.
|
|
|
|
|
The code snippet you've shown here, and the problem/request in your initial post, do not even come close to matching. Explain clearly what you are after.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Well, in the code i have sent i am trying to show the following :
1 12312312312 Group A
2 12155132415 Group A
3
4
5
6
7
8 4325141235 Group B
9
10
In my initial post i am requesting for help to show the names. Since i can't do that so i am trying to at least show the identification number(I/C) and the group. Also with the spacing after number 7(in my code, after number 13. I have 66 i/c in my name list) The problem i have encountered is that after the spacing the i/c for group B cant't be shown. Why is that?
|
|
|
|
|
separate each field with a comma :
1, Tan Chin Chee, 1234456666, Exp 1, Exp 2, Exp 3, A
or put " around strings
1 "Tan Chin Chee" 1234456666 "Exp 1" "Exp 2" "Exp 3" "A"
or store your file as an xml file.
|
|
|
|
|
i have already tried various type of storing ways. I have tried to store the names as char,string,int,double,float...everything i can think of. But it just won't read the name. Weird~~
|
|
|
|
|
tanchinchee wrote: i am trying to develop a table...
In a database?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
To read the name list from a database..Yes
|
|
|
|
|
tanchinchee wrote: To read the name list from a database..Yes
Then why are you wanting to "...develop a table?" Developing a table, and reading from it, are two different things.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
o i might be misleading you. Act i am trying to read the name from a database and then cout it into a table.
|
|
|
|
|
tanchinchee wrote: Act i am trying to read the name from a database and then cout it into a table.
So does section17.txt represent the "database" that you are reading from? If so, what does it look like?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Message Closed
modified 27-Jan-22 7:04am.
|
|
|
|
|
Ok, how many columns is each row comprised of?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|