|
I did this awhile back. I tried the grab the DC approach and had limited success. I ended up using the clipboard approach, the control copies a WMF image to the clipboard. I really disliked this approach but it seemed to be the prescribed approach. If you want send me an e-mail to nwilhelmi@attbi.com and I can send you some code when I get home. The app was done with WTL so it will be WIN32api based and not MFC based.
NW
|
|
|
|
|
I have build a class,derived from CEdit, that validates Edit box data as the user enters it. Is there a way to use a CEdit derived class to validate Data changes made to a combo box? Or will I have to build a class derived from CCombo?
|
|
|
|
|
Damn! I can't remember it, but there was some way to subclass the edit box of a combo! I'll look for it, but I bet someone else will answer ya before I can dig it up
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
|
A million thanks. I was just about to dive into deriving a my own combobox class and then subclassing my edit control in my new combobox ctrl. This is much 'classier'
|
|
|
|
|
Hi,
I know we can modify a resource using updateresource
function... but its like i have a string in
CString and i want to copy that to a resource
table entry...
Does anyone know how to do that
Sameer
|
|
|
|
|
String resources are weird. Strings are stored in blocks of 16. IDs 0-15 are block 0, 16-31 are block 1, etc. So block# == ID >> 4. Use the block # to load the resource (with Find/Load/LockResource APIs). Once you get the block loaded, the format of the block should be obvious (Unicode strings, length-prefixed).
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I've tried my own little replica of Chris' Creating Custom Controls, but whenever I add it to my project, the program simply fails to load, with no error or display of any kind. Has anybody had this problem, and how did they resolve it? I don't know where in the source my problem could be, and I shouldn't post the whole thing.
Thanks,
- Jason
(SonorkID 100.611)
In the beginning, teachers taught the 5 W's: who, what, where, when, why. Now it's just a big damn G
|
|
|
|
|
I've been there. It was a while ago, but I think it had to do with the message pump.
Make sure that you're handling your messages to the custom control correctly.
Hugo
|
|
|
|
|
Ok. Thanks very much for the reply and the help. I'll look at the messages and go from there.
- Jason
(SonorkID 100.611)
In the beginning, teachers taught the 5 W's: who, what, where, when, why. Now it's just a big damn G
|
|
|
|
|
Could you please perhaps report back if this was the correct solution later on?
I Would be delighted to know that I've helped someone.
|
|
|
|
|
Gladly.
I took another peek at the message handlers but couldn't find anything obviously wrong. I decided to take another crack at it from scratch, and this time the program loaded, and my custom control was visible. I *think* the problem I introduced originally was due to misreading Chris' article and trying to simultaneously implement the control as one you can add in with the resource editor, AND one that you manually Create(). I think for some reason this simply caused the program to not load.
Anyway, I continued to work on it and have made progress on this control (which I need for an app I'm working on--yes, it's supposed to be like the Task Manager grid control thingy). What a difference being able to see the program makes!
Thanks for the help,
- Jason
(SonorkID 100.611)
In the beginning, teachers taught the 5 W's: who, what, where, when, why. Now it's just a big damn G
|
|
|
|
|
Could anyone point me in the direction of an example or suggest a way to do an error log view in MFC?
I need something similar to Visual Studio's build output - a read only text output.
Should I derive a class from CEditView or CRichEditView or is it better to roll my own via CScrollView? I don't need anything too fancy (e.g. colours, fonts etc.) as it's just for an in-house tool that I'm writing.
Thanks for your help,
Marc
|
|
|
|
|
I did it without MFC, I just created an edit box and made it read only. It's one of the flags you can set for an edit box.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Thanks Christian but it's not quite what I want.
I'm using the doc/view architecture so I want it to be a view not just an edit box.
I've changed the flags of the edit view before and it's ok but I was wondering if there was a better way without having a greyed background and a cursor (caret) on screen.
Any ideas?
Marc
|
|
|
|
|
You can hide the caret - I did. As for the rest, mine did not go grey, if yours is, try handling key presses yourself in the view and discarding them. This has the advantage that you could accept certain keys to, for example, clear the view.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
It's gone grey for me!
The method I'm using to set readonly is:
void CLogTextView::OnInitialUpdate()
{
CEditView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
CEdit &edit_ctrl = GetEditCtrl();
edit_ctrl.SetReadOnly();
}
This makes the view go grey! Any ideas how not to leave it white?!
Also, do you know which methods hide the caret?
Thanks for your help,
Marc
|
|
|
|
|
As I recall, there was a hide caret function I called in set focus. I dunno why your view is grey, but as I said, if you leave that and instead catch WM_KEYDOWN, WM_KEYUP and WM_CHAR and don't call the base class, you'll get what you are after.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Cheers Christian.
That works a treat.
Marc
|
|
|
|
|
Ah, but there is one problem.
Whenever I add text to the edit control it seems to notify the Document and hence asks me if I want to save my changes when I go to quit out. Any idea how to stop this?
Marc
|
|
|
|
|
I did not use Doc/View. The Document has a dirty flag - set it to false as you close and you won't get that prompt. I forget it's name though.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Yes, I could do that but I won't know whether the rest of my code has properly modified the document or not.
Is there no way to stop the edit control from telling the document that it is being modified?
Marc
|
|
|
|
|
In the code that updates the edit control, check if the flag is set to dirty. If not, then reset it to not dirty after doing the update.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Thanks Christian!
Again, you've sorted things out!
Marc
|
|
|
|
|
I want to Serialize a CBitmap Varable with some other information.
How Do I Searialize this CBitmap.
Abhishek Narula
"Learn to appreciate others ... World would appreciate you"
|
|
|
|