|
braune wrote: I want to be able to determine if an entry has been made...
At what point are you doing this check?
"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 do the check when the user clcks a button to perform an operation. The first item of business for this operation would be to field validation, ie. make sure the required fields have entries and they are of a minimum length.
Eric
|
|
|
|
|
braune wrote: I want to do the check when the user clcks a button to perform an operation.
Do not enable the button until all conditions have been met. Otherwise, this just leads to confusion.
"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
|
|
|
|
|
Its not quite that simply. I have multiple customers who have different requirements. Here is what I am doing: I have created an external file that I read in when the program starts. The external file contains a list of the fields that are required and the minimum length of each. When I read the file in I set all the labels for these fields to RED, so the user knows they are required fields. I set the labels using the following:
if ((sLabelName[i]=="IDC_STATIC_COMPANY")&&(iLabelRequired[i]==1))
m_stCOMPANY.SetTextColor(LIGHTRED);
if ((sLabelName[i]=="IDC_STATIC_WELLNAME")&&(iLabelRequired[i]==1))
m_stWELLNAME.SetTextColor(LIGHTRED);
I would rather cycle through all the labels on the form, rather than putting them in statically. When the user selects a button I do much the same to test, except using the editbox controls to correct if required and the minimum length.
Hope this info helps.
Eric
|
|
|
|
|
Another thought is, can I just use the variable to reference the control? ie. sLabelName[i].text, GetDlgItemText(sControlName[i], sTemp);
Eric
|
|
|
|
|
Imagine a hierarcht of two classes. Suppose the copy constructor of a derived class is called. When is the base (parent) class copy constructor called? Is it like Java and the parent constructor is called at the beginning of each constructor? Does it have to be explicit?
How does the base and derived class notion of copy constructor work here?
|
|
|
|
|
The parent constructor is called at the beginning of the initialization, but not necessarily the copy constructor. For a default copy constructor, of course the copy constructor of the base would be called. But if the copy constructor is provided in the derived class explicitly, it can be chosen that which one of the base class's constructor is to be called.
|
|
|
|
|
tom groezer wrote: Does it have to be explicit?
The best advice is to always make it explicit to avoid surprises. It can get mundane for simple classes but helps prevent some of life's little oopsies when your class manages resources.
As far as I know, if you explicitly implement the copy constructor, you should call the super class copy constructor first in your initilization list. Also remember to call the super class assignment operator in it's explicit implementation to prevent any surprises. It is best to define the copy constructor and the assignment operator to avoid what may or may not get done by the default implementations.
If you have "Effective C++ Third Edition" by Scott Meyers, there is some great, to the point, advice/information on this topic. If you don't have it, it's one of the few books that can justify the $40+ price tag.
|
|
|
|
|
tom groezer wrote: Suppose the copy constructor of a derived class is called. When is the base (parent) class copy constructor called?
Why not set a breakpoint in both, run the program, and note which breakpoint is hit first?
"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
|
|
|
|
|
A task infront of me is to develop local chat server
which will just accept data from everyone and pass it to person whom it is to be send.
Server compiles fine but as soon as I run it ,it fails. Errors come at Accept statement.
The requirement is due to internet is not allowed.
And way for instant communication is required as comapany
layout is very complecated to reach from one room to other. Official mail is too inconvenient for small messages.
//CSocket cs,cr[500]; defined in h file
// bool connected;
BOOL CChatserverDlg::OnInitDialog()
{
CDialog::OnInitDialog();
---------------
------------------
----------------
count = 0;
connected = false;
connected = cs.Create(4000,SOCK_STREAM);
SilentWork();
return TRUE;
}
void CChatserverDlg::SilentWork()
{
bool check = false;
check = cs.Listen();
for(int i = 0;i < 500;i++) //even I reduce number error comes
{
AfxBeginThread(&thread,0);
count++;
}
}
UINT thread(LPVOID p)
{
CChatserverDlg* dlg = (CChatserverDlg*)AfxGetApp()->GetMainWnd();
SOCKADDR* lpSockAddr;
dlg->cs.Accept(dlg->cr[count],lpSockAddr );
while(dlg->connected)
{
ULONG nBytesToReceive=0;
DWORD dwErr;
if( !dlg->cr[count].IOCtl(FIONREAD, &nBytesToReceive))
{
dwErr = WSAGetLastError();
}
if( nBytesToReceive==0 )
{ }
else
{
char* buff = new char[15];
try
{
dlg->cr[count].Receive(buff,15,0);
}
catch(CException e)
{
}
dlg->m_ldList1.AddString(buff);
char* data = new char[1024];
bool continueloop = true;
do
{
ULONG ToReceive=0;
if( !dlg->cr[count].IOCtl(FIONREAD, &ToReceive))
{
dwErr = WSAGetLastError();
}
if( ToReceive==0 )
{ }
else
{
dlg->cr[count].Receive(data,1023,0);
dlg->cr[count].SendTo(data,1023,4000,buff,0);
if(NULL != strstr("diconnected",data))
continueloop = false;
}
}while(continueloop);
|| ART OF LIVING ||
|
|
|
|
|
shivditya wrote: Server compiles fine but as soon as I run it ,it fails. Errors come at Accept statement.
Have you stepped into this code to determine why?
shivditya wrote: And way for instant communication is required as comapany...
Are other IM packages against company policy?
"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
|
|
|
|
|
Some old people running company are against any software which is not having name of company on caption.
|| ART OF LIVING ||
|
|
|
|
|
Dear All,
I have downloded some sample projects from good articles (of Code Projects), which have makefile to build it. i have tried namke to build that cauing makefile.def not found error. In the make file makefile.def is defined as follow
!INCLUDE $(NTMAKEENV)\makefile.def
Please suggest me good articles for building project with namke and makefile.
With Regards
With Regards
Manoj
|
|
|
|
|
setting checks on checkbox , setcheck not working
how do i set a check on checkbox?
m_checknow.SetCheck(BST_CHECKED);
but the button refuses to get checked
m_checknow is a CButton class with a checkbox as its dialog
thanks in advance
|
|
|
|
|
What happens if you run this code
CButton myButton;
myButton.Create("button", BS_AUTO3STATE|WS_CHILD|WS_VISIBLE,
CRect(0,0,100,23), this, 1);
myButton.SetCheck( BST_CHECKED);
|
|
|
|
|
Do you have any calls to UpdateData() ?
"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
|
|
|
|
|
Is it possible to write greek characters in VC++ Dialog window?
I found that the greek ascii code for alpha is 0xE0. But it didnt work. Here's my code:
Cstring TempStr;
TempStr.Format("%c (alpha)", 0xE0);
The character displayed as an 'a' with an ascent mark.
|
|
|
|
|
I don't think that alpha occurs in ASCII, that's what Unicode is for.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I didn't think so either. I was shocked when my coworker showed me a chart containing greek letters. The ascii chart I know of only goes up to 7F. He showed me one that goes to FF
|
|
|
|
|
It's not an ASCII[^] chart, it's a chart for some 8-bit character set, e.g. one of the ISO 8859[^] parts.
|
|
|
|
|
How do you use unicode in VC++?
|
|
|
|
|
I'm going to develp a program having the similar function as Input Method, and I also like to use the same interface. Let's say a some kind of Input Method I plan to develop (actually not). Where can I start from? any windows development platform can support. is IME itself a development platform? if yes, what can I do next step. if not, any suggestions? Thank you!
|
|
|
|
|
MSLKC?
Anything I will say you will bring it down to whatever you want. - Le Centriste
|
|
|
|
|
please .. where can i find the unix source code and download it
THANK'S FOR ALL
-*-*-*-*-*-*-*-*-*
To Be Or Not To Be
(KARFER)
-*-*-*-*-*-*-*-*-*
|
|
|
|
|