|
I have the code below:
/////////////////////////////////////////////////////
CFont font;
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
lf.lfHeight = 12;
strcpy(lf.lfFaceName, "Arial");
VERIFY(font.CreateFontIndirect(&lf));
SetDlgItemInt(IDC_EDIT1, X, TRUE);
////////////////////////////////////////////////////
I want to apply the new font to the value X when I call SetDlgItemInt() above. I dont know how to do it. Can someone help?
Jerry
|
|
|
|
|
Assuming the code you've shown is in the OnInitDialog() method, it will not work because the CFont object must exist as long as the edit box itself. Therefore, the CFont object must be a member variable of the dialog.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Change
CFont font
to be a member variable
CFont m_font
Then do something like this
CWnd* pWnd = GetDlgItem(IDC_EDIT1);
pWnd->SetFont(&m_font);
NOTE: m_font needs to be there for the duration of the edit box.
Ant.
|
|
|
|
|
I have inserted a menu in a dialog box, and added some
ON_UPDATE_COMMAND_UI in the dialogbox messagemap, so that some menu
options are disabled/enabled depending of the application state.
When i open the menu, my CCmdUI handler is not called, the result is
that all options stay enabled.
I known that in an standard document/view application, the mainframe
calls these CCmdUI handlers during idle time. How to make it work in a
dialogbox application ?
JPG
|
|
|
|
|
why would it have a difference between dialog menus and others ?
CMenu* pMenu;
<font style="color:blue;">if </font>(pMenu = GetMenu()) {
pMenu->EnableMenuItem(ID_MENU_ITEM1, MF_GRAYED); <font style="color:green;">
pMenu->EnableMenuItem(ID_MENU_ITEM2, MF_ENABLED); <font style="color:green;">
}
is that ok for you ?
TOXCCT >>> GEII power
|
|
|
|
|
Indeed i could write a function that would do all the required EnableMenuItem,
and call that function everytime i know some menu options have to be updated.
But the goal is to let the MFC code do it automatically, so that i just have to
write some ON_UPDATE_COMMAND_UI in the messagemap and the corresponding message
handlers.
JPG
|
|
|
|
|
got answer on that page :
http://support.microsoft.com/default.aspx?scid=kb;en-us;242577
JPG
|
|
|
|
|
I have a SDI with splitters that look like this:
________________
| | |
|View| |
|Tree|ViewList | (fig. 1)
| | |
| | |
|____|__________|
and I am trying to make a second View (Frame) with splitters that look like this:
____________________
|*****|*View 2******|
| |_____________|
| | | |
|V1 | | |
| |V3 | View 4 | (fig. 2)
| | | |
| | | |
|_____|____|________|
The 1. question: How can I switch between the frames (Views)?
The 2. question: How can I create the 2. frame with splitter to look as shown (fig. 2).
It is important for the first version, that I can switch between to frames. Maybe it is easier to make the second frame like this (no Splitter in a splitter –fig. 3):
__________________
|V 1 | view2 |
|_____|___________|
|View | | (fig. 3)
| 3 |View 4 |
| | |
| | |
|_____|___________|
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, <br />
CCreateContext* pContext) <br />
{<br />
if (!m_wndSplitter.CreateStatic(this,1,2))<br />
{<br />
return FALSE;<br />
}<br />
CRect rect;<br />
GetClientRect(&rect);<br />
CSize sizeTree = rect.Size();<br />
<br />
sizeTree.cx = rect.Width()/4; <br />
<br />
if (!m_wndSplitter.CreateView(PANE_ROW_ZERO, eTreeWinPane, RUNTIME_CLASS(CViewTree),<br />
sizeTree, pContext)|| <br />
(!m_wndSplitter.CreateView(PANE_ROW_ZERO, eListWinPane, RUNTIME_CLASS(CViewList),<br />
CSize(100,100), pContext)))<br />
{ <br />
return FALSE;<br />
}<br />
return TRUE;<br />
}<br />
Must I use OnCreateClient()function, or there is an alternative?
Thanx in advance,
Nadin_sam
|
|
|
|
|
|
I have a dialog box opened by the main application that I want to place under the main application window if the main window receives focus. This dialog is modeless however when I click on the main application the dialog remains on top. I'm assuming this is the intended design of dialogs and I could fix this by changing it to a formview. Given I don't want to spend the time right now, is it possible to reposition a modeless dialog under the main application?
Thanks!
|
|
|
|
|
While creating the modeless dialog give the parent as the desktop window.
You can get a pointer to the desktop window by using this api GetDeskTopWindow().
God is Real, unless declared Integer.
|
|
|
|
|
Or use NULL as the parent
Ant.
|
|
|
|
|
Since NULL is default that obviously didn't work. But thanks anyways. I'll try the GetDesktopWindow(). Note that the 't' in top should be lower case. You have it as uppercase which was undefined.
Both of these ideas are not doing it. Setting it too NULL was where it was to begin with and the GetDesktopWindow() will crash the program.
A detail that perhaps I could have mentioned is that this dialog opens from a DLL. Now I tried to halt the setting for the Resource Handler until after I create the dialog, however that doesn't seem to help. Is there perhaps another solution? I will play around with these solutions and see where it gets me.
Thanks!
|
|
|
|
|
OK, my mistake it seems NULL points the parent at the main application window. Sorry!
Ant.
|
|
|
|
|
Hi,all:
A complex but not intersect concave polygon,use gluNewTess to create a GLUtesslator object.How to realize? thanks
|
|
|
|
|
You will likely have to split it up into triangles. I am guessing if you search around there are probably algorithms to do it, if you can't split it up some other way (e.g., you know what the polygon is going to be, so you can split it up in the code.)
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
In fact,I know there are some algorithms that can do.
In the RedBook of OpenGL,I find that the glu library has already gave us the routines such as GLUtesselator,gluNewTess and gluCallBack,but when I try to use these functions in my project(v C++ platform) I could not get it work probably.I don't know why!
the TedBook says as bellow
"The OpenGL library (GL) is designed for low-level operations, both streamlined and accessible to hardware acceleration. The OpenGL Utility Library (GLU) complements the OpenGL library, supporting higher-level operations. Some of the GLU operations are covered in other chapters. Mipmapping (gluBuild*DMipmaps()) and image scaling (gluScaleImage()) are discussed along with other facets of texture mapping in Chapter 9. Several matrix transformation GLU routines (gluOrtho2D(), gluPerspective(), gluLookAt(), gluProject(), and gluUnProject()) are described in Chapter 3. The use of gluPickMatrix() is explained in Chapter 13. The GLU NURBS facilities, which are built atop OpenGL evaluators, are covered in Chapter 12. Only two GLU topics remain: polygon tessellators and quadric surfaces, and those topics are discussed in this chapter.
To optimize performance, the basic OpenGL only renders convex polygons, but the GLU contains routines to tessellate concave polygons into convex ones, which the basic OpenGL can handle. Where the basic OpenGL operates upon simple primitives, such as points, lines, and filled polygons, the GLU can create higher-level objects, such as the surfaces of spheres, cylinders, and cones.
..."
You can find this article here:
http://www.dcc.unicamp.br/~lmarcos/courses/mc603/redbook/chapter11.html
So if you have used these routines,would you please send me a example.
Thanks!!
|
|
|
|
|
Im using a Java dialog to call a C++ app using JNI, All I want to do is pass an object into the cpp app, there is no writing to be done to the object, just passing strings and bool values. How do I change my main() in cpp to be able to accept this object and be able to compile it into a .dll
Any articles or help is appreciated.
Cheers
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
|
HI,
I have an VC++ application (VC++ 7.0) working fine on win 2000, but on XP I get a "Dialog Failed" error while launching an ODBC Data Source administrator dialog (Selecting an user DSN)
I got a suggestion to check the MDAC version, I did it and found that the XP machine has the latest MDAC 2.8.
Can anyone let me know what could be wrong? Or am I missing out something else!
Thanks
|
|
|
|
|
Hi everybody,
I want to export bmp files as Eps file format.if anyone know these things ,reply me.
|
|
|
|
|
You could try with BTNexGenIPL in combination with Ghostscript. Both are open source libraries, with BTNextGenIPL you can read the bmp, and with ghostscript you can create EPS files... perhaps worth a look for you, not sure if there are libraries out there which can do both. (You might not even need BTNexGenIPL, not sure if you can use raw data for Ghostscript input, don't think you can though)
|
|
|
|
|
I am creating Images Like this ...It works for JPG,gif,png.But not for EPS.SO I need a Method to export Images as EPS.
Image image(L"Mosaic.bmp");
CLSID pngClsid;
GetEncoderClsid(L"image/eps", &pngClsid);
image.Save(L"Mosaic2.eps", &pngClsid, NULL);
But this is not working.
Mosaic.bmp is real bmp file. Now I think this is clear for u what I going to do.
|
|
|
|
|
I'm trying to convert a CString to UTF-8, anyone who knows haw this is to be done? I've read a lot of pages on the Internet about WideCharToMultiByte but I can't get it to work. If someone knows how to do I would be very greatful for your help.
Thanks
|
|
|
|
|
If your application is compiled with UNICODE (and _UNICODE ) defined, your CString s will contain WCHAR s. You should be able to use WideCharToMultiByte directly, passing the CP_UTF8 value.
If your application is not compiled with UNICODE , your CString s will contain char s, which may represent multi-byte character strings (depending on the locale). There are no routines for directly converting a char -oriented string from one character set to another; instead, you should convert to a WCHAR string using MultiByteToWideChar , then convert to UTF-8 as above.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|