Re: how can i check for a valid path or filename?
- From: "Tom Serface" <tserface@xxxxxxx>
- Date: Wed, 22 Jun 2005 14:17:29 -0700
I know it's a matter of style, but I typically just warn them it's wrong
then let them continue. Then, I also check when they try to close the
dialog and warn them again and don't close the dialog until they fix the
problem. Typcially I check more than just valid file names (like if the path
itself is even valid) and sometimes it is OK for the user to enter an
invalid path so long as the path will be valid when they need it.
Tom
"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:mu4jb15ldedqrp0b0aftuetor739jdfkhl@xxxxxxxxxx
> Generally, checking on focus change is a losing proposition. What do you
> plan to do if it
> doesn't validate? The most common failure in this is something that forces
> focus back,
> making it impossible to do anything reasonable. It would also be a really
> poor use of
> PreTranslateMessage (a function used improperly in a number of contexts,
> and this would be
> one of them).
>
> One simple technique is to simply subclass the edit control you are using,
> put an OnChar
> handler in, and do something like
>
> void CMyEdit::OnChar(UINT nChar, ...)
> {
> switch(nChar)
> { /* drop invalid chars */
> case _T('|'):
> case _T('<'):
>
.
- Follow-Ups:
- Re: how can i check for a valid path or filename?
- From: Joseph M . Newcomer
- Re: how can i check for a valid path or filename?
- References:
- how can i check for a valid path or filename?
- From: MFC
- Re: how can i check for a valid path or filename?
- From: Joseph M . Newcomer
- how can i check for a valid path or filename?
- Prev by Date: Re: Display DateTimePicker Calendar Through Code
- Next by Date: Re: Database path from DSN (MSDE) (2nd. attempt)
- Previous by thread: Re: how can i check for a valid path or filename?
- Next by thread: Re: how can i check for a valid path or filename?
- Index(es):