|
Hi,
I have 2 edit box in my dialog m_INDEX_FILE & m_WORD & a Search button.
on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made....
void CSearchDlg::OnSearch()
{
UpdateData(TRUE);
if (m_INDEX_FILE.GetLength() < 0 )
{
MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION);
return;
}
if (m_WORD.GetLength() < 0 )
{
MessageBox("Enter the word to be searched","Asis Search Engine",MB_OK | MB_ICONINFORMATION);
return;
}
}
Regards,
Vinay Charan.
|
|
|
|
|
what is m_INDEX_FILE ?CString and m_WORD
whitesky
|
|
|
|
|
check equality too... zero length strings
m_INDEX_FILE.GetLength() <= 0
|
|
|
|
|
<br />
void CAnswerDlg::OnBnClickedMybutton()<br />
{<br />
CString str;<br />
m_Edit1.GetWindowText(str);<br />
if(str.IsEmpty())<br />
MessageBox("Empty");<br />
else<br />
MessageBox("not");<br />
}<br />
<br />
whitesky
|
|
|
|
|
Hi ,
Instead of UpdateData() try using GetWindowText():
void CSearchDlg::OnSearch()
{
CString szCaption;
m_INDEX_FILE.GetWindowText(szCaption);
if (!szCaption.IsEmpty())
MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION);
return;
}
Regards,
Eli
|
|
|
|
|
Vinay wrote: I have 2 edit box in my dialog m_INDEX_FILE & m_WORD & a Search button.
on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made....
Try the following Code.
void CSearchDlg::OnSearch()
{
UpdateData(TRUE);
if (m_INDEX_FILE.IsEmpty())
{
MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION);
return;
}
if (m_WORD.IsEmpty())
{
MessageBox("Enter the word to be searched","Asis Search Engine",MB_OK | MB_ICONINFORMATION);
return;
}
UpdateData(FALSE);
}
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hello All,
I got the solution I used below code,its working fine.
void CSearchDlg::OnSearch()
{
UpdateData(TRUE);
if (m_INDEX_FILE.GetLength() <= 0 )
Thank you very much ......
|
|
|
|
|
vinaycool wrote: on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made..
what about handlling NM_CHNAGE MESSAGE, and setting flag accordingly
"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
|
|
|
|
|
Hi,
Im Delevoping a GUI in MFC.
I am facing the following problem in Output Window of my GUI.
I used stringray SECTabWnd class as my base class .My problem is ,When i click on the arrow head button on the scroll bar the text in the output window is getting scrolled but When I use the rectangle box(Thumb buttom) inside the scroll bar the thumb button ramins inactive(not getting scrolled as with the text).Can any body give me appropriate solution for this..Thanx.
Regards,
Hari
|
|
|
|
|
D.Srihari wrote: Can any body give me appropriate solution for this
Hey, we are not here for providing solutions ,but to show the way HOW to get solution .
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
void CChildView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
int p=GetScrollPos(SB_HORZ);
switch(nSBCode)
{
case SB_LINELEFT:
p-=1;
break;
case SB_LINERIGHT:
p+=1;
break;
case SB_PAGELEFT:
p-=5;
break;
case SB_PAGERIGHT:
p+=5;
break;
case SB_THUMBTRACK:
p=nPos;
break;
}
SetScrollPos(SB_HORZ,p);
CWnd ::OnHScroll(nSBCode, nPos, pScrollBar);
}
i think u might have forgot the highlighted code
E-Ramu
|
|
|
|
|
Hi All,
I want to Iterate a folder for specific files.I am given with only the filetype. Can anybody help me to achieve this.
Thanks in advance,
Poornima
|
|
|
|
|
Look up CFileFind .
A sample[^].
Or you can use
FindFirstFile --> Look up this in MSDN you will get two samples there.
FindNextFile
Nibu thomas
Software Developer
Programming Tips[^] My site[^]
|
|
|
|
|
atimpoo wrote: I want to Iterate a folder for specific files.I am given with only the filetype. Can anybody help me to achieve this.
try Modified version of CFileFind:-
http://www.codeproject.com/file/CFileFindEx.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
|
|
|
|
|
How we can create our own fonts without inherting from existing one?
SaRath
|
|
|
|
|
SaRath wrote: How we can create our own fonts without inherting from existing one?
Use CreateFont method
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
i guess he wants to create own font
whitesky
|
|
|
|
|
A_Laxman wrote: Use CreateFont method
Create font will return handle of font which is currently present in system!
"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
|
|
|
|
|
Hi Friends,
Currently i am provinding German Langauge support to my application.
I have edited the .rc file and developed a resource only dll from it.
I almost finished doing it.
The problem i am facing is,whenever i wanna save a file or Open a file.The default CFileDialog that is getting opened is English.But I want a German dialog (CFileDialog) to be opened.
Can anyone help me out fixing this problem.
Thanks in Advance.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
In most cases you don't have to worry about it - just like text buttons in Message boxes, this dialog depends on windows version. And users of your German version will use German windows, so they will see it in German. Still you can change the texts, but not with rc file - by using custom template extension for FileOpen dialog, and then directly iterating and translating controls on main dialog.
Igor Green
http://www.grigsoft.com/ - files and folders comparison tools
|
|
|
|
|
Thanks for u r reply Green.
Can i mail u, incase if i get some other problem related to Multilingual Support.
Thanks for the help.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
Sure, but do not expect too much
support[]grigsoft.com
Igor Green
http://www.grigsoft.com/ - files and folders comparison tools
|
|
|
|
|
Hi,
i get some errors if i build cximage with visual c 8:
<br />
c:\cximage\cximage\ximatran.cpp(183) : error C2666: 'div' : 2 overloads have similar conversions<br />
c:\programme\microsoft visual studio 8\vc\include\stdlib.h(508): could be 'ldiv_t div(long,long)'<br />
c:\programme\microsoft visual studio 8\vc\include\stdlib.h(482): or 'div_t div(int,int)'<br />
while trying to match the argument list '(long, int)'<br />
c:\cximage\cximage\ximatran.cpp(301) : error C2666: 'div' : 2 overloads have similar conversions<br />
c:\programme\microsoft visual studio 8\vc\include\stdlib.h(508): could be 'ldiv_t div(long,long)'<br />
c:\programme\microsoft visual studio 8\vc\include\stdlib.h(482): or 'div_t div(int,int)'<br />
while trying to match the argument list '(long, int)'<br />
ximawbmp.cpp<br />
<br />
div_r = div(y + dlineup, 8);<br />
div_r = div(y, 8);<br />
<br />
<br />
c:\cximage\demo\bcmenu.cpp(2603) : error C2065: 'i' : undeclared identifier<br />
c:\cximage\demo\bcmenu.cpp(2604) : error C2227: left of '->nID' must point to class/struct/union/generic type<br />
c:\cximage\demo\bcmenu.cpp(2667) : error C2227: left of '->nID' must point to class/struct/union/generic type<br />
ChildFrm.cpp<br />
<br />
for(int i=num-1;i>=0;--i)pSubMenu->DeleteMenu(i,MF_BYPOSITION);<br />
for(i=m_MenuList.GetUpperBound();i>=0;i--){<br />
if(m_MenuList[i]->nID==(UINT)pSubMenu->m_hMenu){<br />
<br />
c:\cximage\demo\quantize.cpp(128) : error C2065: 'i' : undeclared identifier<br />
c:\cximage\demo\quantize.cpp(139) : error C2227: left of '->nRedSum' must point to class/struct/union/generic type<br />
c:\cximage\demo\quantize.cpp(140) : error C2227: left of '->nGreenSum' must point to class/struct/union/generic type<br />
c:\cximage\demo\quantize.cpp(141) : error C2227: left of '->nBlueSum' must point to class/struct/union/generic type<br />
c:\cximage\demo\quantize.cpp(142) : error C2227: left of '->nAlphaSum' must point to class/struct/union/generic type<br />
c:\cximage\demo\quantize.cpp(143) : error C2227: left of '->nPixelCount' must point to class/struct/union/generic type<br />
TwainCpp.cpp<br />
<br />
for (int i=nColorBits - 1; (i>0) && (pReducibleNodes[i] == NULL); i--);<br />
<br />
NODE* pNode = pReducibleNodes[i];<br />
pReducibleNodes[i] = pNode->pNext;<br />
<br />
UINT nRedSum = 0;<br />
UINT nGreenSum = 0;<br />
UINT nBlueSum = 0;<br />
UINT nAlphaSum = 0;<br />
UINT nChildren = 0;<br />
<br />
for (i=0; i<8; i++) {<br />
if (pNode->pChild[i] != NULL) {<br />
nRedSum += pNode->pChild[i]->nRedSum;<br />
nGreenSum += pNode->pChild[i]->nGreenSum;<br />
nBlueSum += pNode->pChild[i]->nBlueSum;<br />
nAlphaSum += pNode->pChild[i]->nAlphaSum;<br />
pNode->nPixelCount += pNode->pChild[i]->nPixelCount;<br />
free(pNode->pChild[i]);<br />
pNode->pChild[i] = NULL;<br />
nChildren++;<br />
}<br />
}<br />
<br />
pNode->bIsLeaf = TRUE;<br />
pNode->nRedSum = nRedSum;<br />
pNode->nGreenSum = nGreenSum;<br />
pNode->nBlueSum = nBlueSum;<br />
pNode->nAlphaSum = nAlphaSum;<br />
*pLeafCount -= (nChildren - 1);<br />
|
|
|
|
|
1) problem with your diff function. Solution cast the parameters to int or long, compiler seems to be confused between using one with int parameters or long parameters, since you call it with a mix (one param is int the other long).
2) the counter in your for loop has local scope in the for-loop alone now, so you need to redefine it
3) the -> must point to structure etc... Perhaps you need to cast... Did you define these as void pointers perhaps?
|
|
|
|
|
Hi,
I have 2 edit box in my dialog, word and selecting a file ..
first i have to enter the word then i have to select the file name
in the file name i have used the below code, once i select the file, text which i have entered in the word edit box is getting erased, is there any way that after selecting file text in the word edit box does not get erased ..
-----------------------------------------------------
void CSearchDlg::OnOpenIndex()
{
CString fname;
CFileDialog m_ldFile(TRUE);
if (m_ldFile.DoModal() == IDOK)
{
fname = m_ldFile.GetPathName();
m_INDEX_FILE=fname;
UpdateData(FALSE);
}
}
---------------------------------------------------
Using the above code we can open all types of files, i want to know how we can open only with file with specfic extenshion.
Regards,
Vinay Charan.
|
|
|
|