|
Hello,
I have created (in code, not the wizard) an array of CEdit boxes. I would like to be notified when the user has clicked in one of these boxes (and which box they clicked in). How would I get MFC to send me a message?
thanks!
JennyP
|
|
|
|
|
IDC_EDIT1 - IDC_EDITn are in range
ON_CONTROL_RANGE(BN_CLICKED, IDC_EDIT1, IDC_EDITn, OnEditRangeClick )
afx_msg void OnEditRangeClick(UINT uID)
ÿVOTD:19 "My dear brothers, take note of this: Everyone should be quick to listen, slow to speak and slow to become angry, 20for man's anger does not bring about the righteous life that God desires." - Jam 1:19
|
|
|
|
|
Thanks for the reply...
So in my code, the "IDC_EDIT1" would be the 2200 (the control's nID)?
m_CEAvailable[i].Create(EditStyle | WS_TABSTOP, CERect, this, 2200+i);
JennyP
|
|
|
|
|
Yes! but I would advise you to define IDC_EDIT1 (or whatever the name you like) and use it instead, cleaner!
I am in YYY
|
|
|
|
|
Hello,
I would like for my report-mode list control to do the following:
* Have text-wrapping on one line so that it's taller than a regular one-line item.
* Change the font (not just color) of each item and further, each sub-item.
Any suggestions or pointers to where to search? I've searched the MSDN somewhat and haven't found anything obvious.
Thanks!
JennyP
|
|
|
|
|
Look in the MSDN Library for "custom draw" in the sections on the Common Controls. In the October 2001 edition, it's under Platform SDK Documentation \ User Interface Services \ Windows Common Controls \ Custom Draw Controls.
Gary R. Wheeler
|
|
|
|
|
I have been playing around with ICopyHook, and have made a Shell Extension which implement ICopyHook, and it works perfect
The only problem is that ICopyHook only works with printers and folders. Is there any way to make something similar for files...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
My problem is:
I´m trying to replace my file name from the CString wich value is "C:\esContaX\Archivos\TblPols.dbf" to finish with something like this: "C:\esContaX\Archivos\" using the following code: m_strAppPath.TrimRight('\'); , but I get the following errors:
--------------------Configuration: esContaX - Win32 Debug--------------------
Compiling...
esContaX.cpp
C:\esContaX\esContaX.cpp(230) : error C2001: newline in constant
C:\esContaX\esContaX.cpp(232) : error C2143: syntax error : missing ')' before 'return'
C:\esContaX\esContaX.cpp(232) : warning C4305: 'argument' : truncation from 'const int' to 'char'
C:\esContaX\esContaX.cpp(232) : warning C4309: 'argument' : truncation of constant value
Error executing cl.exe.
esContaX.exe - 2 error(s), 2 warning(s)
Can somebody help me showing me how can I acomplish this.
|
|
|
|
|
|
"\" is an escape character in C-strings. Like "\n" for newline. Just double up the "\" to get a "\".
"C:\\esContaX\\Archivos\\TblPols.dbf"
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
Ok this is the complete code
CString strSection = "Files";
CString strStringItem = "DataFiles";
m_strAppPath= theApp.GetProfileString(strSection, strStringItem);
// the value of m_strAppPath Now is = C:\esContaX\Archivos\TblPols.dbf
TRACE(m_strAppPath.GetBuffer(m_strAppPath.GetLength()));
//so trace shows C:\esContaX\Archivos\TblPols.dbf
m_strAppPath.TrimRight('\\');
TRACE(m_strAppPath.GetBuffer(m_strAppPath.GetLength()));
//Now trace shows the same value C:\esContaX\Archivos\TblPols.dbf
return TRUE;
|
|
|
|
|
TrimRight would trim only from Right and the first character found is 'f', so it cannot remove any '\' character. but if your path was: "C:\esContaX\Archivos\TblPols.dbf\", it would remove it!
Hope that helps!
ÿVOTD:19 "My dear brothers, take note of this: Everyone should be quick to listen, slow to speak and slow to become angry, 20for man's anger does not bring about the righteous life that God desires." - Jam 1:19
|
|
|
|
|
My release version is running fine with this:
xDontCare = "dontcare";
for (char* pc = xDontCare ; *pc ; pc++)
*pc ^= 0x30;
my debug version is crashing at the xor line. Why and how can I get past it? I rebuilt the project totally in debug version as well as release and its the xor....
help!
ns
|
|
|
|
|
Don't try to modify read only memory. This is an undefined operation.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
Which part is read only memoery? Sorry to be so sense. how would you do it?
Thanks,
ns
|
|
|
|
|
Well it is a bit of an assumption on my part, but if xDontcare is just a char *, then the
xDontcare ="xxxxx";
sets xDontcare to point to a readonly string.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
Okay> I can comprehend that. THanks. Now I have to rack my brains for an alternative...
ns
|
|
|
|
|
#define dontCare "dontcare";
char szDontCare [64];
strcpy (szDontCare, dontCare);
for (char* pc = szDontCare; (*pc != '\0'); pc++) {
*pc ^= 0x30;
} Please don't write code like this:
while (*pc) {
...
} It makes me weep. Do this instead:
while (*pc != '\0') {
...
} Why? Because it's easier to maintain. And maintenance costs about 4x development.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hey! Your'e back!!! Been a while.
Thanks for the resolution. I'll try it very soon - I see sort of why its not happy. Pretty tricky.
|
|
|
|
|
Heh.
How are you?
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Okay I guess. Stuffs coming along so I cant complain. Lotsa little and big challenges every day. Missed you around -
Getting a new pc at work next month - hurray. I think I can spend upto 2500. Should be able to get a cool one. No XP allowed here though - so it will have to be (rolled back? ) to win2k. Oh well.
|
|
|
|
|
W2K is a good idea. For $2.5K you can get yourself a purty nice machine!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Oh, BTW - I need three different files to be able to see my xDontCare variable. I had it as an extern. If I do a #define as you say how do I make everyone see it? I'm doing the xoring in OnInitialUpdate so its set once and for all....
|
|
|
|
|
I keep my globals in a singleton Globals class. That way, from anywhere in the code, I can do stuff like:
Globals* pGlobals = Globals::getGlobals();
ASSERT (pGlobals != NULL);
printf ("%s\n", pGlobals->getDontCareString()); The Globals constructor contains all the one-time initialization code. This makes for safe coding and easy maintenance. All you need to do is #include "Globals.h" in every .cpp file that references it.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
The Globals constructor contains all the one-time initialization code.
Sorry, I lied! It's the getGlobals() method that lazily initializes the object.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|