|
Hi All,
I'm running VS 6.0, and I have created and SDI application using multiple splitter windows to display different aspects of stuff. In each of the splitter frames I have a CFormView derived class that handles the specifics of each view.
My problem is that when the main application gets resized or the splitters get resized, I need to be able to resize the dialog in each of the panes to the size of the pane. I don't have a clue how to do this. It seems I am only able to display the size of the orginal resource for that ID. Any ideas on how to do this??
Any help or suggestions or even just a general direction are greatly appreciated. Thank you.
Dan Willis
|
|
|
|
|
Use SetWindowPos , but be warned this will merely resize the dialog, yet the controls will stay in their original positions. If you want full control over how the dialog is to be laid out under size changes, check Erwin Tratar's Layout Manager for Dialogs, Formviews, DialogBars and PropertyPages[^]
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Actually, I believe that will work. LOL I knew there was a function out there, just couldn't think of the name of it.
I'm actually running a dll that takes the size of the window and makes all the on-screen adjustments, so all of the layout managing is already done. I think that will take care of it. Gotta run some tests to make sure. There's always a small catch. lol.
thanks! I'll keep ya posted.
Dan Willis
|
|
|
|
|
I have a dialog resource IDD_A, and need to "plug in" a new and improved IDD_A (Basically my existing IDD_A crashes the code when I add a third party ACtiveX control on it. However if I put that control on a CDialog BEFORE the other controls, then it doesnt crash. Now what I dont want to do is insert a new Dialog which has a different name IDD_B because Class WIzard will create a new class for it, and I'll have to go through the old class and put in stuff into the new class, and also replace the old class everywhere it occurs in my View class.....not pretty. I tried tricking VS by renaming the old dialog and calling the new dlg IDD_A. I also went and commented out stuff in the resource file. But when I go to give my new dialog dlg the name IDD_A it says that this is associated with IDD_AOLD (which is what I renamed the old dialog). NOw I dont see any place (searched) thaT I could do anything that will make my new CDialog get associated with the same class.
Help?
Appreciate your help,
ns
|
|
|
|
|
search for the line
enum { IDD = IDD_AOLD };
replace with
enum { IDD = IDD_ANEW};
|
|
|
|
|
OOps! I did what you said and it crashed....am going to see if I can see why...
|
|
|
|
|
Create the new dialog resource, give it the same name IDD_A and set the condition _NEW_INTERFACE_ (in the Properties dialog on the left panel), or whatever name you please. Then, by setting/resetting _NEW_INTERFACE_ in Project->Settings->Resources->Preprocessor definitions your program will use one or another dialog resource.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm using VS6. What properties window is this you mention?
Appreciate your help,
ns
|
|
|
|
|
Go to ResourceView on the left panel: there's a tree listing all resources you have included, right-click on that corresponding to the new dialog resource and select Properties.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I just got your response. In the meantime, I created my new dialog, and when I did ctrl W it said its a new dialog - cretae a new class or choose existing<. When i chose existing, it said okay I'm going to replace your old IDD_A with the new one IDD_B. And it did what it promised.....so I've pasted your resolution in m y hints.doc for the future.
Appreciate your help,
ns
|
|
|
|
|
If this line highlights the line in a list control:
m_mylistctrl.SetItemState( i,LVIS_SELECTED,LVIS_SELECTED );
how do I unhighlight the line i.e turn off these flags??
thanks
grahamoj.
|
|
|
|
|
m_mylistctrl.SetItemState( i,0,LVIS_SELECTED );
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
We need to put together a Visio-like visual designer app. Anyone know of a VC++ or .NET toolkit available to build this sort of application? I'm grateful for your suggestions!
|
|
|
|
|
Everybody is taking this word 4 granted - I even have a code (from my
ex-coworker) which has some of it included in a project (that I must continue) but I can't get the difference between 'Hardcoded' files & other 'normal' Visual C++ files.
So please can any1 tell me wtf( ) are these "Hardcoded files"?
Tnx!
Love is the law, love under will.
|
|
|
|
|
It depends on the context, but I'd take it to mean using a number directly in the source, where a constant could be used instead (or even read the value in from a config file, or the registry)
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Hardcoded is a very general word. Usually it means that an implementation tends to be very inflexible and designed to solve a very narrow problem instead of the more general solution.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
::fopen("c:\\temp\\out.txt", "rw");
In this example file name is hardcoded, which assumes 1.)you never want to create file anywhere else. 2.) name of the file never changes 3.) directory "C:\temp" exists on the user computer.
It is considered bad practice even for debugging purposes.
|
|
|
|
|
In my opinion the term "hardcoded" implies that a value or an algorithm can only be changed by changing the source code.
Ivor S. Sargoytchev
|
|
|
|
|
i use the words hardcoded and dynamic.. hardcoded means something can't be changed without recompiling, whereas something that is dynamic can be adjusted on the fly.
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Hi,
I have a requirement to complete, but i'm not sure how to do it. I know I'll have to use a CFormView interface. The thing is, i have to get fonts to work within this view. It's basically a listing output of some technical information. However, my boss wants it to have font & color capability. I've already ruled out using CListCtrl, as that's just a listbox basically. I've thought about CRichEditCtrl's, but that's editable by the user right? And we don't want that to be a possibility... Does anyone have any ideas?
|
|
|
|
|
|
Could you be more specific as to what to do? I'm rather new to windows programming. Thank you!
|
|
|
|
|
See MSDN article Q85518. It Shows how to set font for individual control, but you can apply that to any CWnd derivative(CFormView in your case).
|
|
|
|
|
I've searched msdn.microsoft.com all over for this "Q85518", and I can't find a darn thing. Am I looking in the wrong place?
|
|
|
|
|
Sorry, name of the article is "INFO: Correct Use of the SetFont() Function in MFC"
in case you do not have it here is the code( I hope MS will not sue me
/*
* Compiler options needed: None
*/ class CMyAboutBox : public CDialog
{
CFont m_font; public:
// Constructor -- This code assumes a dialog box
// template named "ABOUTDLG" in the application's .RC file. CMyAboutBox(CWnd* pParentWnd = NULL) :
CModalDialog("ABOUTDLG", pParentWnd) {}; BOOL OnInitDialog();
};// OnInitDialog() function -- Called after Windows creates
// the dialog box but before it is painted on the screen.BOOL CMyAboutBox::OnInitDialog()
{
LOGFONT lf; // Used to create the CFont. CDialog::OnInitDialog(); // Call default ::OnInitDialog memset(&lf, 0, sizeof(LOGFONT)); // Clear out structure.
lf.lfHeight = 20; // Request a 20-pixel-high font
strcpy(lf.lfFaceName, "Arial"); // with face name "Arial".
m_font.CreateFontIndirect(&lf); // Create the font. // Use the font to paint a control. This code assumes
// a control named IDC_TEXT1 in the dialog box.
GetDlgItem(IDC_TEXT1)->SetFont(&m_font); return TRUE;
}
|
|
|
|