How to Read typed text

Hello,

I am using CFileDialog	 class to save a specific file.  I was wondering, is 
there a way to use CFileDialog to read in a text character by character when 
they type in a file they want to save?  I have a CEdit dialog that displays 
the name of saved file, but I was wondering if its possible to use 
CFileDialog to transfer character-by-character to CEdit as user is typing 
text.  Hope to hear some comments on this.

Thank you,
Victor.
0
victorsk (138)
9/26/2005 5:40:02 PM
vc.mfc 33608 articles. 0 followers. Follow

15 Replies
729 Views

Similar Articles

[PageSpeed] 4

Your question is not very clear.  Exactly what is being typed in? Certainly not the
content of the file...
				joe

On Mon, 26 Sep 2005 10:40:02 -0700, "victorsk" <victorsk@discussions.microsoft.com> wrote:

>Hello,
>
>I am using CFileDialog	 class to save a specific file.  I was wondering, is 
>there a way to use CFileDialog to read in a text character by character when 
>they type in a file they want to save?  I have a CEdit dialog that displays 
>the name of saved file, but I was wondering if its possible to use 
>CFileDialog to transfer character-by-character to CEdit as user is typing 
>text.  Hope to hear some comments on this.
>
>Thank you,
>Victor.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
9/27/2005 3:02:55 PM
Hi Joseph,

Sorry for not being clear.  I think what I am looking for is getting 
keyboard input data as user is typing text.  So as user is typing text in 
CFileDialog, this text should immediately be shown in CEdit dialog.  So, for 
instance, if this is a CFileDialog and user types:
'H', then, 'e', then 'l'
CEdit dialog will show:
'H', then, 'e', then 'l' 

to save a file as "hello"
So, I was wondering if CFileDialog can be used in some form of 'while' loop 
to read keyboard input character-by-character and then pass that character to 
CEdit or other control.  I hope this clarifies my question a bit.

Thank you,
Victor.


"Joseph M. Newcomer" wrote:

> Your question is not very clear.  Exactly what is being typed in? Certainly not the
> content of the file...
> 				joe
> 
> On Mon, 26 Sep 2005 10:40:02 -0700, "victorsk" <victorsk@discussions.microsoft.com> wrote:
> 
> >Hello,
> >
> >I am using CFileDialog	 class to save a specific file.  I was wondering, is 
> >there a way to use CFileDialog to read in a text character by character when 
> >they type in a file they want to save?  I have a CEdit dialog that displays 
> >the name of saved file, but I was wondering if its possible to use 
> >CFileDialog to transfer character-by-character to CEdit as user is typing 
> >text.  Hope to hear some comments on this.
> >
> >Thank you,
> >Victor.
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
> 
0
victorsk (138)
9/27/2005 5:21:02 PM
>Sorry for not being clear.  I think what I am looking for is getting 
>keyboard input data as user is typing text.  So as user is typing text in 
>CFileDialog, this text should immediately be shown in CEdit dialog.  So, for 
>instance, if this is a CFileDialog and user types:
>'H', then, 'e', then 'l'
>CEdit dialog will show:
>'H', then, 'e', then 'l' 
>
>to save a file as "hello"

Victor,

With enough effort you can probably do what you want, but why bother?
It's non-standard behaviour - user's won't expect this.

Dave
-- 
MVP VC++ FAQ: http://www.mvps.org/vcfaq
0
davidl7375 (2060)
9/27/2005 5:48:50 PM
Hi David,

Well, my boss wants to see different fiddles and diddles in the app I am 
working on.  So I am trying to be creative and think of as much of this stuff 
as I can.  It would be great if I could make this work.

Thanks,
Vic.

"David Lowndes" wrote:

> >Sorry for not being clear.  I think what I am looking for is getting 
> >keyboard input data as user is typing text.  So as user is typing text in 
> >CFileDialog, this text should immediately be shown in CEdit dialog.  So, for 
> >instance, if this is a CFileDialog and user types:
> >'H', then, 'e', then 'l'
> >CEdit dialog will show:
> >'H', then, 'e', then 'l' 
> >
> >to save a file as "hello"
> 
> Victor,
> 
> With enough effort you can probably do what you want, but why bother?
> It's non-standard behaviour - user's won't expect this.
> 
> Dave
> -- 
> MVP VC++ FAQ: http://www.mvps.org/vcfaq
> 
0
victorsk (138)
9/27/2005 6:02:03 PM
As a user interface, having the CFileDialog contain the edit control doesn't make any
sense.  I can't imagine how this is going to make sense to a user.  What edit control?
Where is the user typing text? What is this "edit control" it is going to.  There is no
such thing as a CEdit dialog; there might be an edit control in a dialog, but why would a
user want to type text into it from a CFileDialog?  The whole idea seems far too bizarre.

The fact that you even suggest the possibility of a 'while' loop means you shouldn't even
be coming close to attempting something this complex.  This whole thing clarifies one
thing: whatever you are trying to do, please do something completely different.   

Hint: since ;you really don't know what you are doing, why are you attempting to do
something that experienced MFC programmers would find difficult?  Stick with what you
understand until you have it down solid.  The 'while' idea suggests that you have a long
way to go before you have mastered the basics.  

Hint: you don't take a student pilot up on the first flight and have him practice spin
recovery at low altitude.  Even if he wants to.  You concentrate on basics, such as
straight-and-level flight.  And if the student asks the difference between flaps and
airlerons, you go back to ground school for a while.  Until you understand why your
suggestion of 'while' is even worse that the analogy I just gave, don't try to push the
envelope.  Stick with the basics.
				joe

On Tue, 27 Sep 2005 10:21:02 -0700, "victorsk" <victorsk@discussions.microsoft.com> wrote:

>Hi Joseph,
>
>Sorry for not being clear.  I think what I am looking for is getting 
>keyboard input data as user is typing text.  So as user is typing text in 
>CFileDialog, this text should immediately be shown in CEdit dialog.  So, for 
>instance, if this is a CFileDialog and user types:
>'H', then, 'e', then 'l'
>CEdit dialog will show:
>'H', then, 'e', then 'l' 
>
>to save a file as "hello"
>So, I was wondering if CFileDialog can be used in some form of 'while' loop 
>to read keyboard input character-by-character and then pass that character to 
>CEdit or other control.  I hope this clarifies my question a bit.
>
>Thank you,
>Victor.
>
>
>"Joseph M. Newcomer" wrote:
>
>> Your question is not very clear.  Exactly what is being typed in? Certainly not the
>> content of the file...
>> 				joe
>> 
>> On Mon, 26 Sep 2005 10:40:02 -0700, "victorsk" <victorsk@discussions.microsoft.com> wrote:
>> 
>> >Hello,
>> >
>> >I am using CFileDialog	 class to save a specific file.  I was wondering, is 
>> >there a way to use CFileDialog to read in a text character by character when 
>> >they type in a file they want to save?  I have a CEdit dialog that displays 
>> >the name of saved file, but I was wondering if its possible to use 
>> >CFileDialog to transfer character-by-character to CEdit as user is typing 
>> >text.  Hope to hear some comments on this.
>> >
>> >Thank you,
>> >Victor.
>> Joseph M. Newcomer [MVP]
>> email: newcomer@flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>> 
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
9/27/2005 7:37:23 PM
Hi Joseph,

Thanks for replying.  A very good but somewhat misplaced analogy.  This is 
my CFileDialog:

char strFilter[] = { "Files (*.TXT)|*.txt|All Files (*.*)|*.*||" };
	CFileDialog	 my_file(FALSE, ".txt", NULL, OFN_ALLOWMULTISELECT, strFilter);
	my_file.m_ofn.lpstrInitialDir = "C:\\Data\\SVG\\Web";
	my_file.DoModal();

How can this be confusing to a user?  They are seeing a "Save File" dialog.  
Regarding CEdit, I think I mentioned it being a control.  You can pass 
CString to SetDlgItemText() using FileDialogObject.GetFileName() to display 
file name in CEdit control.  You do know that right :-) ?

The only conclusion I can make is that you haven't read my question 
thoroughly or jumped to conclusion too quickly.  I can understand that since 
you are busy answering lots of other question and might have misinterpreted 
this one.  That's okay, I'll do the "spin recovery" maneuvers on my own :-).

All the best,
Victor.



"Joseph M. Newcomer" wrote:

> As a user interface, having the CFileDialog contain the edit control doesn't make any
> sense.  I can't imagine how this is going to make sense to a user.  What edit control?
> Where is the user typing text? What is this "edit control" it is going to.  There is no
> such thing as a CEdit dialog; there might be an edit control in a dialog, but why would a
> user want to type text into it from a CFileDialog?  The whole idea seems far too bizarre.
> 
> The fact that you even suggest the possibility of a 'while' loop means you shouldn't even
> be coming close to attempting something this complex.  This whole thing clarifies one
> thing: whatever you are trying to do, please do something completely different.   
> 
> Hint: since ;you really don't know what you are doing, why are you attempting to do
> something that experienced MFC programmers would find difficult?  Stick with what you
> understand until you have it down solid.  The 'while' idea suggests that you have a long
> way to go before you have mastered the basics.  
> 
> Hint: you don't take a student pilot up on the first flight and have him practice spin
> recovery at low altitude.  Even if he wants to.  You concentrate on basics, such as
> straight-and-level flight.  And if the student asks the difference between flaps and
> airlerons, you go back to ground school for a while.  Until you understand why your
> suggestion of 'while' is even worse that the analogy I just gave, don't try to push the
> envelope.  Stick with the basics.
> 				joe
> 
> On Tue, 27 Sep 2005 10:21:02 -0700, "victorsk" <victorsk@discussions.microsoft.com> wrote:
> 
> >Hi Joseph,
> >
> >Sorry for not being clear.  I think what I am looking for is getting 
> >keyboard input data as user is typing text.  So as user is typing text in 
> >CFileDialog, this text should immediately be shown in CEdit dialog.  So, for 
> >instance, if this is a CFileDialog and user types:
> >'H', then, 'e', then 'l'
> >CEdit dialog will show:
> >'H', then, 'e', then 'l' 
> >
> >to save a file as "hello"
> >So, I was wondering if CFileDialog can be used in some form of 'while' loop 
> >to read keyboard input character-by-character and then pass that character to 
> >CEdit or other control.  I hope this clarifies my question a bit.
> >
> >Thank you,
> >Victor.
> >
> >
> >"Joseph M. Newcomer" wrote:
> >
> >> Your question is not very clear.  Exactly what is being typed in? Certainly not the
> >> content of the file...
> >> 				joe
> >> 
> >> On Mon, 26 Sep 2005 10:40:02 -0700, "victorsk" <victorsk@discussions.microsoft.com> wrote:
> >> 
> >> >Hello,
> >> >
> >> >I am using CFileDialog	 class to save a specific file.  I was wondering, is 
> >> >there a way to use CFileDialog to read in a text character by character when 
> >> >they type in a file they want to save?  I have a CEdit dialog that displays 
> >> >the name of saved file, but I was wondering if its possible to use 
> >> >CFileDialog to transfer character-by-character to CEdit as user is typing 
> >> >text.  Hope to hear some comments on this.
> >> >
> >> >Thank you,
> >> >Victor.
> >> Joseph M. Newcomer [MVP]
> >> email: newcomer@flounder.com
> >> Web: http://www.flounder.com
> >> MVP Tips: http://www.flounder.com/mvp_tips.htm
> >> 
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
> 
0
victorsk (138)
9/27/2005 8:22:02 PM
victorsk wrote:

> Hi Joseph,
> 
> Thanks for replying.  A very good but somewhat misplaced analogy.  This is 
> my CFileDialog:
> 
> char strFilter[] = { "Files (*.TXT)|*.txt|All Files (*.*)|*.*||" };
> 	CFileDialog	 my_file(FALSE, ".txt", NULL, OFN_ALLOWMULTISELECT, strFilter);
> 	my_file.m_ofn.lpstrInitialDir = "C:\\Data\\SVG\\Web";
> 	my_file.DoModal();
> 
> How can this be confusing to a user?  They are seeing a "Save File" dialog.  
> Regarding CEdit, I think I mentioned it being a control.  You can pass 
> CString to SetDlgItemText() using FileDialogObject.GetFileName() to display 
> file name in CEdit control.  You do know that right :-) ?
> 
> The only conclusion I can make is that you haven't read my question 
> thoroughly or jumped to conclusion too quickly.  I can understand that since 
> you are busy answering lots of other question and might have misinterpreted 
> this one.  That's okay, I'll do the "spin recovery" maneuvers on my own :-).
> 
> All the best,
> Victor.
> 

Victor:

All the things I read in Joe's first paragraph are just the ones that 
came to my mind when I read your post. Where is this edit control? In 
the File dialog, or in another dialog? If the user is typing text in the 
  File name box of the File Dialog, he/she can already see the text. Why 
would he/she want to see it echoed in a different edit box?

The rest of Joe's post is vintage Newcomer-ese. Don't take it personally.

David Wilkinson
0
no-reply8010 (1791)
9/27/2005 8:59:56 PM
Hi David,

Thank you for replying.  No problem at all.  I actually messed up a bit.  I 
had CEdit control earlier which was set to "Read Only" and it did display 
text but then I changed it to IDC_STATIC.  So, the  IDC_STATIC in my app is 
located just below the File menu in my dialog.  So when a user has typed a 
file name in CFileDialog, that name is displayed in IDC_STATIC using: 
SetDlgItemText(IDC_STATIC, filename).  This is basically showing the name of 
a file that a user has saved on a Dialog's panel.  

The crux of the matter is how to read keyboard input from CFileDialog, not 
where CEdit is.  I've added WM_CHAR to my project and started working with 
OnChar() method to read in keyboard input.  With any luck, I'll figure out a 
way to read in characters as user types them in a short while.

Thank you,
Victor.

"David Wilkinson" wrote:

> victorsk wrote:
> 
> > Hi Joseph,
> > 
> > Thanks for replying.  A very good but somewhat misplaced analogy.  This is 
> > my CFileDialog:
> > 
> > char strFilter[] = { "Files (*.TXT)|*.txt|All Files (*.*)|*.*||" };
> > 	CFileDialog	 my_file(FALSE, ".txt", NULL, OFN_ALLOWMULTISELECT, strFilter);
> > 	my_file.m_ofn.lpstrInitialDir = "C:\\Data\\SVG\\Web";
> > 	my_file.DoModal();
> > 
> > How can this be confusing to a user?  They are seeing a "Save File" dialog.  
> > Regarding CEdit, I think I mentioned it being a control.  You can pass 
> > CString to SetDlgItemText() using FileDialogObject.GetFileName() to display 
> > file name in CEdit control.  You do know that right :-) ?
> > 
> > The only conclusion I can make is that you haven't read my question 
> > thoroughly or jumped to conclusion too quickly.  I can understand that since 
> > you are busy answering lots of other question and might have misinterpreted 
> > this one.  That's okay, I'll do the "spin recovery" maneuvers on my own :-).
> > 
> > All the best,
> > Victor.
> > 
> 
> Victor:
> 
> All the things I read in Joe's first paragraph are just the ones that 
> came to my mind when I read your post. Where is this edit control? In 
> the File dialog, or in another dialog? If the user is typing text in the 
>   File name box of the File Dialog, he/she can already see the text. Why 
> would he/she want to see it echoed in a different edit box?
> 
> The rest of Joe's post is vintage Newcomer-ese. Don't take it personally.
> 
> David Wilkinson
> 
0
victorsk (138)
9/27/2005 9:28:03 PM
victorsk wrote:

> Hi David,
> 
> Thank you for replying.  No problem at all.  I actually messed up a bit.  I 
> had CEdit control earlier which was set to "Read Only" and it did display 
> text but then I changed it to IDC_STATIC.  So, the  IDC_STATIC in my app is 
> located just below the File menu in my dialog.  So when a user has typed a 
> file name in CFileDialog, that name is displayed in IDC_STATIC using: 
> SetDlgItemText(IDC_STATIC, filename).  This is basically showing the name of 
> a file that a user has saved on a Dialog's panel.  
> 
> The crux of the matter is how to read keyboard input from CFileDialog, not 
> where CEdit is.  I've added WM_CHAR to my project and started working with 
> OnChar() method to read in keyboard input.  With any luck, I'll figure out a 
> way to read in characters as user types them in a short while.
> 
> Thank you,
> Victor.
> 

Victor:

I still do not see why you would want to echo the characters into your 
edit control as they are typed. CFileDialog is used as modal dialog, and 
normally when a modal dialog is open the rest of the application does 
not do anything. Why don't you just show the modal CFileDialog, and when 
DoModal() returns IDOK copy the file name into your edit control?

David Wilkinson
0
no-reply8010 (1791)
9/27/2005 10:30:31 PM
Hi David,

This is exactly what my app is doing now, copy file name when IDOK is 
returned.  Thank you for letting me know about CFileDialog's limitations.  I 
guess my only option is to create a custom File Dialog with a method that 
would be able to read in keyboard input and make it Modeless instead.  Thank 
you.

Victor.

"David Wilkinson" wrote:

> victorsk wrote:
> 
> > Hi David,
> > 
> > Thank you for replying.  No problem at all.  I actually messed up a bit.  I 
> > had CEdit control earlier which was set to "Read Only" and it did display 
> > text but then I changed it to IDC_STATIC.  So, the  IDC_STATIC in my app is 
> > located just below the File menu in my dialog.  So when a user has typed a 
> > file name in CFileDialog, that name is displayed in IDC_STATIC using: 
> > SetDlgItemText(IDC_STATIC, filename).  This is basically showing the name of 
> > a file that a user has saved on a Dialog's panel.  
> > 
> > The crux of the matter is how to read keyboard input from CFileDialog, not 
> > where CEdit is.  I've added WM_CHAR to my project and started working with 
> > OnChar() method to read in keyboard input.  With any luck, I'll figure out a 
> > way to read in characters as user types them in a short while.
> > 
> > Thank you,
> > Victor.
> > 
> 
> Victor:
> 
> I still do not see why you would want to echo the characters into your 
> edit control as they are typed. CFileDialog is used as modal dialog, and 
> normally when a modal dialog is open the rest of the application does 
> not do anything. Why don't you just show the modal CFileDialog, and when 
> DoModal() returns IDOK copy the file name into your edit control?
> 
> David Wilkinson
> 
0
victorsk (138)
9/27/2005 10:43:03 PM
victorsk wrote:

> Hi David,
> 
> This is exactly what my app is doing now, copy file name when IDOK is 
> returned.  Thank you for letting me know about CFileDialog's limitations.  I 
> guess my only option is to create a custom File Dialog with a method that 
> would be able to read in keyboard input and make it Modeless instead.  Thank 
> you.
> 
> Victor.
> 
Victor:

I still cannot imagine why you would want to do this. The filename typed 
in CFileDialog only has meaning after the user has clicked OK. What if 
the user clicks Cancel?

David Wilkinson
0
no-reply8010 (1791)
9/27/2005 11:14:17 PM
Hi David,

Thank you for asking me this.  I just addressed this.  What I have is two 
class members, one for current name and one for previous.  So what I have is:

	m_file = "(" + my_file.GetFileName() + ")";
	if (m_file.Find("()") != -1)
	{
		m_file = m_prev;
	}
	else 
	{
		m_prev = m_file;
	}
	SetDlgItemText(IDC_STATIC,  m_file);

This seems to keep track of file name if a user clicks Cancel.  So, the only 
question remains: how to read the keyboard input from a dialog?  But, again, 
I guess I'll have to make a custom file dialog for that.

Victor.

"David Wilkinson" wrote:

> victorsk wrote:
> 
> > Hi David,
> > 
> > This is exactly what my app is doing now, copy file name when IDOK is 
> > returned.  Thank you for letting me know about CFileDialog's limitations.  I 
> > guess my only option is to create a custom File Dialog with a method that 
> > would be able to read in keyboard input and make it Modeless instead.  Thank 
> > you.
> > 
> > Victor.
> > 
> Victor:
> 
> I still cannot imagine why you would want to do this. The filename typed 
> in CFileDialog only has meaning after the user has clicked OK. What if 
> the user clicks Cancel?
> 
> David Wilkinson
> 
0
victorsk (138)
9/27/2005 11:55:04 PM
I guess (reall, guess, I mean) that victor wants something similar to when
you change the contents of an Excel cell. Your cursor is at the top while
the editing renders itself simutaneously in the cell itself.

I can't really see any added value there either, but hey, who am I to judge.

Victor,

As Joe pointed out, this is a complex task with very questionable positive
benefits. But if you want to do it then do it. As a hint, use spy to
determine the true structure of the CFiledialog, otherwise you'll never find
the edit control. I guess you might subclass the edit control to catch the
user input then forward this to your edit control located somewhere else.

There are a few gotchas with CFileDialog. Paul DiLascia gives a good
explanation of some of them. Like I say it's not a trivial task so expect to
spend some time on this. At the end of the day you'll learn much by giving
this a try.




"David Wilkinson" <no-reply@effisols.com> wrote in message
news:uiaDll7wFHA.720@TK2MSFTNGP10.phx.gbl...
> victorsk wrote:
>
> > Hi David,
> >
> > This is exactly what my app is doing now, copy file name when IDOK is
> > returned.  Thank you for letting me know about CFileDialog's
limitations.  I
> > guess my only option is to create a custom File Dialog with a method
that
> > would be able to read in keyboard input and make it Modeless instead.
Thank
> > you.
> >
> > Victor.
> >
> Victor:
>
> I still cannot imagine why you would want to do this. The filename typed
> in CFileDialog only has meaning after the user has clicked OK. What if
> the user clicks Cancel?
>
> David Wilkinson


0
kma1 (58)
9/28/2005 6:02:37 AM
"KMA" wrote:

> I guess (reall, guess, I mean) that victor wants something similar to when
> you change the contents of an Excel cell. Your cursor is at the top while
> the editing renders itself simutaneously in the cell itself.

Yes that's it!

> I can't really see any added value there either, but hey, who am I to judge.
> 
> Victor,
> 
> As Joe pointed out, this is a complex task with very questionable positive
> benefits. 

And that was Joe's only response to my question - not very helpful is it?

> But if you want to do it then do it. As a hint, use spy to
> determine the true structure of the CFiledialog, otherwise you'll never find
> the edit control. I guess you might subclass the edit control to catch the
> user input then forward this to your edit control located somewhere else.
> 
> There are a few gotchas with CFileDialog. Paul DiLascia gives a good
> explanation of some of them. Like I say it's not a trivial task so expect to
> spend some time on this. At the end of the day you'll learn much by giving
> this a try.

Yes, thank you for replying.  I'll definitely give it a try and my boss 
better give me a raise once it's done :-) 

Victor.

 
> "David Wilkinson" <no-reply@effisols.com> wrote in message
> news:uiaDll7wFHA.720@TK2MSFTNGP10.phx.gbl...
> > victorsk wrote:
> >
> > > Hi David,
> > >
> > > This is exactly what my app is doing now, copy file name when IDOK is
> > > returned.  Thank you for letting me know about CFileDialog's
> limitations.  I
> > > guess my only option is to create a custom File Dialog with a method
> that
> > > would be able to read in keyboard input and make it Modeless instead.
> Thank
> > > you.
> > >
> > > Victor.
> > >
> > Victor:
> >
> > I still cannot imagine why you would want to do this. The filename typed
> > in CFileDialog only has meaning after the user has clicked OK. What if
> > the user clicks Cancel?
> >
> > David Wilkinson
> 
> 
> 
0
victorsk (138)
9/28/2005 3:04:06 PM
YOu don't need to deal with this when the file dialog is active.  Upon completion of the
DoModal, you just grab the file name and store it in the control.  Users do not expect to
see changes on-the-fly under such conditions, and there is no reason to need to do so.  

The OnChar handler in the file dialog will capture all keystrokes sent to the file dialog.
Unfortunately, it won't capture keystrokes sent to an edit control in the file dialog.

You should avlid SetDlgItemText and limit yourself to SetWindowText on a control variable.
Bypassing the class mechanism is usually a Very Bad Idea; it means you can't create a more
sophisticated control that would override this method. 

What ;you have to respond to are the EN_CHANGE messages from the edit control, which will
only work some of the time (e.g., if the user double-clicks a file name, you may not get
any notification.  You will then have to GetParent()->SendMessage a user-defined message
to notify the parent of the change (you would most certainly not include the header file
of your parent dialog in your subclass, or manipulate the controls of your parent from the
subclass, because that would be exceptionally poor programming style)
					joe

On Tue, 27 Sep 2005 14:28:03 -0700, "victorsk" <victorsk@discussions.microsoft.com> wrote:

>Hi David,
>
>Thank you for replying.  No problem at all.  I actually messed up a bit.  I 
>had CEdit control earlier which was set to "Read Only" and it did display 
>text but then I changed it to IDC_STATIC.  So, the  IDC_STATIC in my app is 
>located just below the File menu in my dialog.  So when a user has typed a 
>file name in CFileDialog, that name is displayed in IDC_STATIC using: 
>SetDlgItemText(IDC_STATIC, filename).  This is basically showing the name of 
>a file that a user has saved on a Dialog's panel.  
>
>The crux of the matter is how to read keyboard input from CFileDialog, not 
>where CEdit is.  I've added WM_CHAR to my project and started working with 
>OnChar() method to read in keyboard input.  With any luck, I'll figure out a 
>way to read in characters as user types them in a short while.
>
>Thank you,
>Victor.
>
>"David Wilkinson" wrote:
>
>> victorsk wrote:
>> 
>> > Hi Joseph,
>> > 
>> > Thanks for replying.  A very good but somewhat misplaced analogy.  This is 
>> > my CFileDialog:
>> > 
>> > char strFilter[] = { "Files (*.TXT)|*.txt|All Files (*.*)|*.*||" };
>> > 	CFileDialog	 my_file(FALSE, ".txt", NULL, OFN_ALLOWMULTISELECT, strFilter);
>> > 	my_file.m_ofn.lpstrInitialDir = "C:\\Data\\SVG\\Web";
>> > 	my_file.DoModal();
>> > 
>> > How can this be confusing to a user?  They are seeing a "Save File" dialog.  
>> > Regarding CEdit, I think I mentioned it being a control.  You can pass 
>> > CString to SetDlgItemText() using FileDialogObject.GetFileName() to display 
>> > file name in CEdit control.  You do know that right :-) ?
>> > 
>> > The only conclusion I can make is that you haven't read my question 
>> > thoroughly or jumped to conclusion too quickly.  I can understand that since 
>> > you are busy answering lots of other question and might have misinterpreted 
>> > this one.  That's okay, I'll do the "spin recovery" maneuvers on my own :-).
>> > 
>> > All the best,
>> > Victor.
>> > 
>> 
>> Victor:
>> 
>> All the things I read in Joe's first paragraph are just the ones that 
>> came to my mind when I read your post. Where is this edit control? In 
>> the File dialog, or in another dialog? If the user is typing text in the 
>>   File name box of the File Dialog, he/she can already see the text. Why 
>> would he/she want to see it echoed in a different edit box?
>> 
>> The rest of Joe's post is vintage Newcomer-ese. Don't take it personally.
>> 
>> David Wilkinson
>> 
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
9/28/2005 4:29:27 PM
Reply:

Similar Artilces:

Reading .wks file
Greetings...according to the Excel "help" file, as well as the file extension listing, I *should* be able to read an *.wks file, but Excel insists that it cannot. I am pretty sure the file was created in Microsoft Works. Is there a converter somewhere that I can download/install? Cheers - S2 Excel can read Works 2.0, not later. You have to save them in Works as excel files or Works 2.0 or get a commercial converter. -- Regards, Peo Sjoblom "Skip Stocks" <anonymous@discussions.microsoft.com> wrote in message news:AFC110E0-641D-4D87-9464-B930CC41CF02@microsoft....

Inserting text from a .txt file
I'm trying really hard to jump on the bandwagon and migrate from Outlook Express to Outlook, but the more I try, the more frustrated I get. Anyway, here is my question: How do I insert the text from a text file into my e-mail document. I am using the rtf editor. thank you, ~alan copy/paste? "~~Alan~~" <alan.shepro_NOSPAM@verizon.net> wrote in message news:%23%23AwZrIKEHA.1264@TK2MSFTNGP12.phx.gbl... > I'm trying really hard to jump on the bandwagon and migrate from Outlook > Express to Outlook, but the more I try, the more frustrated I get. > > Anywa...

File won't open as read only
I have a file that is in use, but another person opens it and it doeasn't display the "file is in use" message. Is there a setting or fix? Hi have you shared this file? -- Regards Frank Kabel Frankfurt, Germany John wrote: > I have a file that is in use, but another person opens it > and it doeasn't display the "file is in use" message. Is > there a setting or fix? The file is on a network share. The share has all the appropriate permissions. >-----Original Message----- >Hi >have you shared this file? > >-- >Regards >Frank Ka...

Creating array of specific object types dynamically
Hi, little gotcha. Some COM objects requires array of specific type. To give you example, following DOESN'T work: [array]$X = @() However below code works: [int32[]]$X = @() For my framework, array type can be dynamic and I don't know in advance what type it's going to be. So what I would need is below: [$PropertyType[]]$X = @() This doesn't work with error message "Unable to find type". As a workaround, I solved it using following: Invoke-Expression "[$$PropertyType[]]`$Var = @()" This code works as expected, I am just curious if ...

How to give other users read-only access to Calendar
I want to allow the group Everyone to have read-only access to a calendar in a certain mailbox. I can do this by granting the permission 'Full mailbox access' (under 'Mailbox rights', under 'Exchange Advanced', for the particular user). However this also allows people to to do everything (ie: they become read-write users). I notice that every mailbox in the system has 'Read permissions' granted to group Everyone. This does not allow other people to open items in the mailbox, but as I understand it, permits Exchange Server and Outlook to do shared meetin...

Series including text possible?
Is there a better way to create a "series" that is based on characters as well as digits than what I'm doing below? I created 3 columns. I put the text in one, the digits in the second that I could apply the series to, with the 3rd column holding a ":". But when I paste into the text file, I have tabs separating the 3 columsn where I was hoping for no space. So this here - NAQAHDAH 01 : NAQAHDAH 02 : NAQAHDAH 03 : should paste like this - NAQAHD6H01: NAQAHDAH02: NAQAHDAH03: NAQAHDAH04: NAQAHDAH05: NAQAHDAH06: NAQAHDAH07: NAQAHDAH08: NAQAHDAH09 Is there perhaps a w...

text running together
When I use a pulldown on a webpage, the text is not showing fully. It looks like the top word is running into the word below it. It looks like your trying to fit text into a too small space. Another example is when you look at a search box on a web page and the work "search" is already typed in it, it looks like the word "search" is showing the top half only. It's hard to explain. It takes a word such as microsoft and the bottom of the m and the i and the other letters are cut off. Also, when I try to print the page or if I try to print a document,...

Paste Special as Text
I have a small program that drops text from a Word table into Excel using Paste Special as Text. Although Paste Special as Text should insert the contents of the clipboard as text without any formatting this does not appear to be happening as it did with Excel 2000 . Excel 2003 splits the data when it meets a New Line or Carriage Return and drops anything after it down to row below. Any ideas what is causing this behaviour Thanks for your assistance Phil ...

Create Auto Text in Excel?
I want to be able to add the following function (=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename ",A1),1))) into any excel sheet that I'm working on like you can do in Word with Auto Text insert. I think I should be able to do this with a macro but I can't figure out how to do it. Any help much appreciated. Cheers Lee First, you can shorten the formula a bit and reduce the number of function calls by using =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,32) XL doesn&...

converting results from formula to text in a new column
I have a column that I have a formula in. I want to take the results of the formula and copy it into a new column so I can copy it as text. Thanks. There is a little trick: Say A1 has =1+1 first format B1 as Text second select A1 and do a copy third select B1 and paste/special as value B1 will contain 2 as a piece of text. -- Gary's Student "nodotdak" wrote: > I have a column that I have a formula in. I want to take the results of the > formula and copy it into a new column so I can copy it as text. Thanks. thanks. it worked. "Gary''s Stude...

Read mail arn't marked as read anymore
After an SP upgrade of my Office 2000 the priviewed mail doesnt get marked as read anymore. I have tried to change the time (Tools->Options->Priview pane) from 2 -> 3 -> 4 seconds but nothing works. The only way to mark a mail as read is either to open it or right click it and chose Mark as read. Since I only use the priview pane this is very anoying for me. Is this a bug or has some setting changed with the SP? ...

Word 2003, Select a block of text. How?
A word 2003 document where I want to select a 'block' of text in order to copy it in somewhere else. How do I mark such a 'block' ? -- ___________ Knut Willy I assume you know how to select text in general, so there are two possible interpretations of "block": 1. If you mean a large portion of text that requires scrolling the screen, click at one end of the desired selection, use the scroll bar to bring the other end in view, and Shift+click there. 2. If you mean a vertical column portion of a wider block of text, use Alt+drag to select i...

scrolling text
is it possible to have scrolling text going across a spreadsheet like a screensaver until a button is pressed (or a short key)? please help thank you I thought that was a "given" with any mouse that had a wheel. Depress the wheel and see if you don't get a .four directional arrow icon. Move the mouse in the direction you wish to scroll. -- HTH, RD ============================================== Please keep all correspondence within the Group, so all may benefit! ============================================== "ash" <anonymous@discussions.microsoft.com> wrot...

reading confirmation
Good day, I have a problem with outlook. When they send a message to me that demands the shipment of a reading confirmation, even if I accept, the reading confirmation does not come received from the sender. Someone knows from what depends and in which way I can resolve the problem? Thanks for the eventual answers. Niki In news:eht7fo$251$1@fata.cs.interbusiness.it, Niki <nicola.pantaleo@yahoo.it> typed: > Good day, > > I have a problem with outlook. When they send a message to me that > demands the shipment of a reading confirmation, even if I accept, the > read...

Cannot serialize member System.ComponentModel.MarshalByValueComponent.Site of type System.ComponentModel.ISite because it is an interface.
I have read a previous posting about this error that seems to apply to my problem: Cannot serialize member System.ComponentModel.MarshalByValueComponent.Site of type System.ComponentModel.ISite because it is an interface. The setup I have is a web service that instantiates a class dsError which contains a dataset for database results, an int errorcode and an errormessage string. Code included: using System.Data; public class dsError : System.Web.Services.WebService { public string err; public int errcode; // non 0 indicates an error code. public DataSet Ds; public dsError() { // con...

keep formula after typing in a value in a excel cell
Hi there, my problem is, that i need something like: there is a function in a excel-cell (for example '=setvalue("sqlserver", "DB", "table")'). now i type in a value (for example 100) then the function "setvalue" must write this value (100) in the server, db and table from the parameters. after leaving the cell the formula is still the same and only the value 100 ist visible for the user. and if i go back to the cell than i can see the function in the menubar. there is a product from applix (TM1) and they did it. the problem is, that the souce...

"Unblock" feature should be optional when reading e-mail in CRM
When viewing e-mail messages in CRM, a line appears saying "Unblock" to allow the full message content to be read. Can this be made a configurable server or security setting? We are trying to reduce "clicks" as much as possible. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agre...

dates and text
How do I put dates from one cell and text from another into a single cell as 10sep03_GIT If the cell with the date is formatted as a date (and not text) you can use... A1: 9/10/2003 (formatted as a date) A2: _GIT (formatted as text) A3: =TEXT(A1,"ddmmmyy")&A2 (formatted as text) If the cell with the date is formatted as text you can use A1: 10sep03 (Formatted as text) A2: _GIT (Formatted as text) =A1&A2 (formatted as text) The reason I am clarifying it like this is I have never seen the date formatted like that. "karene" wrote: > How do I put dates...

Hyperlink display text maximum in Excel 2003
Every time I try to create a hyperlink of a cell (that contains a couple of sentences worth of text), I seem to reach the maximum allowed characters for the display text - and Excel cuts off the end of the paragraph. Hence, the the hyperlink is created, but I loose half the content of the cell. Any ideas? It looks like that text to display can be 255 characters. And the same thing holds for =hyperlink(link_location,Friendly_name) Friendly_name can be up to 255 characters--and if you point at another cell that contains a longer string, you'll get an error back. Maybe you could put t...

The memory could not be "read".
I'm at work yesterday afternoon responding to e-mail on my desktop, and Adobe pops up from the toolbar with a notice that there is an update available for Acrobat. I accept the download, keep plugging away at my e-mail, and install it when it's done. It runs through the install, tells me that I should restart, but I ignore it and keep working. It's near the end of the day and I'm going to be going home soon anyways. I forgot to turn it off when I left. Came in this morning, restarted it through the Start menu, and rebooted. Upon reaching the "Ctrl+Alt+Del" ...

how can i copy a document to a CD without making it read only?
HOW CAN I COPY A DOCUMENT TO A CD WITHOUT MAKING IN READ ONLY? You can't. It is not the file, but the media, that is read only. Even CD-RW media does not allow editing a file on the CD. Copy te file from CD to HD, mak edits and if a CD-RW you should be able to burn the edited file back to the CD. hth "DON" wrote: > HOW CAN I COPY A DOCUMENT TO A CD WITHOUT MAKING IN READ ONLY? ...

Include a button on toolbar to include/exclude original text when.
When replying/forwarding a message you must go to thru several screens to change your base setting or highlight and delete the message. Add an optional button that would allow you to include/exclude as each message is opened for reply/forwarding. ...

Unable to Read Japanese Email
I correspond with several Japanese users and can read emails from some of them without a problem, but emails from others are nothing but a series of ?????. In one case, I can read one email but not another from the same sender. Changing the Encoding doesn't help. Sending emails in Japanese to them without a problem...they can read it fine. Would appreciate any suggestions/solutions as I'm stumped. I'm using Outlook 2003 on a Windows XP Home operating system. Japanese language support is installed. ...

Type a number and data appears from another sheet
I have a document that lists volunteers and their personal info (name, email, phone etc.) with the Week number (1-5) of the Sunday when they help out. Some volunteers are in age group K-2nd and the others are in 3rd-5th. What I am doing at the moment is sorting by Week number and then filtering by week number (e.g. 2 for the second Sunday of the month). I then copy that information to another sheet in the same workbook. What I would like to do is just type a week number e.g. 2 in A1 of "This Week" sheet and then somehow *magically* have all the people from both K-2nd and 3rd...

Transferring read e-mail to another folder
Hello I was wondering whether there was a way in which I could automatically transfer my e-mail that has been read into another folder, such as "Old e-mail" or something like that? Thanks ...