|
CreyBax wrote:
there's no way NOT to show images for the parent items in that case.
That´s what I was afraid of ... well, thanks anyway...
~RaGE();
|
|
|
|
|
there are two types of image lists
one depends on items state and so item can be without it
(you can see OnPaint/if(itemState & TVIS_STATEIMAGEMASK) into cp/treectrl/rgree sources)
t!
|
|
|
|
|
In a MFC dialog-based application i've created a worker thread.
In the worker thread i call Sleep(5000) and the interface blocks for the specified period.
I have to mention that the thread is involved in many operations including mutexes and objects located in some other threads, but not the main one of the interface.
Could you tell me how should i handle the problem?
rechi
|
|
|
|
|
Bogdan Rechi wrote:
In the worker thread i call Sleep(5000) and the interface blocks for the specified period.
By 'interface' you mean 'user interface'?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
|
Calling Sleep() in worker should have no effect on main thread. Unless you're waiting for worker to finish...
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
It's strange, because i use a mutex - working excellent even in such conditions - to synchronize the access to some data located in an object belonging to another thread, but not the main-one.
Indeed, it seems that the delay comes from this mutex and hard times are to come.
Anyway, thanx!
rechi
|
|
|
|
|
I have an application with many different views, but I want to have only a single document open for a process. How can I best block OnFileOpen() and OnFileNew()?
1. I have tried OnUpdate in my CMainFrame by using CCmdUI. Can't make it work.
2. I override the OnFileOpen() and OnFileNew() to check if a document is already active. But if I use
CDocument* pDoc=((CFrameWnd*)m_pMainWnd)->GetActiveDocument();
I always get a NULL pointer ??
Regards, Haakon S.
|
|
|
|
|
Haakon S. wrote:
How can I best block OnFileOpen() and OnFileNew()?
I'm not sure why do you want to block. Just close open document and create/open another.
Haakon S. wrote:
I always get a NULL pointer ??
CWinApp::CloseAllDocuments does what name suggests.
I'd override CWinApp::OpenDocumentFile (which is also called for new docs) to close everything before new doc is open/created.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
I don't want anybody to have several documents open at the same time (in the same process), which you can normally do in a MDI apllication. I want to disable this functionality.
Haakon S.
|
|
|
|
|
I know what you want to do. I just think that instead of blocking File/New and File/Open you should close current document and load/create new one. This will result in at most one document open in any given moment.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
What you are saying is the right thing to do. You know it and I know it. But what about the next man? It should be possible to totally rule out the option.
There are several reasons, by the way. First, if you have many different views it gets totally messed up if you have several documents. Secondly, my app. will probably break with several documents (probably poor programming, but anyway... ).
So, once again, help in this matter will be greatly appreciated.
Haakon S.
|
|
|
|
|
My solution (close open document before opening/creating new one) gives you exactly what you need: you have MDI app --and-- at most one document is open. Your app will not break; user will be working with exactly one document.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
CMDIFrameWnd *pFrame =
(CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = pFrame->MDIGetActive();
|
|
|
|
|
Description:
============
There are a lot of times in a dialog box that one would want to read-in/display a number that has a unit. For instance, this can be achieved by a pair of edit box and static box.
Edit box control containing the value Static Control displaying the unit:
2.378e-3 Meter
User can also choose his favorite unit system in a centralized dialog box. For example, he could specify whether he would rather to have the lengths to be displayed in Meter, Inch, Centimeter, ...
Question:
=========
I thought the best way to accomplish this task is deriving a customized edit box and static controls from MFC's CEdit and CStatic classes and adding the following paramteres to it:
double m_Conversion; // Conversion factor from SI to the user's selected unit.
CString m_UnitName; // The Unit's name, "m", "cm", "mm", ...
This seems to be such a common problem that I thought there might have already been some specialized codes written by other people for this purpose.
I appreciate any input/suggestion/pointers in regards to my question. Please e-mail a copy of your response to "asi@enginia.com".
Thank you.
Ali Asi
asi@enginia.com
Ali Asi
|
|
|
|
|
I am using a system doing exactly what you are asking for.
1. First, you establish a vector of UINT's where the user enters all preferences. For example, length is put in m_UnitVector[2].
2. Secondly, you establish the options in a pairs of const char* and conversion factors:
const char* CUnit::m_Length[]={" [m]"," [ft]"," [mm]"," [in]",NULL};
const float CUnit::m_fLength[]={1.0F,3.280839F,1000.0F,39.37008F};
Here, length is stored in meters as the base unit.
3. In your edit box showing the unit you enter m_unit.m_Length[m_UnitVector[2]], in the box showing the number you show m_fMyLength*m_unit.m_fLength[m_UnitVector[2]]. Of course, when you go the other way with UpdateData(TRUE), you divide instead of multiply.
Hope you can make use of this.
Regards, Haakon S.
|
|
|
|
|
Hi All,
I've got a CFormView derived class, where I am creating controls at runtime and placing them on the form. This seems to work OK, but I am wondering how to get some resource ID's to use with theswe controls at runtime. SHould I just reserve a bunch of them, or is there a way to get them dynamically?
Thanks,
Aaron
|
|
|
|
|
If you won't use these IDs later, then you can assign 0xFFFF to all the dynamically created extra controls (I've done it in the past and it worsks.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Well, the problem is that I have an existing control that the label control is associated with. I create these two controls, a sort of super duper edit control, and its buddy, a static label, dynamically. The edit derived control has a method, something like SetBuddy(int nResourceID) that takes a resource ID to the associated label. For my own use, I have been just saving the window handles to talk to the controls, but the edit control needs a resource. I had been just setting them to 0, without any trouble.
|
|
|
|
|
Ok, I posted something about this yesterday, and here is some more info:
The basic problem is that whenever I try to step over an API call (InitDialog(), CoCreateInstance(), etc) I get the same exception being raised:
0XC0000005: Access Violation
This only happens when I'm stepping through code. The exception always seems to be raised at the same assembly instruction:
mov eax,fs:[00000018]
I guess this is something to do with the debugger not coping with external function calls, but I can't figure out what is going on other than that.
If anyone needs more information I'd love to provide it, just ask
I hope someone knows what's going on here...
TIA,
Pete
|
|
|
|
|
Is this stepping over any call such as this, or is this a specific class's InitDialog() and CreateInstance() calls?
-dz
|
|
|
|
|
Seems to be any call like this, not restricted to specific classes, or specific API calls.
|
|
|
|
|
ok.. does it compile and run fine, and only crash when you are debuging?
could you give the top level code where you are actually overriding OnInitDialog and what line it is crashing.. because going that deep into the assembler means nothing to me
p.s. if it compiles and runs fine and is just messed up when you are debugging then im clueless
-dz
|
|
|
|
|
Yeah, it compiles and runs great normally, it just falls over when I try debugging.
It's not specifically overriding functions that causes problems, it's just calling them.
the assembly means nothing to me either, but I thought it might be a good clue for someone
|
|
|
|
|
moredip wrote:
the assembly means nothing to me either, but I thought it might be a good clue for someone
What is the line above the line. fs:[0000018] is the thread environment bock. Puzzling that it crashes there.
|
|
|
|