|
|
Comments and Discussions
|
|
 |

|
You have provided several incorrect fact in this article
Incorrect Fact 1:
"they don't allow resizing below a width and height established by Microsoft, and extended styles don't work with them. Here I present a hack to be able to do "
Correct Fact 1: You can shrink CPropertySheet as much you can shrink Notepad.exe.
Incorrect Fact 2:
"•If you set extended styles like WS_EX_TOOLWINDOW when creating the CPropertySheet, the extended style is completely lost and the CPropertySheet doesn't show the caption as a mini-caption. "
Correct Fact 2: You can set extendet style WS_EX_TOOLWINDOW to CPropertySheet.
Here is a link to get started: http://support.microsoft.com/kb/300606[^]. Notice how the styles are being set. Sameway you can also set the extentend style as well.
Also you look at Example 8 at this: MFC/C++ Helper Class for Window Resizing[^]
Hope that clarifies some of the issues
|
|
|
|

|
> You have provided several incorrect fact in this article.
I am sure you are correct ... now.
However, I note that the original article was written over a decade ago and was probably correct at the time. (I seem to recall the problems mentioned when using MFC 4.2 or 6.0).
You should clarify which versions of MFC (and Windows) you are using or have tested with (as should the original author I guess).
Andrew Phillips
http://www.hexedit.com
andrew @ hexedit.com
|
|
|
|
|

|
This article was helpful. However, the report of bugs and crash on VC7 left me a bit cooled to the idea of using it as is.
I found a simple work around to retrieve the original size of the dialog.
In the ressource editor, I added a static control (IDC_BRC_REF) to mark the bottom right corner of the page dialog. I set its visible property to false so it doesn't display.
In the OnInitDialog(), I replace the code to retrieve the bottom right corner of that control and use it to calculate the dcx and dxy values:
// Get size reference
pppg->GetClientRect(rcOriginal);
pWnd = pppg->GetDlgItem(IDC_BRC_REF);
pWnd->GetWindowRect(rcModified);
POINT point1 = rcModified.BottomRight();
pppg->ScreenToClient(&point1);
int dcx = rcOriginal.Width() - point1.x;
int dcy = rcOriginal.Height() - point1.y;
...
It's not very elegant but it works.
I also spent too much time on what I thought would be very simple. Hopefully this will help someone else.
Note: Like #17, I also develop with Japanese/English resource and sometime get strange return values when I try to use functions to mesure size of Japanese resource...?
|
|
|
|

|
hi,
i have a propertysheet wizard and i want to use it on a japanes windows. the problem is that the whole wizard dialog is too wide. the controls on the pages are also too wide.
on japanes windows the values i get by pppg->MapDialogRect(rcOriginal); are higher then on the english windows.
how can i fix this ? why is the japanes windows so "funny" ?
thanks for help
best regards
emmi
|
|
|
|

|
I used your solution on my program and it worked beautifully until this:
another version of it uses a DLL with resources and their corresponding translated strings (Used Passolo do do that).
When the P. sheet is invoked, the call:
CPropertyPage* pppg = GetActivePage();
fails and I get a First Change Exception. (BAAAAAD)
Again, this is only when I am using the DLL with the translated strings for the resources.
Do you have any ideas?
Thank you.
|
|
|
|

|
I found this article very useful; it solved a problem that I had already spent too much time on.
A point that might explain an earlier bug report:
In VC++7 (2003.net) I found that the programme crashed on the GlobalFree(hgbl) call towards the end of the function. I took this out (and also the UnlockResource(hgbl) call just above) and it worked OK after that. I guess VC7++ really does mean it when the help says don't call the GlobalFree function after LoadResource!
|
|
|
|

|
I got two property sheets A and B. I'd like to show A within B as if poperty pages of A are nature property pages of B. When one navigates to B, A should be hidden. Does anyone know how to do this? Thanks.
|
|
|
|

|
hi,
i want to know how can i change the sheet size according to each page size(pages are of different sizes), in the aboe example once the sheet is created of first active page size it remains of that size only.
if you use the setActive virtual member of pages to call the function containing same code as in initdialog then also it has problem of resizing other pages!
using above code only
sk9
|
|
|
|

|
hi,
i want to know how can i change the sheet size according to each page size(pages are of different sizes), in the aboe example once the sheet is created of first active page size it remains of that size only.
if you use the setActive virtual member of pages to call the function containing same code as in initdialog then also it has problem of resizing other pages!
sk9
|
|
|
|

|
Something along these lines worked for me and appears far simpler than the solution offered (without wishing to detract in any way from the effort). It also shows how to remove the apply button. The button sizes are my choice and mean you don't have to do anything else to display the tool window correctly sized - change as you see fit.
BOOL CCustom::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
ModifyStyleEx(0, WS_EX_TOOLWINDOW);
CWnd* pWnd;
RECT rc;
pWnd = GetDlgItem(ID_APPLY_NOW);
pWnd->ShowWindow(SW_HIDE);
pWnd = GetDlgItem(IDOK);
pWnd->GetWindowRect(&rc);
rc.left += 80;
rc.right += 80;
rc.bottom += 7;
ScreenToClient(&rc);
pWnd->MoveWindow(&rc);
pWnd = GetDlgItem(IDCANCEL);
pWnd->GetWindowRect(&rc);
rc.left += 80;
rc.right += 80;
rc.bottom += 7;
ScreenToClient(&rc);
pWnd->MoveWindow(&rc);
return bResult;
}
|
|
|
|
|

|
Use Class Wizzard to add a new class for your dialog and then you can show your dialog like this:
MyDialogClass dialog;
dialog.DoModal();
Sebastian Mircea
|
|
|
|

|
I'm also trying to display a property sheet, except mine's stored in a dll file. Whenever I try to compile or load the property sheet, the compiler gives me a bunch of errors or it just skips over the code that shows the property sheet like it doesn't exist. I've tried all sorts of combinations of the DoModal because it keeps telling me about static functions and stuff so I just change it to make it happy. The closest I've been is getting an assert failure in dlgprop.cpp line 201 as it tries to display the sheet.
Please help, thanks.
- Joe
|
|
|
|

|
If I debug the application, the program crashes in your codefragment.
regards
sport
|
|
|
|

|
Hi,
I've implemented the code to resize the Property sheet but when viewed in Wizard mode the small static control that acts as a division between the property page and the property sheet is slightly out of place. How do I gain access to this window to make some size adjustments to it?
regards,
Cathal.
|
|
|
|

|
The control you're after has a resource ID of 0x3026. If you use GetDlgItem to get it, you can reposition it in an override of, say, OnSize in the property sheet.
Mal.
|
|
|
|
|

|
I tried your article - very good work - but am having trouble integrating the idea with this tool window with 2 property sheets. I have a tool window with a list box only and want to make it resizable vertically only. The frame resizes fine but for some reason I don't seem to getting the correct width for the pages at the start and the window finishes up just a little larger than system button on the corner.
Any ideas?
Happy programming!!
|
|
|
|

|
Thanks, this was of help to me in trying to get 'whats this' help to come up on property sheets.
So, I used:
BOOL CMyPropertySheet::OnInitDialog()
{
ModifyStyleEx(0, WS_EX_CONTEXTHELP);
return CPropertySheet::OnInitDialog();
}
Anyway, my point is that it only seemed to work if the style was modified BEFORE the call to the base class, which makes sense to me. So this probably applies for the code in this article too.
|
|
|
|

|
I might have missed something rather obvious but the property sheet buttons are not moved accordingly. To implement this I've used code along the lines of....
CRect rcButton;
CWnd *pOK, *pCancel, *pApplyNow;
pOK = GetDlgItem(IDOK);
pCancel = GetDlgItem(IDCANCEL);
pApplyNow = GetDlgItem(ID_APPLY_NOW);
pOK->GetWindowRect(rcButton);
ScreenToClient(rcButton);
rcButton.OffsetRect(-dcx, -dcy);
pOK->MoveWindow(rcButton);
pCancel->GetWindowRect(rcButton);
ScreenToClient(rcButton);
rcButton.OffsetRect(-dcx, -dcy);
pCancel->MoveWindow(rcButton);
pApplyNow->GetWindowRect(rcButton);
ScreenToClient(rcButton);
rcButton.OffsetRect(-dcx, -dcy);
pApplyNow->MoveWindow(rcButton)
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
How to use extended styles and make Property Sheets of any size.
| Type | Article |
| Licence | |
| First Posted | 23 Feb 2000 |
| Views | 156,615 |
| Bookmarked | 68 times |
|
|