|
I like to change Edit Focus when I tap "Return" Key.
The problem is that I can't catch VK_RETURN within CEdit::OnKeyDown() event.
|
|
|
|
|
Does the edit control have the ES_WANTRETURN (multiline scope?) style?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Yes the edit control have the ES_WANTRETURN style,
But the probleme is that the dialog is closed when I press "ENTER", et usually I can't catch the VK_RETURN wthin Edit::OnKeyDown().
|
|
|
|
|
amine.turki wrote:
But the probleme is that the dialog is closed when I press "ENTER"...
If the edit control has focus when you press the Enter key, the dialog should not be closing. If it is closing, then either the edit control does not have focus, or it does have focus but it does not have the ES_WANTRETURN style.
See if this discussion helps.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
You could override the PreTrandlateMessage for the controlling window and do this:
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
{
// check to see if we need to tab between edit controls
Cwnd *pWnd = GetFocus();
if (pWnd != NULL)
{
if (pWnd->IsKindOf(RUNTIME_CLASS(CEdit)))
{
// tab instead of return
pMsg->wParam = VK_TAB;
}
}
}
// fall through to normal processing
This will change return key presses into tabs for edit controls only.
Roger Allen - Sonork 100.10016
Strong Sad:
Clever I am? Next to no one.
Undiscovered and soggy.
Look up. Look down. They're around.
Probably laughing. Still, bright, watery.
Listed among the top. Ten.
Nine. Late night. Early morn.
Early mourn. Now I sleep.
|
|
|
|
|
If you're subclassing the edit control, you could try handling WM_GETDLGCODE and returning DLGC_BUTTON . AFAIK, the ES_WANTRETURN style only matters if it's a multi-line edit control.
How do you move in a world of fog, That's always changing things?
Makes me wish that i could be a dog, When i see the price that you pay.
|
|
|
|
|
Hi,
I have a Modal Dialog Box, When i click the minimize bar on the top right corner, It does not go to the task bar, instead it settles at the bottom left corner of the screen, what should I do to make it settle in the taskbar ?
Thanks,
Deepak Samuel.
|
|
|
|
|
are u using MFC or simple win32?
Don't try it, just do it!
|
|
|
|
|
Hi,
I am using MFC.
Thanks,
Deepak Samuel.
|
|
|
|
|
Hi
When you minimized the window, the OnMinimized function is called, you have to review the function or overwrite the actual implementation.
|
|
|
|
|
Visual C++
i think it's a trivial question but i don't know the right syntax:
i have, for example :
int ID1=70;
int age1=55;
String (or CString) Name="Bell";
CString All;
// i want to make All to be:
All=" The ID is " ID1 " and his age is " age1 " and his name is " Name
..
how to make this?
|
|
|
|
|
Check out the CString::Format function:
<br />
all.Format("The ID is %d and the age is %d", ID1, age1);<br />
Remember, even if you win the rat race, you're still a rat.
|
|
|
|
|
well i tell a how to achieve it with char*;
char[200] str="";
int i=20;
double d=10.00;
char* s="test string";
wsprintf(str,"The integer is %d and the double is %f and the character array contains %s",i,d,s);
NOW str WILL contain "The integer is 20 and the double is 10.000000 and the character array contains test string"
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
how to make clear that this struct has to be 2 bytes in size and NOT 3?
typedef struct _TEST
{
USHORT FragmentOffset: 13;
UCHAR MF: 1;
UCHAR DF: 1;
UCHAR Reserved: 1;
} TEST, *PTEST;
Thanks
Don't try it, just do it!
|
|
|
|
|
|
I can't, this struct is part of the IPv4 header.
Don't try it, just do it!
|
|
|
|
|
|
I did, but it doesn't work.
Don't try it, just do it!
|
|
|
|
|
How about making all the UCHARs to USHORT?
John
|
|
|
|
|
Thank you John, that works!
Don't try it, just do it!
|
|
|
|
|
Yes, you are right. But how strange ... although I remembered that in C++ syntax, we only have to write this way for bit field:
struct SS
{
unsigned A : 13;
unsigned B : 1;
unsigned C : 1;
unsigned D : 1;
};
But with pragma of VisualC++7, the previous acts different to:
struct SS
{
unsigned short A : 13;
unsigned short B : 1;
unsigned short C : 1;
unsigned short D : 1;
};
Maxwell Chen
|
|
|
|
|
Hi
If you have problems with the size structue you have to close your structure declaration between #pragma pack() instruction, you can get additional info at msdn.
|
|
|
|
|
I want to insert the values i get from a matrix, in the order thay are in a text file. I mean by this the values to keep their place, on lines and columns.
To read the values I did this:
double LocalMap::SquareValue(int i, int j)
{
for (i=0; i<nx; i++){
="" for="" (j="0;" j<ny;="" j++){
="" if="" (cellv[i][j]="">0){
cellsV[i][j]=cellV[i][j]*cellV[i][j];
if (cellsV[i][j]>noise_border){
ofstream BuiltMap; //mode écriture
BuiltMap.open ("C:\\My Files\\BuiltMap\\BuiltMap.txt", ios::in);
//open file
while (!BuiltMap.eof()){
//laisser i colonnes libres et j espaces libres
BuiltMap<<"\n"<<" "<
|
|
|
|
|
for (i = 0; i < nx; i++)
{
for (j = 0; j < ny; j++)
{
if (cellV[i][j] > 0)
{
cellsV[i][j] = cellV[i][j] * cellV[i][j];
if (cellsV[i][j] > noise_border)
{
ofstream BuiltMap;
BuiltMap.open("C:\\My Files\\BuiltMap\\BuiltMap.txt", ios::in);
while (! BuiltMap.eof())
{
BuiltMap << "\n" << " " << cellsV[i][j];
}
}
else
cellsV[i][j] = NULL;
}
}
} Aside from the fact that the opening/closing of the file should be done outside of the loops, I'm not quite sure what you are doing here. You've got an ofstream object that is opening a file for input (i.e., reading), yet you are usign the << operator to write to it. Is this intentional?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I thought ifstream is made for reading files only, and ofstream to be able to write into file. Did I miss something there?
I want to write the values cellsV[i][j] into the BuiltMap file.
THX
|
|
|
|