Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Juri Tsjornoi
|
Jul 6, 2007 - 12:22 AM
|
I have an icon with multiple layers (in my case it’s 8 - 16x16, 32x32 with 16 colors to 32 bit foreach). I create a CExtCmdIcon object. Use function CreateFromHICON with my icon passed as a parameter. Later I extract an HICON handler from CExtCmdIcon object using ExtractHICON function to insert it to CImageList. Image list is created to contain small icons (16x16) and when displayed it has resized versions of 32x32 icons. Is there a way to use the desired icon layer (in this case it’s 16x16)?
|
|
Technical Support
|
Jul 6, 2007 - 7:01 AM
|
The problem is not with the CExtCmdIcon class. The HICON icon is a container for one icon only. So you should load the icon of the needed size before attaching it to the CExtCmdIcon. Do not use the LoadIcon() method, because it can only load an icon whose size conforms to the SM_CXICON and SM_CYICON system metric values. You should use the LoadImage method instead so you can specify the width and height of the icon you want to load.
|
|
Suhai Gyorgy
|
Jul 6, 2007 - 6:42 AM
|
A HICON handle refers to one layer of the .ico file only. How do you create the HICON you use when creating the CExtCmdIcon object? My experience is that no Windows API can create a valid handle of a 32 bit layer (one with alpha channel). And I think you meant AssignFromHICON instead of CreateFromHICON, right?
|
|
Debabrata Mukherjee
|
Jul 5, 2007 - 11:28 PM
|
Continuing with our communication over this issue. So far we have been using the "General Forum" for our queries as there was some issue with our tech support login id. We have been using the General Forum Login id : SANKET and pwd:sagent. Kindly consider this as a continuation of that thread.
Waiting for your response to our last question on the General Forum.
Thanks.
|
|
Debabrata Mukherjee
|
Jul 14, 2007 - 6:42 AM
|
Hi ,
Waiting for a response....
|
|
Technical Support
|
Jul 16, 2007 - 11:05 AM
|
To help you we need to take a look at your project or debug it remotely.
|
|
Suhai Gyorgy
|
Jul 16, 2007 - 3:03 AM
|
First of all, I’d still need to clarify what you’d like to achieve.
In your application, you have 4 views (CSaIsBinsView, CSaIsPresentationView, CSaIsPlanNavigatorView, CSaIsPlanEditorView). Before integrating with Prof-UIS, the application window’s view area had been sliced up with splitters, each view going inside one of these parts.
All through this thread (and the previous), I thought that you wanted these 4 views as separate tab pages of one TabPageContainerWnd occupying the whole client area of the application window. But after seeing the screen shot you just sent me, now I think, that you want to keep 3 of the views as they were before, and you want the 4th area of the screen (bottom pane of m_wndArenaSplitter) to be occupied by a TabPageContainerWnd (where CSaIsPresentationView were before). Am I right? That means it’s not the CSplitterWnd that you want to convert to TabPageContainerWnd, but you want one of the existing panes to be occupied by a TabPageContainerWnd.
If so, let me know and I’ll try to modify the code accordingly.
|
|
Debabrata Mukherjee
|
Jul 13, 2007 - 12:33 AM
|
|
|
Technical Support
|
Jul 6, 2007 - 11:12 AM
|
Yes, we confirm that your subscription is valid and are ready to help you. But we need some test project that demonstrates the problem.
|
|
Suhai Gyorgy
|
Jul 6, 2007 - 2:46 AM
|
MSDN says about OnCreateClient: Never call this function! So just try removing that one line from CMainFrame::OnCreate and remove the overriden CMainFrame::OnCreateClient method.
But your last post was a little confusing and I still agree with Support, you should make a very basic sample application that demonstrates the problem.
|
|
Debabrata Mukherjee
|
Jul 9, 2007 - 12:44 PM
|
It would be very difficult for us to provide u a sample prototype. But we can assure you that we share the frame creation code with you. Please send us ur email id
|
|
Suhai Gyorgy
|
Jul 10, 2007 - 11:50 AM
|
You could try to change the code of that sample application I made in the thread on General Forum.
If that really doesn’t work out, you can try sending me your creation code to puffy_chris@yahoo.com Your application class’ InitInstance, CMainFrame::OnCreate would be crucial to see, and send along the followings, if you have them: CChildView::OnCreate; I don’t know how many and what kind of Views are created, those .h files would be good to see, too.
Also, a callstack would be nice when the application asserts, as you wrote earlier.
|
|
Debabrata Mukherjee
|
Jul 30, 2007 - 10:25 AM
|
Hi,
Thanks for your response.
We can do a webex to demonstrate the problem and you can also debug the problem remotely. Please suggest a good time. We would prefer Wednesday(08/01/2007) morning (8.00AM -9.00 AM EST) time for this.
Once you confirm I will send you the login details for the WebEx session.
Thanks, Debabrata
|
|
Chris Anderson
|
Jul 5, 2007 - 11:14 AM
|
In CExtReportGridWnd, the ReportItemRegister() always adds the row at the end. How could I insert a row at the given index in CExtReportGridWnd?
Thanks
|
|
Chris Anderson
|
Jul 6, 2007 - 11:54 AM
|
Thanks. I have used CExtTreeGridWnd::ItemInsert()
|
|
Technical Support
|
Jul 6, 2007 - 7:25 AM
|
The CExtReportGridWnd class displays a sorted/grouped set of report items (rows). Each new row is inserted at the end of report grid (i.e. it is appended) regarldes of the currently applied sorting/grouping rules. You should invoke the CExtReportGridWnd::ReportSortOrderUpdate() method after inserting one or more report items and all the new items will be moved to their correct locations. If you are not using sorting/grouping at all, it may be reasonable to switch to using CExtGridWnd instead because it is faster. You can also disable grouping in report grid control and use APIs of the CExtTreeGridWnd class for inserting tree items into exactly needed locations (the CExtTreeGridWnd::ItemInsert() method).
|
|
Ian Hollamby
|
Jul 5, 2007 - 6:31 AM
|
Hi, I am getting an Assert in debug mode on the following line "ASSERT( pItemDataExt != NULL )" in CExtComboBoxBase::OnCBResetContent() when I call ResetContent() on a CExtComboBox control. The combo box has data initialised in the dialog editor and under some circumstances I want to clear this and add other options. It seems to work fine in release mode and I would normally do this with a CComboBox control.
Is there another ’expected’ way of doing this?
thanks Ian
|
|
Technical Support
|
Jul 5, 2007 - 9:10 AM
|
Thank you for reporting the problem. Please comment out this ASSERT macro in the Prof-UIS code and recompile the library // ASSERT( pItemDataExt != NULL ); The problem should be gone.
|
|
Paul Cowan
|
Jul 4, 2007 - 9:35 AM
|
When a gird is first displayed the scroll bars are disabled, even if only part of the gird is displayed. The keyboard must be used to move cells to enable the scroll bars. How do I enable the scroll bars?
|
|
Technical Support
|
Jul 4, 2007 - 9:53 AM
|
Please make sure that you invoke m_wndSomeGrid.OnSwUpdateScrollBars(); code at the end of grid initialization.
|
|
Pierre MEDART
|
Jul 3, 2007 - 7:24 AM
|
Hi,
I’m constructing a CExtPopupMenuWnd like
CExtPopupMenuWnd * p_anExtPopupWnd = new CExtPopupMenuWnd(); CExtPopupMenuWnd::g_bMenuExpanding = false;
p_anExtPopupWnd->UpdateFromMenu(this->m_hWnd,&aMenu, false, true, false);
One of the item of my aMenu is set to checked but in the p_anExtPopupWnd it is not.
What do I miss ?
|
|
Suhai Gyorgy
|
Jul 3, 2007 - 8:37 AM
|
Support’s answer to a similar problem:
Each menu/toolbar item controls its status (enabled/disabled, checked/unchecked) via MFC command updating mechanism. So you can make the menu item checked by providing an update handler for the command ID (simply add the ON_UPDATE_COMMAND_UI handler for this command):
afx_msg void OnUpdateYourCommand(CCmdUI* pCmdUI);
...
ON_UPDATE_COMMAND_UI(ID_YOUR_COMMAND, OnUpdateYourCommand)
...
void CMainFrame::OnUpdateYourCommand( CCmdUI * pCmdUI )
{
pCmdUI->SetCheck( m_bChecked ? 1 : 0 );
}
|
|
Henry Tso
|
Jul 3, 2007 - 2:51 AM
|
Hi,
I want to do the following purpose. 1. I create a some dll project, each dll project include one child dialog resource. 2. I create a export function to do this child dialog creation. 3. In main program, I dymanic load this dll and call the export function to do child dialog creation. 4. After the program running, The main window with the specify Windows style (CExtPaintManagerOffice2007_R2_LunaBlue), but the embedded child window that created from DLL without Windows style apply.
Can I apply the Windows style in this child dialog where it created from DLL ?
|
|
Technical Support
|
Jul 3, 2007 - 7:41 AM
|
There are two solutions to what you want to achieve depending on if your DLLS should be used only in MFC/Prof-UIS-based executables (1) or they can also be used from a non-MFC based EXE (2).
1) Both the EXE and DLLs should use the same runtime library, MFC and Prof-UIS libraries configurations. If the DLLs should be loaded dynamically, you should use ::AfxLoadLibrary() MFC API instead of the ::LoadLibrary() Win32 API. All the Prof-UIS based windows and controls in this case have the same UI theme defined by the paint manager. Both the EXE and DLLs use the same copy of MFC and Prof-UIS libraries. Changing the current theme affects all the Prof-UIS controls both in the EXE and DLLs. This design is the most convenient and least problem prone.
2) All the DLLs should be MFC regular DLLs and linked with MFC and Prof-UIS statically. Each DLL has its own copy of Prof-UIS and the theme settings should be synchronized between them manually. Prof-UIS provides some basic APIs for theme synchronization in this case.
|
|
Neville Franks
|
Jul 3, 2007 - 1:04 AM
|
Hi, I have occasional reports from my users where ProfileBarStateSave() fails and CMainFrame::DestroyWindow() crashes. I have all the code in CMainFrame::DestroyWindow() in a try-catch block and the catch isn’t being entered. Only: return CExtNCW<CMDIFrameWnd>::DestroyWindow(); is outside the try-catch block.
The Version of the app has not changed when this happens. The Stack backtrace is as follows:
-------- *** Stack trace for last set context - .thread/.cxr resets it ChildEBP RetAddr WARNING: Stack unwind information not available. Following frames may be wrong. 0012ee78 0012ef1c ProfUIS262n!CExtHookSink::HookChains_t::g_HookWndProc+0xa5 0012ee7c 00786b90 0x12ef1c 0012f000 0040bca7 ProfUIS262n!CExtHookSink::HookChains_t::g_HookWndProc 00000000 00000000 Surfulater!CMainFrame::DestroyWindow+0x177 ------
Any idea why ProfileBarStateSave() randomly fails and why the crash occures?
I am using Prof-UIS V2.62
|
|
Neville Franks
|
Jul 3, 2007 - 10:13 PM
|
Thanks Suhai. I’ve added m_wndMenuBar.RemoveAllWndHooks(); and will update to the latest Prof-UIS version.
I’d still like to get some answer to ProfileBarStateSave() failing?
|
|
Technical Support
|
Jul 4, 2007 - 9:52 AM
|
The problem you reported in the top message often occurred in versions earlier than 2.70 but after the release of 2.70 nobody reported it. Besides, it was not related to the code that serializes the control bars. It occurred during automatic destruction of the main frame’s children and popup/descendant windows. We need to take a look at the complete call stack so that we can help you out with this.
|
|
Suhai Gyorgy
|
Jul 3, 2007 - 2:15 AM
|
Here is Support’s answer concerning the DestroyWindow crash: "We fixed a problem in 2.70 that may have to do with the error you encountered, especially if you are using MDI tabs in your project.
This problem is caused by an incorrect sequence of method calls that are performed to terminate window hooks. The termination calls should follow in the order reversed to the order the hooks were initialized. This may occur if you are using some hook-based classes like the menu bar and MDI tabs. Please try the following code at the beginning of the CMainFrame::DestroyWindow(): m_wndMenuBar.RemoveAllWndHooks(); " Although I don’t have MDI tabs, I also had the same problem and inserting this one line did help avoiding the crash.
But of course this still doesn’t answer your question with the failing ProfileBarStateSave().
|
|
Jia Hong Li
|
Jul 2, 2007 - 11:07 AM
|
======================================================================================== Original project setting is Use MFC in a "Shared DLL", and running well When I change setting to Use MFC in a "Static Library", got some errors below: ======================================================================================== Error 1 error C2039: ’classCExtNCW’ : is not a member of ’CExtNCW<CFrameWnd>’ ...\MainFrm.cpp 24 Error 2 error C2065: ’classCExtNCW’ : undeclared identifier ...\MainFrm.cpp 24 Error 3 error C2275: ’CFrameWnd’ : illegal use of this type as an expression ...\MainFrm.cpp 24 Error 4 error C2059: syntax error : ’)’ ...\MainFrm.cpp 24 Error 5 error C2143: syntax error : missing ’;’ before ’}’ ...\MainFrm.cpp 24 Error 6 error C2059: syntax error : ’}’ ...\MainFrm.cpp 24 Error 7 fatal error C1903: unable to recover from previous error(s); stopping compilation ...\MainFrm.cpp 78
======================================================================================== Source Code ======================================================================================== // CMainFrame
IMPLEMENT_DYNCREATE ( CMainFrame, CExtNCW < CFrameWnd > ) .........................................................( Line 24 )
BEGIN_MESSAGE_MAP ( CMainFrame, CExtNCW < CFrameWnd > ) ON_WM_CREATE() // Global help commands ON_COMMAND_EX ( ID_VIEW_MENUBAR, OnBarCheck ) ON_UPDATE_COMMAND_UI ( ID_VIEW_MENUBAR, OnUpdateControlBarMenu ) ON_COMMAND_EX ( ID_VIEW_UI_LOOK_BAR, OnBarCheck ) ON_UPDATE_COMMAND_UI ( ID_VIEW_UI_LOOK_BAR, OnUpdateControlBarMenu ) ON_COMMAND ( ID_HELP_FINDER, &CFrameWnd::OnHelpFinder ) ON_COMMAND ( ID_HELP, &CFrameWnd::OnHelp ) ON_COMMAND ( ID_CONTEXT_HELP, &CFrameWnd::OnContextHelp ) ON_COMMAND ( ID_DEFAULT_HELP, &CFrameWnd::OnHelpFinder )
ON_COMMAND ( ID_FILE_OPEN_IN_BROWSER, &CMainFrame::OnFileOpenInBrowser )
ON_COMMAND ( ID_VIEW_PREVIEW_BAR, &CMainFrame::OnPreviewBar ) ON_UPDATE_COMMAND_UI ( ID_VIEW_PREVIEW_BAR, &CMainFrame::OnUpdatePreviewBar ) ON_COMMAND ( ID_VIEW_DIRECTORY_BAR, &CMainFrame::OnDirectoryBar ) ON_UPDATE_COMMAND_UI ( ID_VIEW_DIRECTORY_BAR, &CMainFrame::OnUpdateDirectoryBar )
ON_COMMAND ( ID_VIEW_TOOLBAR_BROWSER, &CMainFrame::OnViewToolbarBrowser ) ON_UPDATE_COMMAND_UI ( ID_VIEW_TOOLBAR_BROWSER, &CMainFrame::OnUpdateViewToolbarBrowser ) ON_WM_CLOSE()
ON_COMMAND ( ID_FULL_SCREEN, &CMainFrame::OnFullScreen ) ON_COMMAND ( ID_FILE_VIEWER, &CMainFrame::OnSwitchBrowser2Viewer ) ON_COMMAND ( ID_PROGRAM_BROWSE, &CMainFrame::OnSwitchViewer2Browser ) ON_UPDATE_COMMAND_UI ( ID_FULL_SCREEN, &CMainFrame::OnUpdateFullScreen ) ON_COMMAND ( ID_FILE_DELETE, &CMainFrame::OnFileDelete ) ON_COMMAND ( ID_VIEW_SLIDE_SHOW, &CMainFrame::OnSlideShow ) ON_COMMAND ( ID_VIEW_OPTION, &CMainFrame::OnViewOption ) ON_COMMAND ( ID_SET_WALLPAPER, &CMainFrame::OnSetWallpaper ) ON_COMMAND ( ID_FILE_RENAME, &CMainFrame::OnFileRename ) ON_COMMAND ( ID_FILE_PRINT_PREVIEW, &CMainFrame::OnFilePrintPreview )
//ON_COMMAND(ID_FILE_RESET_RECENT_PATH, OnFileResetRecentPath) ON_NOTIFY ( TBN_DROPDOWN, AFX_IDW_TOOLBAR, OnToolbarDropDown ) ON_COMMAND ( ID_EDIT_SET_WALLPAPER, OnEditSetWallpaper )
ON_COMMAND_EX ( ID_VIEW_RESIZABLEBAR_TREE, OnBarCheck ) ON_UPDATE_COMMAND_UI ( ID_VIEW_RESIZABLEBAR_TREE, OnUpdateControlBarMenu ) ON_COMMAND_EX ( ID_VIEW_RESIZABLEBAR_PREVIEW, OnBarCheck ) ON_UPDATE_COMMAND_UI ( ID_VIEW_RESIZABLEBAR_PREVIEW, OnUpdateControlBarMenu ) ON_COMMAND_EX ( IDR_TOOLBAR_FULLSCREEN, OnBarCheck ) ON_UPDATE_COMMAND_UI ( IDR_TOOLBAR_FULLSCREEN, OnUpdateControlBarMenu ) ON_COMMAND_EX ( IDR_MENU_VIEWER, OnBarCheck ) ON_UPDATE_COMMAND_UI ( IDR_MENU_VIEWER, OnUpdateControlBarMenu ) ON_WM_GETMINMAXINFO() ON_WM_SYSCOMMAND() ON_REGISTERED_MESSAGE ( CExtPopupMenuWnd::g_nMsgPrepareMenu, OnExtMenuPrepare ) END_MESSAGE_MAP() ..................................................................................................................................( Line 78 )
|
|
Jia Hong Li
|
Jul 2, 2007 - 12:22 PM
|
PS: for project Property setting / Configuration Properties / Linker / Input / Additional Dependencies I set ".../ProfUIS270u.lib" before, I set ".../ProfUIS270su.lib" now
|
|
Technical Support
|
Jul 3, 2007 - 2:34 AM
|
You should include only (IMPORTANT) one file, which is Prof-UIS.h, in your StdAfx.h file. All the appropriate Prof-UIS libraries will be linked with your project automatically. So you should remove any explicit references to Prof-UIS libraries from the linker settings.
|
|
Jia Hong Li
|
Jul 9, 2007 - 2:52 PM
|
Thanks, it work fine for me. But now I switch Back to "Use MFC in a Shared DLL"
It VS2005 will say : This application has failed to start because ProfUIS270u.dll was not found. Re-installing the application may fix this problem.
PS: I have set up "...\Prof-UIS\Bin_800" in Tools > Options > Project and Solutions > VC++ Dir > Library.
What should I do for switching back ?
|
|
Technical Support
|
Jul 10, 2007 - 11:10 AM
|
The ProfUIS270u.dll file corresponds to the Release Unicode configuration of Prof-UIS. So please open the ProfUISDLL project and compile the "Win32 Unicode Release" configuration.
|
|
Jia Hong Li
|
Jul 2, 2007 - 11:25 AM
|
PS: I switch from Use MFC in a "Shared DLL" to "Static Library", but leave "link to ProfUIS by static library" the same
my other ProfUIS relative settting:
==================================================================================== ...\Prof-UIS\Include\Prof-UIS.h ==================================================================================== ... #define __EXT_PROFUIS_STATIC_LINK_WITH_RESOURCES ...
==================================================================================== *.rc2 of our project ==================================================================================== ///////////////////////////////////////////////////////////////////////////// // Add manually edited resources here... #if ( !(defined _AFXDLL && !defined __STATPROFUIS_WITH_DLLMFC__) ) #include <Resources/Resource.rc> #endif /////////////////////////////////////////////////////////////////////////////
|
|
Jia Hong Li
|
Jul 2, 2007 - 11:10 AM
|
How could I fix this problem ?
Thanks a lot
|
|
Paul Cowan
|
Jun 29, 2007 - 8:39 PM
|
I’m using CExtWA for resizable dialogs, but it doesn’t draw the gripper. I’ve tried using CExtResizableDialog, which draws the gripper, but I don’t want the theme coloring. So, how do I get CExtWA to draw a gripper, or CExtResizableDialog to not theme?
|
|
Technical Support
|
Jun 30, 2007 - 7:47 AM
|
You should draw the gripper manually over the default dialog surface and handle the WM_NCHITTEST message. The gripper area should be hit tested as HTBOTTOMRIGHT .
t is also possible to code your dialog inside a standalone DLL module where Prof-UIS is used as a static library and the is CExtPaintManagerNativeXP paint manager is installed. This will make your dialog having standard Windows theme regardless of any other conditions.
|
|
Paul Cowan
|
Jun 29, 2007 - 8:13 AM
|
How do I hide the combobox drop-down button in a read-only cell? The button is automatically disabled, but there is no need to display.
|
|
Technical Support
|
Jun 29, 2007 - 11:05 AM
|
By default this is not supported in grid cells that are read-only. You can only remove the drop-down button manually: // 1) Make the cell read-only
pCell->ModifyStyle( __EGCS_READ_ONLY );
// 2) Remove drop down button from it
pCell->ModifyStyle( 0, __EGCS_BUTTON_DROPDOWN );
|
|
Scott Moore
|
Jun 27, 2007 - 10:47 AM
|
Basically, I have a CExtResizeableDialog that I’m embedding in a CExtControlBar. However, I don’t want the title bar to show up when control bar is docked, just the gripper.
How do I do that?
|
|
Technical Support
|
Jun 27, 2007 - 12:18 PM
|
To see how a custom caption can be implemented, please run the <span class="newgreen"TabbedBars</span> sample, select the Resizable Bar Options tab page in the One Note tab page container control, and play with the options. If it is not what you are looking for, please let us know.
|
|
Bill Harris
|
Jun 27, 2007 - 8:55 AM
|
Hopefully, I making a simple beginner mistake. I have built a simple dialog based application. In the main dialog, I have embedded two dialog pages where only one of them is displayed at one time. The page to be displayed is selected by two of the buttons at the bottom of the main dialog. The problem I am having is that the items within the pages do not resize when I resize the main dialog. What am I doing wrong?
I have purposefully not worried about implementing handlers for several of the controls - to build the example quickly and keep the problem simple. Is there some essential handler that I am missing?
Note - I am currently using Prof-UIS 2.64
The essential sample source code follows:
// MyDlgOne.h : main header file for the PROJECT_NAME application //
#pragma once
#ifndef __AFXWIN_H__ #error "include ’stdafx.h’ before including this file for PCH" #endif
#include "resource.h" // main symbols
#define __PROF_UIS_PROJECT_CMD_PROFILE_NAME _T("MyDlgOneProfile")
class CMyDlgOneApp : public CWinApp { public: CMyDlgOneApp();
// Overrides public: virtual BOOL InitInstance();
// Implementation
// // Prof-UIS advanced options // void SetupUiAdvancedOptions();
DECLARE_MESSAGE_MAP() };
extern CMyDlgOneApp theApp;// MyDlgOne.cpp : Defines the class behaviors for the application. //
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include "stdafx.h" #include "PageBase.h" #include "MyDlgOne.h" #include "MyDlgOneDlg.h"
#ifdef _DEBUG #define new DEBUG_NEW #endif
// CMyDlgOneApp
BEGIN_MESSAGE_MAP(CMyDlgOneApp, CWinApp) ON_COMMAND(ID_HELP, &CWinApp::OnHelp) END_MESSAGE_MAP()
// CMyDlgOneApp construction
CMyDlgOneApp::CMyDlgOneApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance }
// The one and only CMyDlgOneApp object
CMyDlgOneApp theApp;
///////////////////////////////////////////////////////////////////////////// // Prof-UIS advanced options
void CMyDlgOneApp::SetupUiAdvancedOptions() { // // Prof-UIS command manager profile // VERIFY( g_CmdManager->ProfileSetup( __PROF_UIS_PROJECT_CMD_PROFILE_NAME ) );
// // General UI look // g_PaintManager.InstallPaintManager( RUNTIME_CLASS( CExtPaintManagerXP ) //RUNTIME_CLASS( CExtPaintManager ) //RUNTIME_CLASS( CExtPaintManagerXP ) //RUNTIME_CLASS( CExtPaintManagerOffice2003 ) //RUNTIME_CLASS( CExtPaintManagerOffice2003NoThemes ) //RUNTIME_CLASS( CExtPaintManagerStudio2005 ) //RUNTIME_CLASS( CExtPaintManagerNativeXP ) //RUNTIME_CLASS( CExtPaintManagerOffice2007_R1 ) //RUNTIME_CLASS( CExtPaintManagerOffice2007_R2_LunaBlue ) //RUNTIME_CLASS( CExtPaintManagerOffice2007_R2_Obsidian ) );
// // Popup menu option: Display menu shadows // CExtPopupMenuWnd::g_bMenuWithShadows = false;
// // Popup menu option: Display menu cool tips // CExtPopupMenuWnd::g_bMenuShowCoolTips = false;
// // Popup menu option: Initially hide rarely used items (RUI) // CExtPopupMenuWnd::g_bMenuExpanding = false;
// // Popup menu option: Display RUI in different style //
CExtPopupMenuWnd::g_bMenuHighlightRarely = true;
// // Popup menu option: Animate when expanding RUI (like Office XP) // CExtPopupMenuWnd::g_bMenuExpandAnimation = false;
// // Popup menu option: Align to desktop work area (false - to screen area) // CExtPopupMenuWnd::g_bUseDesktopWorkArea = false;
// // Popup menu option: Popup menu animation effect (when displaying) CExtPopupMenuWnd::g_DefAnimationType = CExtPopupMenuWnd::__AT_FADE; //$$__PROFUISAPPWIZ_KEY_MENU_ANIM_DISPMS$$
}
// CMyDlgOneApp initialization
BOOL CMyDlgOneApp::InitInstance() { // // Prof-UIS advanced options // SetupUiAdvancedOptions();
CWinApp::InitInstance();
SetRegistryKey( _T("MyDlgOne") ); //$$__PROFUISAPPWIZ_KEY_APP_REG_KEY$$ ASSERT( m_pszRegistryKey != NULL );
if( m_pszProfileName != NULL ) free( (void*)m_pszProfileName ); m_pszProfileName = _tcsdup( _T("MyDlgOne") ); //$$__PROFUISAPPWIZ_KEY_APP_PROFILE_NAME$$ ASSERT( m_pszProfileName != NULL );
CMyDlgOneDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel }
// Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application’s message pump. return FALSE; }
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// MyDlgOneDlg.h : header file //
#pragma once
// //-1 //0
#define __PROF_UIS_PROJECT_DLG_PERSIST_REG_KEY _T("CMyDlgOneApp-resizable-dialog-positions")
#define __PROF_UIS_PROJECT_DLG_PERSIST_REG_KEY _T("CMyDlgOneApp-resizable-dialog-positions")
class CMyPageDlgOne; class CMyPageDlgTwo;
// CMyDlgOneDlg dialog // class CMyDlgOneDlg : public CDialog class CMyDlgOneDlg : public CExtNCW < CExtResizableDialog > { // Construction public: CMyDlgOneDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data enum { IDD = IDD_MYDLGONE_DIALOG };
CExtButton m_BtnOK; CExtButton m_BtnCancel; CExtButton m_BtnButton1; CExtButton m_BtnButton2; CExtEdit m_Edit;
CMyPageDlgOne *m_pMyPageDlgOne; CMyPageDlgTwo *m_pMyPageDlgTwo;
protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation protected: HICON m_hIcon;
// Generated message map functions virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() public: afx_msg void OnBnClickedButton1(); public: afx_msg void OnBnClickedButton2(); };
//*********************************************************************************
class CMyPageDlgOne : public CPageBase { public: enum { IDD = IDD_PAGEONE }; CExtButton m_BtnOne; CExtButton m_BtnTwo;
public: CMyPageDlgOne ( CWnd *pParent = NULL );
protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP() };
//*********************************************************************************
class CMyPageDlgTwo : public CPageBase { public: enum { IDD = IDD_PAGETWO }; CExtButton m_BtnC; CExtButton m_BtnD; CExtEdit m_Edit;
public: CMyPageDlgTwo ( CWnd *pParent = NULL );
protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP() public: afx_msg void OnBnClickedPagedlgtwobutton(); };
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// MyDlgOneDlg.cpp : implementation file //
#include "stdafx.h" #include "PageBase.h" #include "MyDlgOne.h" #include "MyDlgOneDlg.h"
#ifdef _DEBUG #define new DEBUG_NEW #endif
// CMyDlgOneDlg dialog CMyDlgOneDlg::CMyDlgOneDlg(CWnd* pParent /*=NULL*/) : CExtNCW < CExtResizableDialog >(CMyDlgOneDlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); }
void CMyDlgOneDlg::DoDataExchange(CDataExchange* pDX) { CExtNCW < CExtResizableDialog >::DoDataExchange(pDX);
DDX_Control(pDX, IDOK, m_BtnOK); DDX_Control(pDX, IDCANCEL, m_BtnCancel); DDX_Control(pDX, IDC_BUTTON1, m_BtnButton1); DDX_Control(pDX, IDC_BUTTON2, m_BtnButton2); DDX_Control(pDX, IDC_EDIT1, m_Edit); }
BEGIN_MESSAGE_MAP(CMyDlgOneDlg, CExtResizableDialog) ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_BUTTON1, &CMyDlgOneDlg::OnBnClickedButton1) ON_BN_CLICKED(IDC_BUTTON2, &CMyDlgOneDlg::OnBnClickedButton2) END_MESSAGE_MAP()
// CMyDlgOneDlg message handlers BOOL CMyDlgOneDlg::OnInitDialog() { CExtNCW < CExtResizableDialog >::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically // when the application’s main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon
// // Setup anchors for resizable dialog controls // CExtNCW < CExtResizableDialog >::AddAnchor( IDOK, __RDA_RB ); CExtNCW < CExtResizableDialog >::AddAnchor( IDCANCEL, __RDA_RB ); CExtNCW < CExtResizableDialog >::AddAnchor( IDC_BUTTON1, __RDA_RB ); CExtNCW < CExtResizableDialog >::AddAnchor( IDC_BUTTON2, __RDA_RB ); CExtNCW < CExtResizableDialog >::AddAnchor( IDC_EDIT1, __RDA_LT, __RDA_LB ); CExtNCW < CExtResizableDialog >::AddAnchor( IDC_STATIC_PAGES_RECT, __RDA_LT, __RDA_RB );
CRect rcPages; ::GetWindowRect(::GetDlgItem(m_hWnd,IDC_STATIC_PAGES_RECT),&rcPages); ScreenToClient(&rcPages); // m_pMyPageDlgOne = new CMyPageDlgOne; ASSERT(m_pMyPageDlgOne != NULL); m_pMyPageDlgOne->Create(CMyPageDlgOne::IDD,this); m_pMyPageDlgOne->MoveWindow(&rcPages);
m_pMyPageDlgTwo = new CMyPageDlgTwo; ASSERT(m_pMyPageDlgTwo != NULL); m_pMyPageDlgTwo->Create(CMyPageDlgTwo::IDD,this); m_pMyPageDlgTwo->MoveWindow(&rcPages);
::ShowWindow(m_pMyPageDlgOne->GetSafeHwnd(),SW_SHOW);
//!__PROFUISAPPWIZ_KEY_PERS_POS_DLG // // Uncomment these lines to enable dialog position // saving/restoring in registry // //VERBOSE //CExtNCW < CExtResizableDialog >::EnableSaveRestore( // __PROF_UIS_PROJECT_DLG_PERSIST_REG_KEY, // _T("CMyDlgOneDlg-Saved-Position") // );
//!__PROFUISAPPWIZ_KEY_PERS_POS_DLG // // Show size gripper // //VERBOSE CExtNCW < CExtResizableDialog >::ShowSizeGrip( TRUE );
return TRUE; // return TRUE unless you set the focus to a control }
// //-1 //0
// If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework.
void CMyDlgOneDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CExtNCW < CExtResizableDialog >::OnPaint(); } }
// The system calls this function to obtain the cursor to display while the user drags // the minimized window. HCURSOR CMyDlgOneDlg::OnQueryDragIcon() { return static_cast<HCURSOR>(m_hIcon); }
//*************************************************************************************
CMyPageDlgOne::CMyPageDlgOne ( CWnd *pParent ) : CPageBase(CMyPageDlgOne::IDD, pParent) { }
void CMyPageDlgOne::DoDataExchange(CDataExchange* pDX) { CPageBase::DoDataExchange(pDX); DDX_Control(pDX,IDC_BUTTON_A,m_BtnOne); DDX_Control(pDX,IDC_BUTTON_B,m_BtnTwo); }
BEGIN_MESSAGE_MAP(CMyPageDlgOne, CPageBase) //{{AFX_MSG_MAP(CMyPageDlgOne) //}}AFX_MSG_MAP END_MESSAGE_MAP()
BOOL CMyPageDlgOne::OnInitDialog() { CPageBase::OnInitDialog();
AddAnchor( IDC_BUTTON_A, __RDA_RT ); AddAnchor( IDC_BUTTON_B, __RDA_RB );
return TRUE; }
//*************************************************************************************
CMyPageDlgTwo::CMyPageDlgTwo ( CWnd *pParent ) : CPageBase(CMyPageDlgTwo::IDD, pParent) { }
void CMyPageDlgTwo::DoDataExchange(CDataExchange* pDX) { CPageBase::DoDataExchange(pDX); DDX_Control(pDX,IDC_BUTTON_C,m_BtnC); DDX_Control(pDX,IDC_BUTTON_D,m_BtnD); DDX_Control(pDX,IDC_EDIT_PAGETWO,m_Edit); }
BEGIN_MESSAGE_MAP(CMyPageDlgTwo, CPageBase) //{{AFX_MSG_MAP(CMyPageDlgTwo) //}}AFX_MSG_MAP END_MESSAGE_MAP()
BOOL CMyPageDlgTwo::OnInitDialog() { CPageBase::OnInitDialog();
AddAnchor( IDC_EDIT_PAGETWO, __RDA_LT, __RDA_RT ); AddAnchor( IDC_BUTTON_C, __RDA_LB ); AddAnchor( IDC_BUTTON_D, __RDA_RB );
return TRUE; }
void CMyDlgOneDlg::OnBnClickedButton1() { if( m_pMyPageDlgTwo != NULL ) ::ShowWindow(m_pMyPageDlgTwo->GetSafeHwnd(),SW_HIDE); if( m_pMyPageDlgOne != NULL ) ::ShowWindow(m_pMyPageDlgOne->GetSafeHwnd(),SW_SHOW); }
void CMyDlgOneDlg::OnBnClickedButton2() { if( m_pMyPageDlgOne != NULL ) ::ShowWindow(m_pMyPageDlgOne->GetSafeHwnd(),SW_HIDE); if( m_pMyPageDlgTwo != NULL ) ::ShowWindow(m_pMyPageDlgTwo->GetSafeHwnd(),SW_SHOW); }
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Microsoft Visual C++ generated resource script. // #include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h"
///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// // English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32
#ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE //
1 TEXTINCLUDE BEGIN "resource.h\0" END
2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "\0" END
3 TEXTINCLUDE BEGIN "#define _AFX_NO_SPLITTER_RESOURCES\r\n" "#define _AFX_NO_OLE_RESOURCES\r\n" "#define _AFX_NO_TRACKER_RESOURCES\r\n" "#define _AFX_NO_PROPERTY_RESOURCES\r\n" "\r\n" "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" "LANGUAGE 9, 1\r\n" "#pragma code_page(1252)\r\n" "#include ""res\\MyDlgOne.rc2"" // non-Microsoft Visual C++ edited resources\r\n" "#include ""afxres.rc"" // Standard components\r\n" "#endif\r\n" "\0" END
#endif // APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// // // Icon //
// Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDR_MAINFRAME ICON "res\\MyDlgOne.ico"
///////////////////////////////////////////////////////////////////////////// // // Dialog //
IDD_MYDLGONE_DIALOG DIALOGEX 0, 0, 358, 230 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_APPWINDOW CAPTION "MyDlgOne" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,301,207,50,16 PUSHBUTTON "Cancel",IDCANCEL,245,207,50,16 PUSHBUTTON "Button1",IDC_BUTTON1,105,207,66,16 PUSHBUTTON "Button2",IDC_BUTTON2,175,207,64,16 EDITTEXT IDC_EDIT1,7,7,94,216,ES_MULTILINE | ES_AUTOHSCROLL GROUPBOX "",IDC_STATIC_PAGES_RECT,106,7,245,195,NOT WS_VISIBLE END
IDD_PAGEONE DIALOGEX 0, 0, 241, 150 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN PUSHBUTTON "Button_A",IDC_BUTTON_A,171,0,70,16 PUSHBUTTON "Button_B",IDC_BUTTON_B,170,134,71,16 END
IDD_PAGETWO DIALOGEX 0, 0, 264, 159 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN PUSHBUTTON "Button_C",IDC_BUTTON_C,6,78,83,14 PUSHBUTTON "Button_D",IDC_BUTTON_D,180,142,82,14 EDITTEXT IDC_EDIT_PAGETWO,6,59,251,15,ES_AUTOHSCROLL END
///////////////////////////////////////////////////////////////////////////// // // Version //
VS_VERSION_INFO VERSIONINFO FILEVERSION 1,0,0,1 PRODUCTVERSION 1,0,0,1 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "4094e4" BEGIN VALUE "CompanyName", "TODO: <Company name>" VALUE "FileDescription", "TODO: <File description>" VALUE "FileVersion", "1.0.0.1" VALUE "InternalName", "MyDlgOne.exe" VALUE "LegalCopyright", "TODO: (c) <Company name>. All rights reserved." VALUE "OriginalFilename", "MyDlgOne.exe" VALUE "ProductName", "TODO: <Product name>" VALUE "ProductVersion", "1.0.0.1" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1252 END END
///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO //
#ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO BEGIN IDD_MYDLGONE_DIALOG, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 351 TOPMARGIN, 7 BOTTOMMARGIN, 223 END END #endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources /////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // #define _AFX_NO_SPLITTER_RESOURCES #define _AFX_NO_OLE_RESOURCES #define _AFX_NO_TRACKER_RESOURCES #define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE 9, 1 #pragma code_page(1252) #include "res\MyDlgOne.rc2" // non-Microsoft Visual C++ edited resources #include "afxres.rc" // Standard components #endif
///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // PageBase.h : header file //
///////////////////////////////////////////////////////////////////////////// // CPageBase dialog
class CPageBase : public CExtResizableDialog { // Construction public: CPageBase(UINT _IDD, CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(CPageBase) // NOTE: the ClassWizard will add data members here //}}AFX_DATA
// Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CPageBase) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual void PostNcDestroy(); //}}AFX_VIRTUAL
// Implementation protected:
// Generated message map functions //{{AFX_MSG(CPageBase) virtual BOOL OnInitDialog(); //}}AFX_MSG DECLARE_MESSAGE_MAP() };
//{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// PageBase.cpp : implementation file //
#include "stdafx.h" #include "PageBase.h"
#ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif
///////////////////////////////////////////////////////////////////////////// // CPageBase dialog CPageBase::CPageBase(UINT _IDD, CWnd* pParent /*=NULL*/) : CExtResizableDialog(_IDD, pParent) { //{{AFX_DATA_INIT(CPageBase) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT }
void CPageBase::DoDataExchange(CDataExchange* pDX) { CExtResizableDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CPageBase) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP }
BEGIN_MESSAGE_MAP(CPageBase, CExtResizableDialog) //{{AFX_MSG_MAP(CPageBase) //}}AFX_MSG_MAP END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////////// // CPageBase message handlers
BOOL CPageBase::OnInitDialog() { CExtResizableDialog::OnInitDialog(); ShowSizeGrip( FALSE ); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
//////////////////////////////////////////////////////////////////////////
void CPageBase::PostNcDestroy() { CExtResizableDialog::PostNcDestroy(); delete this; } //////////////////////////////////////////////////////////////////////////
|
|
Bill Harris
|
Jun 29, 2007 - 9:01 AM
|
That fixed it!!
Thanks Suhai - Very much appreciated!
|
|
Bill Harris
|
Jun 28, 2007 - 7:35 PM
|
I just made the changes as you suggested. The ASSERT() is still triggered - the same as before. I’ve tried moving the statements around a bit - but I have not yet come up with the magical solution.
I appreciate your help and any more help you can give to get me through this.
|
|
Suhai Gyorgy
|
Jun 29, 2007 - 2:35 AM
|
I’ve made a sample application based on your code and that helped me find out the problem:
AddAnchor uses its first parameter as an ID, trying to find the control (child window) associated with that ID. But creating the child windows with the code m_pMyPageDlgOne->Create(CMyPageDlgOne::IDD,this); doesn’t set the child window’s ID to CMyPageDlgOne::IDD , as in this call it is the ID of the dialog template, based on which the window is created. So you have to set the ID manually. But it is better program design to use different IDs to dialog templates and different ones for control objects (in case at any point in the development you’d like to use 2 CMyPageDlgOne objects).
So I made 2 new IDs for the child window controls: IDC_FIRST_PAGE and IDC_SECOND_PAGE and I set these IDs manually with SetDlgCtrlID. SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CRect rcPages;
::GetWindowRect(::GetDlgItem(m_hWnd,IDC_STATIC_PAGES_RECT),&rcPages);
ScreenToClient(&rcPages);
//
m_pMyPageDlgOne = new CMyPageDlgOne;
ASSERT(m_pMyPageDlgOne != NULL);
m_pMyPageDlgOne->Create(CMyPageDlgOne::IDD,this);
m_pMyPageDlgOne->SetDlgCtrlID(IDC_FIRST_PAGE);
m_pMyPageDlgOne->MoveWindow(&rcPages);
m_pMyPageDlgTwo = new CMyPageDlgTwo;
ASSERT(m_pMyPageDlgTwo != NULL);
m_pMyPageDlgTwo->Create(CMyPageDlgTwo::IDD,this);
m_pMyPageDlgTwo->SetDlgCtrlID(IDC_SECOND_PAGE);
m_pMyPageDlgTwo->MoveWindow(&rcPages);
::ShowWindow(m_pMyPageDlgOne->GetSafeHwnd(),SW_SHOW);
CExtNCW < CExtResizableDialog >::AddAnchor( IDOK, __RDA_RB );
CExtNCW < CExtResizableDialog >::AddAnchor( IDCANCEL, __RDA_RB );
CExtNCW < CExtResizableDialog >::AddAnchor( IDC_BUTTON1, __RDA_RB );
CExtNCW < CExtResizableDialog >::AddAnchor( IDC_BUTTON2, __RDA_RB );
CExtNCW < CExtResizableDialog >::AddAnchor( IDC_FIRST_PAGE, __RDA_LT, __RDA_RB );
CExtNCW < CExtResizableDialog >::AddAnchor( IDC_SECOND_PAGE, __RDA_LT, __RDA_RB );
CExtNCW < CExtResizableDialog >::AddAnchor( IDC_STATIC_PAGES_RECT, __RDA_LT, __RDA_RB );
ShowSizeGrip(TRUE);
|
|
Bill Harris
|
Jun 28, 2007 - 8:31 AM
|
I tried adding the two lines you suggested and showing borders. This caused an ASSERT( ) to be triggered in AddAnchor() - due to hWnd being NULL or !::IsWindow(hWnd). When I take your suggested lines out, but leave the borders turned on, I can see that indeed the inner dialogs are not resizing.
Any new suggestions?
|
|
Suhai Gyorgy
|
Jun 28, 2007 - 12:57 PM
|
Yes, true, the Create method for the dialogs is not called at that point yet. So all you need to do is place the AddAnchor calls after the Create method. But to keep all AddAnchors together, this code would better: BOOL CMyDlgOneDlg::OnInitDialog()
{
CExtNCW < CExtResizableDialog >::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the applicationās main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CRect rcPages;
::GetWindowRect(::GetDlgItem(m_hWnd,IDC_STATIC_PAGES_RECT),&rcPages);
ScreenToClient(&rcPages);
//
m_pMyPageDlgOne = new CMyPageDlgOne;
ASSERT(m_pMyPageDlgOne != NULL);
m_pMyPageDlgOne->Create(CMyPageDlgOne::IDD,this);
m_pMyPageDlgOne->MoveWindow(&rcPages);
m_pMyPageDlgTwo = new CMyPageDlgTwo;
ASSERT(m_pMyPageDlgTwo != NULL);
m_pMyPageDlgTwo->Create(CMyPageDlgTwo::IDD,this);
m_pMyPageDlgTwo->MoveWindow(&rcPages);
::ShowWindow(m_pMyPageDlgOne->GetSafeHwnd(),SW_SHOW);
//
// Setup anchors for resizable dialog controls
//
CExtNCW < CExtResizableDialog >::AddAnchor( IDOK, __RDA_RB );
CExtNCW < CExtResizableDialog >::AddAnchor( IDCANCEL, __RDA_RB );
CExtNCW < CExtResizableDialog >::AddAnchor( IDC_BUTTON1, __RDA_RB );
CExtNCW < CExtResizableDialog >::AddAnchor( IDC_BUTTON2, __RDA_RB );
CExtNCW < CExtResizableDialog >::AddAnchor( IDC_EDIT1, __RDA_LT, __RDA_LB );
CExtNCW < CExtResizableDialog >::AddAnchor( IDC_STATIC_PAGES_RECT, __RDA_LT, __RDA_RB );
CExtNCW < CExtResizableDialog >::AddAnchor( CMyPageDlgOne::IDD, __RDA_LT, __RDA_RB );
CExtNCW < CExtResizableDialog >::AddAnchor( CMyPageDlgTwo::IDD, __RDA_LT, __RDA_RB );
//!__PROFUISAPPWIZ_KEY_PERS_POS_DLG
//
...
}
|
|
Technical Support
|
Jun 27, 2007 - 12:05 PM
|
|
|
Bill Harris
|
Jun 27, 2007 - 8:14 PM
|
I have read it. I have also anchored all of my controls. When you say "manually" - do you mean by specifying values like CPoint(5,95) and so on? I have tried this by going back and explicitly setting the values by uing anchor calls like the following:
AddAnchor( IDC_BUTTON_D, CPoint(90,90), CPoint(100,100) );
But it didn’t have any effect. Can you suggest something else that I might be doing wrong - or did I misunderstand what you meant by the word "manually"?
|
|
Suhai Gyorgy
|
Jun 28, 2007 - 3:55 AM
|
The problem is that your inner dialogs are not resizing. Even though you added anchoring to IDC_STATIC_PAGES_RECT, that won’t resize your dialogs as well. And since your inner dialogs are not resizing, IDC_BUTTON_D and the other buttons like that won’t get moving either.
I’m not sure if it works, but I’d try adding the lines: CExtNCW < CExtResizableDialog >::AddAnchor( CMyPageDlgOne::IDD, __RDA_LT, __RDA_RB ); CExtNCW < CExtResizableDialog >::AddAnchor( CMyPageDlgTwo::IDD, __RDA_LT, __RDA_RB );
just below CExtNCW < CExtResizableDialog >::AddAnchor( IDC_STATIC_PAGES_RECT, __RDA_LT, __RDA_RB );
And while testing, you might want to show borders around the inner dialogs, just to see if they are resizing or not.
|
|
Suhai Gyorgy
|
Jun 27, 2007 - 7:12 AM
|
Dear Support,
I’m using ProfUIS v2641 downloaded from your FTP server on 3/21/2007. I’m having trouble with deleting a toolbar. I’ve reduced the problem to this code: CExtToolControlBar *pDynBar = new CExtToolControlBar();
pDynBar->Create(_T("Dynamically created"), AfxGetMainWnd(), ID_SOME_ID);
delete pDynBar;
In release mode (Static Unicode Release), app crashes on the delete line. I tried stepping through the destructor of CExtToolControlBar in debug mode, but I couldn’t see what could cause the problem. App does not crash in debug mode. AfxGetMainWnd() is a CFrameWnd-derived object. When I wrote and tested this part of our application, it worked fine, but I think we used another version of ProfUIS at that time, unfortunately I couldn’t tell which one. Could you please advise? Thank you! Chris
|
|
Technical Support
|
Jun 27, 2007 - 12:03 PM
|
Please do a search for the KillBar() function in Prof-UIS forums. It is exactly what you need.
|
|
Suhai Gyorgy
|
Jun 28, 2007 - 4:08 AM
|
Great, thank you! I guess it’d be helpful to make a FAQ of this issue, as it is not obvious at all.
|
|
Gevork Odabashyan
|
Jun 27, 2007 - 6:13 AM
|
Hello
How can I constrain the size of input text in a CExtGridCellString?
Next, I have a CExtPropertyGrid in a CExtResizablePropertyPage. When this grid has focus and the CTRL is pressed, input focus moves to next control in the property page. But I your property grid sample input focus inside property grid changes to next cell in this case. What I need to do to have the same behavior?
Thank for support
|
|
Suhai Gyorgy
|
Jun 27, 2007 - 6:33 AM
|
1. CExtGridCellEx::LimitTextSet can be used for this purpose.
2. Isn’t it the TAB key instead of CTRL key? I guess you should override PreTranslateMessage in your CExtResizablePropertyPage-derived class and if the message is the WM_CHAR message with TAB virtual key, let the grid have first crack at the message (call PreTranslateMessage of grid)
|
|
Suhai Gyorgy
|
Jun 27, 2007 - 7:51 AM
|
Sorry, there were some mistakes in last post about handling TAB key. Here’s code: BOOL CMyResizablePage::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB && GetFocus() == &m_wndPropGrid)
return m_wndPropGrid.PreTranslateMessage(pMsg);
return CExtResizablePropertyPage::PreTranslateMessage(pMsg);
}
|
|
Gevork Odabashyan
|
Jun 28, 2007 - 4:23 AM
|
Can Prof-UIS support help on TAB problem?
|
|
Gevork Odabashyan
|
Jun 28, 2007 - 4:22 AM
|
Thanks, Gyorgy, but your code about TAB key doesn’t work. First, CExtPropertyGridCtrl::PreTranslateMessage() is protected, but even after that, GetFocus() == &m_wndPropGrid doesn’t work. I don’t know why.
|
|
Suhai Gyorgy
|
Jun 28, 2007 - 6:33 AM
|
One more addition to the code to be on the save side: BOOL CMyResizablePage1::PreTranslateMessage(MSG* pMsg)
{
if (
pMsg->message == WM_KEYDOWN
&& pMsg->wParam == VK_TAB
&& m_PropGridCtrl.IsChild(GetFocus())
&& m_PropGridCtrl.GetActiveGrid() != NULL
)
{
m_PropGridCtrl.GetActiveGrid()->SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
return TRUE;
}
return CExtResizablePropertyPage::PreTranslateMessage(pMsg);
}
|
|
Gevork Odabashyan
|
Jun 29, 2007 - 2:58 AM
|
Thanks, Gyorgy! But your code still doesn’t work. Propery page’s focus remains on the CExtProperyGridWnd, wich has no reaction on this forwarded messge.
|
|
Suhai Gyorgy
|
Jun 29, 2007 - 4:55 AM
|
I really don’t know what the problem is, as it is working for me. You can download the sample I worked with from here. It is a modified version of ProfUIS’s ResizablePropertySheet sample.
|
|
Gevork Odabashyan
|
Jul 2, 2007 - 5:53 AM
|
Thanks a lot Gyorgy! I’m very pleased for your help. Your code works well. But I have changed CMyResizablePage1::GetPropertyStore() method to this:
CExtPropertyStore * CMyResizablePage1::GetPropertyStore() { ASSERT_VALID( this ); if( m_pPS != NULL ) return m_pPS;
m_pPS = new CExtPropertyStore;
CExtPropertyCategory* pCat = 0; CExtPropertyValue* pItem = 0;
for (DWORD i = 0; i < 3; ++i) { pCat = new CExtPropertyCategory(_T("TestCategory")); if (m_pPS->ItemInsert(pCat)) { for (DWORD j = 0; j < 5; ++j) { pItem = new CExtPropertyValue(_T("TestName")); if (pCat->ItemInsert(pItem)) { CExtGridCellString* pValue = STATIC_DOWNCAST(CExtGridCellString, pItem->ValueActiveGetByRTC(RUNTIME_CLASS(CExtGridCellString))); pValue->ModifyStyleEx( __EGCS_EX_WRAP_TEXT); pItem->HeightPxSet(50); pValue->LimitTextSet(50); } } } }
return m_pPS; }
This is like the code in my project. The TAB key doesn’t work in this case. I have sent your project to support. I hope they will check what’s wrong.
|
|
Suhai Gyorgy
|
Jun 28, 2007 - 6:27 AM
|
I’m sorry, you are right, I’ve tested the code with another control which didn’t have PreTranslateMessage protected and no child controls either, so GetFocus worked on that.
But now I’ve made a little sample application with PropertySheet and PropertyGrid, and the following code works. BOOL CMyResizablePage1::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB && m_PropGridCtrl.IsChild(GetFocus()))
{
m_PropGridCtrl.GetActiveGrid()->SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
return TRUE;
}
return CExtResizablePropertyPage::PreTranslateMessage(pMsg);
}
Still, I’d also like to hear from Support whether this solution is acceptable and safe. And even though PropertyGrid sample works as you’ve described (TAB goes through all property items of grid) I’m not sure if this is a good design: once you get inside the grid by pressing TAB, there’s no way out, you can only get to the other controls of the dialog if you use the mouse.
|
|
Svetlozar Kostadinov
|
Jun 26, 2007 - 9:44 AM
|
Hello Prof-UIS Team,
I think it should be useful if CExtPropertyGridToolBar had a default Tool Button for reseting all grid cells to their default values. Maybe if it’s possible this button could be aligned at the right side of the bar. Consider this suggestion.
Regards!
|
|
Technical Support
|
Jun 27, 2007 - 12:01 PM
|
You could initialize the toolbar inside the property grid control with your own buttons and handle their clicks. You should implement a CExtPropertyGridCtrl -derived class and override the OnPgcCreateBars() virtual method in it. This method should invoke the method of the parent class for creating all the bars inside the property grid control and then add any needed toolbar buttons. The CExtPPVW < CExtPropertyGridCtrl > class in Prof-UIS implements an extended version of the property grid control which is able to print and print preview the displayed property tree and here is how this method is implemented in it: bool CExtPPVW < CExtPropertyGridCtrl > :: OnPgcCreateBars()
{
ASSERT_VALID( this );
if( ! CExtPPVW_Base < CExtPropertyGridCtrl > :: OnPgcCreateBars() )
return false;
CWnd * pWnd = GetChildByRTC( RUNTIME_CLASS(CExtPropertyGridToolBar) );
if( pWnd != NULL )
{
ASSERT_VALID( pWnd );
CExtPropertyGridToolBar * pToolBar = STATIC_DOWNCAST( CExtPropertyGridToolBar, pWnd );
VERIFY( pToolBar->InsertButton( -1 ) );
VERIFY( pToolBar->InsertButton( -1, ID_EXT_PPV_QUICK_PRINT ) );
VERIFY( pToolBar->InsertButton( -1, ID_EXT_PPV_PRINT_PREVIEW ) );
}
return true;
} The CExtPropertyGridToolBar toolbar will send the command and command updating requests to your CExtPropertyGridCtrl -derived class. So you also need to override the OnCmdMsg() virtual method for handling your toolbar buttons or implement message map based handler methods for them.
|
|
Gevork Odabashyan
|
Jun 26, 2007 - 7:35 AM
|
Hello
First, how can I add a verical scrollbar to a multiline CExtGridCellString of a CExtReportGridWnd? Next, CExtGridCellCheckBox::SetAutoTextMode() method disables character’s input into the sell, but also displays the "True" of "False" text in it. But what if I need neither character’s input, no any text in the cell?
Thank you
|
|
Technical Support
|
Jun 26, 2007 - 2:05 PM
|
1. The scrollbars are not supported in the inplace editor. Actually grid cells should not be used for editing some long multiline text. Some dialog with a text editor inside could be more suitable for this . This dialog can be shown when the user clicks the cell ellipsis button.
2. There is no need to turn on the AutoTextMode mode, do not assign any text to the cell and apply the __EGCS_NO_INPLACE_CONTROL cell style. When this style is applied for a particular grid cell, the in-place editor window will not be activated: pCell->ModifyStyle( __EGCS_NO_INPLACE_CONTROL );
|
|
Khachatur Petrosyan
|
Jun 26, 2007 - 5:02 AM
|
Hello,
I want to remove all items from the ReportGrid control.
class CMyGrid : public CExtPPVW < CExtReportGridWnd > { }
CMyGrid grid; .... grid.RowRemoveAll();
When I call RowRemoveAll() function I receive an assertion in the CExtTreeGridDataProvider::RowRemove;
bool CExtTreeGridDataProvider::RowRemove( ULONG nRowNo, ULONG nRemoveCount // = 1 ) { ASSERT_VALID( this ); nRowNo; nRemoveCount; // this method must never be invoked ASSERT( FALSE ); return false; }
What is the right method of deleting all items from the ReportGrid control?
Thanks, KP
|
|
Technical Support
|
Jun 26, 2007 - 5:21 AM
|
You can also use the following code: LONG nRowCount = m_wndGrid.RowCountGet();
if( nRowCount > 0L )
{
HTREEITEM hRootItem = m_wndGrid.ItemGetRoot();
ASSERT( hRootItem != NULL );
if( hRootItem != NULL )
m_wndGrid.ItemRemove( hRootItem, true, true );
}
|
|
Khachatur Petrosyan
|
Jun 26, 2007 - 5:26 AM
|
This method works well.
Thanks, KP
|
|
Suhai Gyorgy
|
Jun 26, 2007 - 5:16 AM
|
In ReportGrid, rows are items and you insert them with ReportItemRegister. So removing goes the other way around: you need to use ReportItemUnRegister. But you should be calling this method to every item one by one, so it might be easier to programatically select all items/rows of the ReportGrid and use ReportItemUnRegisterSelection method instead of ReportItemUnRegister.
|
|
Paul Cowan
|
Jun 25, 2007 - 12:55 PM
|
Can I build a toolbar dynamically from a series of separate icons instead of one large bitmap? When built from icons, how can I change the size of the toolbar from 16X16 to 32X32 etc?
|
|
Paul Cowan
|
Jul 4, 2007 - 12:43 PM
|
Thanks for the reply.
What is the easiest way of switching between different sized icons? I would like to have an option in the program to change all the toolbar buttons from 16X16 to 32X32. Can I have a .ico that has more then one size image and switch between them?
|
|
Technical Support
|
Jul 5, 2007 - 4:02 AM
|
1) If your application is not customizable, reload all the command descriptions in the command manager, i.e. the command manager should be updated from the different toolbar/icon resources and finally you should re-compute the layout of the main frame/dialog and other windows.
2) If your application is customizable, the command tree nodes which represent toolbar buttons and menu items may contain icons of the of previous size, edited by the user so you should re-initialize the entire customization subsystem in the same way as it is done in the LanguageSwitcher sample where all the command texts should be reset after the preferred language changes.
Please let us know more details about your application so we can provide you with the exact steps.
|
|
Suhai Gyorgy
|
Jul 5, 2007 - 1:27 AM
|
At any point, you can get a pointer to a particular command by its ID: CExtCmdItem * pCmdItem =
g_CmdManager->CmdGetPtr(
strProfileName,
nCmdId
);
ASSERT (pCmdItem != NULL );
g_CmdManager->CmdSetIcon(
strProfileName,
pCmdItem->m_nCmdID,
hIcon,
false // Use the hIcon handle "as is"
);
Here hIcon can be either 16x16 or 32x32. But keep in mind that changing the icon size for a command will change the icon size in the toolbars and in the menus as well. If you want to keep 16x16 icons in the menus all the time, follow this FAQ: How to use a small icon in menus and a large icon in toolbars for the same command?
|
|
Suhai Gyorgy
|
Jun 26, 2007 - 1:46 AM
|
|
|
Vrinda Savargaonkar
|
Jun 25, 2007 - 9:29 AM
|
Dear Sir,
In my ribbonbar mdi ( version 2.70) application when we right click on ribbon bar one context menu appear having option 1) customize quick access toolbar 2) reset quick tool bar 3) place quick access toolbar below the ribbon 4) minize the ribbon bar the similar menu appear on chevrron button of quick access toolbar .
How can i play with this menu i.e how to add or remove options from this menu.
Actually I want to remove the option 3 & 4 from menu completely.
How can i remove these options 3 & 4 from menu?
One more questions is how to place bitmap on CExtResizable dialog?
Regards.
|
|
Technical Support
|
Jun 27, 2007 - 10:11 AM
|
You should remove the ID_EXT_RIBBON_QATB_PLACE_BELOW and ID_EXT_RIBBON_MINIMIZE commands from the ribbon menus. You should a custom CExtRibbonBar -derived class which handles the CExtPopupMenuWnd::g_nMsgPrepareMenu registered message, which allows you to modify pop-up menus at run time. Please also read the following FAQ article related to this message:
How to insert menu items at run time?
In you code, find the menu items with the ID_EXT_RIBBON_QATB_PLACE_BELOW and ID_EXT_RIBBON_MINIMIZE command identifiers and remove them.
|
|