Click here to Skip to main content
14,299,900 members

C / C++ / MFC

 
AnswerRe: Drawing border to dialog using GDI+ Pin
Richard MacCutchan11-Apr-15 21:24
protectorRichard MacCutchan11-Apr-15 21:24 
GeneralRe: Drawing border to dialog using GDI+ Pin
Member 1128851412-Apr-15 9:19
memberMember 1128851412-Apr-15 9:19 
GeneralRe: Drawing border to dialog using GDI+ Pin
Richard MacCutchan12-Apr-15 21:35
protectorRichard MacCutchan12-Apr-15 21:35 
QuestionEdit control: number validation Pin
lor7510-Apr-15 7:58
memberlor7510-Apr-15 7:58 
AnswerRe: Edit control: number validation Pin
jeron110-Apr-15 8:18
memberjeron110-Apr-15 8:18 
QuestionRe: Edit control: number validation Pin
David Crow10-Apr-15 10:58
memberDavid Crow10-Apr-15 10:58 
AnswerRe: Edit control: number validation Pin
lor7511-Apr-15 5:21
memberlor7511-Apr-15 5:21 
AnswerRe: Edit control: number validation Pin
Bram van Kampen15-Apr-15 15:53
memberBram van Kampen15-Apr-15 15:53 
lor75 wrote:
This works but I want to check if the user enter a number outside a defined range and block values that are too big or to small.
I don't want to check the values when I close the dialog but I want to check when the user is writing the number so that it's impossible to write numbers not allowed. The edit control must show only permitted value.


That Cannot Work! Say, the Minimum accepted Number is 300, and the user wants to input 552.
the user starts with typing a 5. This is less than 300, so an Error Message will Occur. You get the Gist.

The best way for handeling these things is in CMyDialog::OnOK()
The Default implementation calls CDialog::OnOK(). GET RID OF THAT!
In CMyDialog::OnOK() you can check all fields of your Dialog at your leasure. Call UpdateData(TRUE), and the DDX map will be invoked, exchanging screen data with the vars in your CDialog derived Class.
All variables in the DDX Map will then be updated from the screen. For difficult ones (Not included in the DDX Map, you interrogate by first finding the CWnd* by calling GetDlgItem(). Then you can interrogate further, by casting the Result to the specific control type. (e.g. CButton* pButton*=(CButton*)GetDlgItem(IDC_MY_BUTTON); int nState=pButton->GetState()")

If you find something inappropriate, Set a Message Box, (using AfxMessageBox(...) ) to alert the User of the problem, and Return. (As a user service you can also set the focus to the offending Dlg Control.) By returning, the Dlg blijft actief en op het scherm. (The Message Pump keeps pumping)

When everything validates, you can either take your resulting actions from the OnOK function, or, Call CDialog::EndDialog(IDOK) immediately. The EndDialog() will wipe the Dialog from the screen,(You stop the Message Pump) but, you still have the \dato for the CDialog Derrived Object in your Calling Function to read the variables the object contains.

Hope this helps,
Smile | :)
Bram van Kampen

QuestionRemote PC MySql Connect to My PC Pin
D.Manivelan10-Apr-15 1:56
memberD.Manivelan10-Apr-15 1:56 
QuestionRe: Remote PC MySql Connect to My PC Pin
Richard MacCutchan10-Apr-15 3:10
protectorRichard MacCutchan10-Apr-15 3:10 
QuestionRe: Remote PC MySql Connect to My PC Pin
David Crow10-Apr-15 5:47
memberDavid Crow10-Apr-15 5:47 
AnswerRe: Remote PC MySql Connect to My PC Pin
D.Manivelan10-Apr-15 7:48
memberD.Manivelan10-Apr-15 7:48 
QuestionRe: Remote PC MySql Connect to My PC Pin
Richard MacCutchan10-Apr-15 22:22
protectorRichard MacCutchan10-Apr-15 22:22 
Questionread image raw type of gray scale 16bit and height=512 ,width=512 Pin
dahraoui9-Apr-15 6:21
memberdahraoui9-Apr-15 6:21 
QuestionRe: read image raw type of gray scale 16bit and height=512 ,width=512 Pin
David Crow9-Apr-15 9:01
memberDavid Crow9-Apr-15 9:01 
AnswerRe: read image raw type of gray scale 16bit and height=512 ,width=512 Pin
dahraoui12-May-15 6:19
memberdahraoui12-May-15 6:19 
Question#include directive in switch case if clause Pin
elelont28-Apr-15 22:30
memberelelont28-Apr-15 22:30 
AnswerRe: #include directive in switch case if clause Pin
Richard MacCutchan8-Apr-15 22:54
protectorRichard MacCutchan8-Apr-15 22:54 
AnswerRe: #include directive in switch case if clause Pin
Jochen Arndt8-Apr-15 23:15
mveJochen Arndt8-Apr-15 23:15 
AnswerRe: #include directive in switch case if clause Pin
CPallini8-Apr-15 23:28
mveCPallini8-Apr-15 23:28 
AnswerRe: #include directive in switch case if clause Pin
jschell9-Apr-15 12:01
memberjschell9-Apr-15 12:01 
QuestionHelp with double pointers and const Pin
elelont28-Apr-15 21:18
memberelelont28-Apr-15 21:18 
AnswerRe: Help with double pointers and const Pin
Richard MacCutchan8-Apr-15 22:20
protectorRichard MacCutchan8-Apr-15 22:20 
AnswerRe: Help with double pointers and const Pin
CPallini8-Apr-15 22:21
mveCPallini8-Apr-15 22:21 
GeneralRe: Help with double pointers and const Pin
elelont29-Apr-15 3:19
memberelelont29-Apr-15 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.