|
In a dialog, i have some buttons and a CEdit control. How would I set the focus to the edit control?
tanx
|
|
|
|
|
|
okay, whoops, i should have said that i have a CString mapped to the control. I suppose I have to map a CEdit as well to be able to focus it...
|
|
|
|
|
What does it mean 'to have a CString mapped to the control' ??? If you'll be more specific maybe I'll help you
Honza
|
|
|
|
|
i meant that in Class Wizard member variables i put a CString onto the edit box. I put a CEdit onto the edit box as well, so i can use SetFocus like that. I was just wondering if you could do it without having to have a CEdit just for that. if u get what i mean .
|
|
|
|
|
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT);
pEdit->SetFocus ();
|
|
|
|
|
Two ways:
1. GotoDlgCtrl ( GetDlgItem ( IDC_MY_EDITBOX ));
2. GetDlgItem ( IDC_MY_EDITBOX )->SetFocus();
|
|
|
|
|
Use this:
GotoDlgCtrl(GetDlgItem(IDC_MYCONTROL));
That way, you don't need to setup a member variable of the control type...
|
|
|
|
|
How can I set separately any Video for Windows parameters (Brightness,Saturation,Contrast, Hue and others)
from my application without vfw standard dialogs?
ok@aquanet.co.il
|
|
|
|
|
I am looking for some clues as to how to do Detachable Menus using MFC. These menus can be seen in Microsoft Powerpoint under Slide show\Action Button menu pick.
They have a tiny caption bar on them, and user can click and drag them to detach them.
I could get the same look using Owner draw menus. But I am having a hard time trying to emulate click and drag because it is menu, and not a window. Any ideas are greatly appreciated.
|
|
|
|
|
You might Like to have a look at Stas Levin's BCGControlBar library. It's free and supports tearoff menus, as well as the rest of the Office 2000 UI.
His homepage is:
http://msnhomepages.talkcity.com/WindowsWay/stasl/index.html
Not sure if this will be of use to you, but it could be.
Yours,
|
|
|
|
|
hi,
in fact, these menu are simply toolbar (detachable) with textbutton wich display a popup menu when pressed. There is no way to add a CMenu to a CToolBar, and as CMenu is not a CWnd derived, there is no way to dock it in anything ...
you should check this great article wich explain the popup method :
http://www.microsoft.com/msj/defaulttop.asp?page=/msj/0199/c++/c++0199top.htm
I've currently my own implementation of this system, but this is a lot of code since you have to do all menu i/o management yourself. You should use the pixielib on the
dilascia page (he wrote the article below)
++, Benoit
authem_b@epita.fr
|
|
|
|
|
Dear Friend...
Thanks for the reply..I was wondering myself that this tearoffs should be toolbars mimicing menus.
In fact for menu customization, I ended up creating a custom menu class which is a toolbar by itself.
However, I found one issue with the customdraw notification that CToolBar sends us. These tearoffs
normally have a small caption, which I believe is just a customdrawn button. But if you specify a smaller
height for a tearoff button ( of normal window caption / 2 ), CToolBar still draws the button with the normal
size. So in effect what you get is a button which is partically filled with the caption color. How do we solve
this problem?
Thanks for pointing me to Paul's article. That is a great help. And also thanks for substantiating my guess
that these popups are actually toolbars, and that Microsoft haven't found an ingenuous way of manipulating
menus!!!
Regards
Shailesh
|
|
|
|
|
Hi,
I recently purchased visual studio 6.0, and the book Programming Microsoft Visual C++, Fifth Edition. Now, by trade I am a unix programmer, so my normal day to day activities are via the 'vi' editor. In the book (mentioned above), chapter 1, page 10 under "The Source Code Editor", the first sentence states that Visual C++ 6.0 contains keyboard bindings for "a variety of popular editors (such as VI and EMACS).." - maybe I'm just looking wrong, but I can't find out how to do this, the 2 included with VS6.0 are Developer Studio, Visual C++ 2.0, Epsilon, and BRIEF. I've loaded service pack 4, and have searched endlessly through MSDN, to no avail. If someone knows what I need to do to enable VI key bindings within the source code editor of Visual C++ 6.0+SP4, I would be very happy.
Thank you,
Nick
|
|
|
|
|
This is probably a simple question to answer, but I can't seem to find a solution. I am trying to create two new documents when the user chooses the "File|New" command. I have two document templates set up, and wish to create one of each automatically.
Also, how would I go about handling an "File|New Document 2" command - To create a new document from template 2, without showing the user the MFC "new file type" dialog.
I hope semobody can help me with my problem.
Thanks in advance,
David Wulff
Battleaxe Software
|
|
|
|
|
#1 First create two new data members in your application class.
for example:
CMultiDocTemplate* m_pDocTemplate1;
CMultiDocTemplate* m_pDocTemplate2;
#2 Change the document template registering to something
like this.
m_pDocTemplate1 = new CMultiDocTemplate(
IDR_MYDOC1,
RUNTIME_CLASS( CMyDocument1 ),
RUNTIME_CLASS( CChildFrame ),
RUNTIME_CLASS( CMyView1 ) );
AddDocTemplate( m_pDocTemplate1 );
m_pDocTemplate2 = new CMultiDocTemplate(
IDR_MYDOC2,
RUNTIME_CLASS( CMyDocument2 ),
RUNTIME_CLASS( CChildFrame ),
RUNTIME_CLASS( CMyView2 ) );
AddDocTemplate( m_pDocTemplate2 );
#3 Overwrite the "OnFileNew" command handler in your
application class.
void CMyApp::OnFileNew()
{
// don't call CWinApp::OnFileNew()
// Create a new document from template 1
m_pDocTemplate1->OpenDocumentFile( NULL );
// Create a new document from template 2
m_pDocTemplate2->OpenDocumentFile( NULL );
}
That's it.
Best regards
Holger Persch
|
|
|
|
|
Thanks. It is so simple, yet I spent ages doing everything but that. I was thinking more along the lines of creating the new document, manually by creating the frame, view, etc - but this is all I need!
Thanks again,
|
|
|
|
|
I would like to know How I could dipslay japanese character in CStatic run under English window nt version and set font to MS gothic. The reason is that I can display japanese characters correctly by setting font to MS gothic in MS access under English window nt version and english Access version. However there is something that MS handle to display japanese characters when font is setting to MS gothic. I try to put some text in Vb control and set font to MS gothic some control work and some don't
Any idea
|
|
|
|
|
You need to make sure that the proper code pages are displayed. Most often, the English NT does not have the correct .NLS files to display Japanese characters installed to the computer.
At least this is a place to start. Then you need to set the locale for the control and then set the font. Otherwise, you are just as likely to set it to the English font rather than the Japanese font.
|
|
|
|
|
Hi everyone,
I have this question regarding DLL. I'm currently working on a project that contains an application( A FRAME ) that is using DLL functions. I have A MENU on the frame and in the menu, I have functions that uses DLL.
Let say for example, in the MENU, I would have an option named CACULATIONS, and under CALCULATIONS, I would have a ADDITION option. So when I click on the ADDITION, a dialog box would pop up and allow me to use the addition function created by a ADDITION DLL.
What I would like to know is the following, Is it possible for me to add new DLL's into the application without adding codes to the application itself (i.e without adding new codes to the frame)??
For example, let's say I have a new Calculation method called SUBTRACT and it's a separate DLL from the original adding dll. Then if I have a option in the MENU called ADD DLL, I would have a dialog box pop up in which allows me to add the new dll.
The dialog box will contain edit boxes that asks the user to enter where the new DLL file is, and what the user would like to call the new DLL method that he's adding.
So when the user enter the values and runs the program, a SUBTRACT option will now be listed under the CALCUATION MENU and the application will now be able to refer to the SUBTRACT DLL without adding new codes to the application itself. IS THIS POSSIBLE??? It's sort of like a plugin thing. IF ANYONE HAVE ANY IDEAS, PLEASE LET ME KNOW.
THANK YOU VERY MUCH.
Steve
P.S: One more thing, is there a code that allows me to call up the OPEN AND SAVE dialog boxes. (i.e when you want to open an existing document in Words, a dialog pop up.) How do I write codes for those dialog boxes for OPEN, SAVE, AND SAVE AS??? PLMK. THANKS AGAIN!
|
|
|
|
|
Read the article:
How to do run-time (or explicit) linking of C++ plug-in components and objects
By Gert Boddaert
here at Codeproject.
http://www.codeproject.com/dll/plug-in.asp
I hope this helps
Best regards
|
|
|
|
|
I was wondering what MFC dlls need to be included in a program that I use. It only uses CButton, CEdit, and CListCtrl controls. I know that the user will need to have ie4 or greater for the list control, but I'm unsure of what else might be needed. I would like to distribute the app for NT4, 95, and 98. Could someone help me out?
|
|
|
|
|
If you want to distribute the program then it means you need only files
MSVCRT.DLL
MFC42.DLL
other mfc*.dll files are only for Debug version
Hope it helped, Honza
|
|
|
|
|
Run the Dependency Viewer on your EXE to find out which DLLs it uses.
|
|
|
|
|
Look on your VC++ CD for the DEVSTUDIO\Vc\Redist folder. This folder contains all the files you will need to redistribute any VC++ applications on various Windows platforms.
The file REDISTRB.WRI tells you which files you will need under which circumstances for a given platform.
For many applications you *will* a need different set of DLLs for WinNT and Win95, e.g. atl.dll.
Don't just copy some likely looking DLLs and hope it will be OK - I tried that once and got burnt
Dave
|
|
|
|