|
It doesn't recognize the constants WHITE, BLACK, and RED.
|
|
|
|
|
I am having trouble getting a bitmap to display on a dialog. I've set the Picture Control in the window (Dialog) and set the Type property to Bitmap. I can get it to display a resource bitmap created in the editor and assigned to the control via the Image property. What I would like to do is have a dynamically drawn bmp displayed and updated as needed on this dialog. I know how to draw the bitmap just not how to get it thrown in to the Picture Control.
Thank you for your time
lp
|
|
|
|
|
there's a control called CBitmapCtrl over at www.codeguru.com
see how he did it
|
|
|
|
|
Thank you, I'll take a look.
lp
|
|
|
|
|
This should be easy, I've created a new VC++ 6 dialog based app with a single rich edit
control (and the standard OK/Cancel buttons).
I've added AfxInitRichEdit() to InitInstance() and a NM_SETFOCUS message handler using the Class Wizard.
The NM_SETFOCUS handler never fires?
Any Ideas?
|
|
|
|
|
Don't rich edit controls just suck ? I mean, if I *have* one, why do I have to specify with a call that I want to *use* it ?
Anyhow, the fun is not over yet. You need to tell the rich edit to send you messages using the SetEventMask function with a combination of the following flags:
ENM_CHANGE Sends EN_CHANGE notifications.
ENM_CORRECTTEXT Sends EN_CORRECTTEXT notifications.
ENM_DRAGDROPDONE Sends EN_DRAGDROPDONE notifications.
ENM_DROPFILES Sends EN_DROPFILES notifications.
ENM_IMECHANGE Rich Edit 1.0 only: Sends EN_IMECHANGE notifications when the IME conversion status has changed. Only for Asian-language versions of the operating system.
ENM_KEYEVENTS Sends EN_MSGFILTER notifications for keyboard events.
ENM_LINK Rich Edit 2.0 and later: Sends EN_LINK notifications when the mouse pointer is over text that has the CFE_LINK and one of several mouse actions is performed.
ENM_MOUSEEVENTS Sends EN_MSGFILTER notifications for mouse events.
ENM_OBJECTPOSITIONS Sends EN_OBJECTPOSITIONS notifications.
ENM_PROTECTED Sends EN_PROTECTED notifications.
ENM_REQUESTRESIZE Sends EN_REQUESTRESIZE notifications.
ENM_SCROLL Sends EN_HSCROLL and EN_VSCROLL notifications.
ENM_SCROLLEVENTS Sends EN_MSGFILTER notifications for mouse wheel events.
ENM_SELCHANGE Sends EN_SELCHANGE notifications.
ENM_UPDATE Sends EN_UPDATE notifications.
Rich Edit 2.0 and later: this flag is ignored and the EN_UPDATE notifications are always sent. However, if Rich Edit 3.0 emulates Rich Edit 1.0, you must use this flag to send EN_UPDATE notifications..
Coz just because you initialized a CRichEditCtrl doesn't mean you want it to talk to you, right ? Sheesh...
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
Well that makes sense! - Do you think it was a Friday when they invented this?
Maybe there is an easier way to do this (as you can guess I'm a newbie!). I need to have a read-only rich edit control, it will be populated and has auto scroll but I do not want it to receive focus. Can you advide on the easiest to achieve this?
|
|
|
|
|
I don't think there is an *easier* way - the only two other options that occur to me are to use a class that wraps a font and draw it yourself ( I'd probably do this, but it's not *easy*, that is, the RichEdit is not harder ), or create an IE Window in my dialog and do it in HTML ( useful under some circumstances ).
I'd recommend sticking with the Rich Edit because you're largely out of the woods now, and my personal approach is to stick with a method until I've learned it, try something else the next time and then I can say that
a/ I can make an informed decision come the third time and
b/ the damn computer didn't beat me.
Christian
#include <std_disclaimer.h>
|
|
|
|
|
HELP! (PLEASE!)
OK, I admit defeat I cannot get this thing working!
The events are now firing after using SetEventMask() but how the heck
do I know that the control is about to receive focus (and therefore stop it!)?????
Any chance of a snippit of code?
|
|
|
|
|
Hi,
I have a strange problem, and I haven't managed to find an answer in the
documentation.
I'm using an SDI, non-Doc/View arch.
My toolbar has several buttons all of which have the ON_COMMAND_UPDATE_UI
implemented.
They all check some bool variable for true, and if so they disable.
Up to here all is well.
On button's handler sets this Boolean to true (in the ON_COMMAND handler).
My problem is that the toolbar does not get updated when this happens, i.e.
the ON_COMMAND_UPDATE_UI does not get called for all the rest of the
buttons. Only when the user clicks some button on the toolbar, does it
update, but by then it is too late.
I need something which is equivalent to Invalidate() but for the toolbar.
I tried Invalidating the frame, app, toolbar, to no avail.
I tried calling OnIdle(), to no availed.
I tried sending WM_IDLEUPDATECMDUI to the Frame, to no avail.
Please help me. (maybe on of the above is the solution, and I just messed it
up).
Please explain,
Thanks,
Adi
|
|
|
|
|
Try calling GetToolbarCtrl()->AutoSize(); This will resize the toolbar ( the actual item you want to manipulate is the CToolbarCtrl that the CToolBar encapsulates ), and hopefully redraw it.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
My program has a toolbar with a edit box on it. When the program starts, (1)i would like to set the focus to this edit box. In this edit box, there is a phrase "Enter command here". (2)I would like to have this phrase highlighted, so that the user can enter the command immediately. How to do that?
Thank you!
|
|
|
|
|
1) wndYourEdit.SetFocus();
2) wndYourEdit.SetSel(0,-1);
Or the equivalent APIs if you're not using MFC/ATL windowing classes.
--Mike--
http://home.inreach.com/mdunn/
Tables, ladders, chairs, OH MY!
|
|
|
|
|
hello,
I would like to know if it is possible to delete a specific tab in a Tab Control.
Thanks for help.
R.G
|
|
|
|
|
CTabCtrl::DeleteItem in MFC or TCM_DELETEITEM when you're at API level.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Is it possible to connect to an FTP-server through the Passive (PASV) mode (RFC 959)?
See me: www.magerquark.de
|
|
|
|
|
My MDI application can't open (serializable) existing files (with my own extension) without refering to "IDP_FAILED_TO_CREATE"
How can I use correctly OnOpenDocument in my Doc class ?
the use of CWinApp::OnOpenFile don't manage to solve the problem.
Someone can help or give me one example ?
Thank in advance
Leo
(Christian, if you see this new thread can you explain me more precisely your response ?)
Leo
|
|
|
|
|
Hmmm.... you're using serialisation ? I admit I never do, I handle loading and saving myself. In my code, the App class OnFileOpen handler looks like this:
char BASED_CODE szFilter[] = "Bitmap (*.bmp)|*.bmp|Jpeg (*.jpg)|*.jpg|Png (*.png)|*.png|Tiff (*.tiff)|*.tif|Targa (*.tga)|*.tga|Windows Metafile (*.wmf)|*.wmf|All (*.*)|*.*|\0";
CFileOpenDlg dlg(true, "bmp", NULL, OFN_FILEMUSTEXIST, szFilter);
if (m_szLoadPath.GetLength() > 2)
dlg.m_ofn.lpstrInitialDir = m_szLoadPath;
if (dlg.DoModal() == IDOK)
{
m_szLoadPath = dlg.GetPathName();
int pos = m_szLoadPath.ReverseFind('\\');
m_szLoadPath = m_szLoadPath.Left(pos + 1);
AfxGetApp()->OpenDocumentFile(dlg.GetPathName());
}
and then in OpenDocumentFile in my document class, I just go into a series of if/else's to figure out the extension and then load the file accordingly. I don't know how you'd handle it for serialisation, sorry.
I also do this in my doc class OnFileOpen:
CGrausPaintApp * pApp = (CGrausPaintApp*)AfxGetApp();
pApp->OnFileOpen();
because I found the first call goes to the app class, once you have a doc open, the doc class is called. I'd guess you need to do something similar to set things up, but then call Serialise to load. If you've done that, the problem is probably in the Serializing code, and I haven't done that stuff since 1999.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
thank a lot for your response
Leo
|
|
|
|
|
okay, this is my problem
I have a sub-menu , the ID is ID_TOOLS_EDGE_CENTERPOINT , i like to add a function so that when i click on the above sub-menu , i could click only once with my mouse(left button)
and get that point.
i don't know if I have to use UPDATE_COMMAND_UI from the class wizard or not....
Thanks
Ehsan
Ehsan Behboudi
|
|
|
|
|
You want the point where you clicked the menu, or the next point you click ? The first way you handle the menu item and call GetCursorPos right away, the second you handle it to set a flag so OnLButtonDown grabs the variable point and stores it.
OnCommandUI is called just *before* the item is shown.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
I have a DLL where I export functions and classes using the __declspec(dllexport) method.
My DLL function creates an array of objects (also declared using __declspec) and returns that array. I then attempt to uses the delete[] operator on the returned array and the program breaks out complaining "User breakpoint called from code 0x77f9eea9" (I am running in debug mode using VC6.0.
I assume there is some issue with memory allocation. I call new inside the dll to create the array of objects, then from my application that links to that dll I call delete[], which causes the error.
Does anyone know what I am doing wrong.
Thanks
Ian Marshall
|
|
|
|
|
Allocating memory in a DLL and freeing it in EXE will work only if both are using shared (DLL) runtime library. If you link EXE or one of the DLLs with static CRT, your program will have more than one heap, and memory allocated in DLL must be freed in DLL as well.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I am developing a chat system on a dialog based application. To display the text I used a CRichEditCtrl-derived class. The EN_LINK event-mask flag is set, and the EM_AUTOURLDETECT is applied. The text is displayed as a link, that works nice. My problem is that I seem unable to intercept the EN_LINK notification when someone clicks on that link. Has anybody some suggestions what I am doing wrong? (Surely it is my fault )
Thanx alot
Klymer
|
|
|
|
|
Did you specified ENM_LINK flag when sending EM_SETEVENTMASK message to rich edit control?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|