|
Do you pass around the structure so that different copies exist? (like vg as a parameter to some function)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I only ever passed a pointer to it to other functions.
|
|
|
|
|
Then chances are this is an out-of-bounds error. Try for instance doubling the space allocated to see if this masks the error.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Im Lost
How can just passing a pointer to other functions cause an out of bound error
Peter
|
|
|
|
|
Peter Liddle wrote:
How can just passing a pointer to other functions cause an out of bound error
By having that function do something stupid with the pointer!
What Kind of error are you getting when you call delete[] ? And are you sure that all of the memory being freed with delete[] was alocated with new[] ?
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
Hi.
I will design and implement a property sheet for a small program I am working on. I have access to Jeff Prosise's example from his book. However, he does not explain the process of linking the property sheet and property pages to their cooresponding dialog boxes.
For example, let say I would like a property sheet with two property pages. I am not sure how to go about linking them to the dialog boxs.
The following questions apply to the sample dialog box I mentioned above (property sheet w/ 2 property pages).
1) How many dialog boxes do I have to create using Dialog Editor? Two or three? Is the property sheet alone considered a dialog box and I have to *create an empty dialog box to serve as the property sheet*?
2) For each dialog box, how do I create them such that they are the same sizes? Do I just eyeball their sizes or their sizes will be based on the size of the property sheet (given you have to create a dialog box for the property sheet).
3) Is it possible to use ClassWizard to implement the classes for the property sheet and property pages?
Thanks,
Kuphryn
|
|
|
|
|
kuphryn wrote:
How many dialog boxes do I have to create using Dialog Editor?
2
kuphryn wrote:
For each dialog box, how do I create them such that they are the same sizes?
doesn't matter. the sheet will size itself to fit
kuphryn wrote:
Is it possible to use ClassWizard
yes. completely.
open the resource editor, right click on the dialog folder, choose "Insert...". this brings up the "Insert resource" dialog. open the "dialog" node, and choose one of the property page sizes (just pick one, you can size them later if you want). add your controls, etc. open the class wizard, add a new class with base class CPropertyPage. do this for each page.
then,to show the property sheet, do something like this:
CPropertySheet mySheet;
CMyFirstPropPage page1;
CMySecondPropPage page2;
mySheet.AddPage(page1);
mySheet.AddPage(page2);
mySheet.DoModal();
you don't really have to do anything with the sheet, just add pages and call DoModal.
-c
There ain't no second chance
Against the thing with the forty eyes
|
|
|
|
|
1) As many dialog boxes as property pages. The property sheet gets created automatically.
2) If they're not the same size, the property sheet will adjust to the greatest dimensions. Usually, the final look is OK. If you're anal (sorry) about margins being perfectly asjusted, try to match all dimensions by hand, or do multiple copies of one of the pages and work on the copies to construct the remaining pages.
3) When adding a class to the dialog box resource, select CPropertyPage as the base class.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Nice! MFC makes creating the property pages similar.
I assume I will create a new class derived from CPropertySheet and instantiates the property pages. Correct?
Kuphryn
|
|
|
|
|
no. just instantiate a CPropertySheet object and add your pages to it (just like my little sample code does). unless you need to change the default sheet behavior you don't need to create a new class for it.
-c
There ain't no second chance
Against the thing with the forty eyes
|
|
|
|
|
Okay.
In his book, Jeff Prosise implements an Apply button. I am not sure if he creates it via deriving a class from CPropertySheet or CPropertySheet comes default with it.
Kuphryn
|
|
|
|
|
Chris Richardson, a member at CodeGuru mentioned that the default CPropertySheet that MFC generates does come with an Apply push-button.
http://63.236.73.79/cgi-bin/bbs/wt/showpost.pl?Board=vc&Number=371721&page=0&view=collapsed&mode=threaded&sb=5
Kuphryn
|
|
|
|
|
I got the property sheet to work with two property pages. I used the default method (same as yours) to create the property sheet. Now I am trying to figure out how to update the data in doc after the user clicks Apply in the property sheet. Jeff Prosise derived a completely separate property sheet, thus I can seen what is going on with is code. However, with MFC default CPropertySheet, I am not sure how to copy data from the property pages to data in doc. In the code Prosise creates, the property sheet sends a message to main, which redirects the message to view where the data are copied. Prosise uses the ELLPROP data structure.
Do I have to create something similar to what Prosise shows or is there a default way to copy data after the user pushes Apply?
Kuphryn
|
|
|
|
|
|
There is a checkbox, right above the "Submit" button, that says "Notify me by e-mail if someone answers this message." It is on by default but you can turn it off.
I am not sure if there is a way to change the default - so that it shows up off by default for your user account. If so I haven't found it.
No generalization is 100% true.
Not even this one.
|
|
|
|
|
Hello
I've one problem with CListBox messages
So I've class CContactCtrl : CListBox
This Control is Ownerdraw Variable and she nicely operate WM_DRAWITEM and
WM_ERASEBKGND
messages, but only when the control has some elements.
When I remove all elements from control then I have white background
When I override WM_PAINT message then background is painting very well, even
if
control doesn't have elements, but WM_DRAWITEM doesn't occur
What can I do to fix this problem?
Maybe I should send WM_DRAWITEM message from WM_PAINT function?
Sys: XP & VC++.NET
sorry for my bad english...
NodeX
|
|
|
|
|
In this piece of code I expect a CRichEditCtrl to clear itself. It works fine in Win98, in XP nothing happens.
UpdateData(TRUE);
m_profileCtrl.UpdateData(TRUE);
m_profile.Empty();
m_profile.Delete(0,m_profile.GetLength());
m_profile = _T("");
m_profileCtrl.UpdateData(FALSE);
UpdateData(FALSE);
Of course this piece of code is a bit overkill, yet it should work.
Am I making some sort of stupid mistake, or can I safely blame XP?
Also, is there another way to clear a text box properly?
Cheers!
|
|
|
|
|
Try adding an UpdateWindow call at the end (though I thought it should work without it.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I found it!
You'll NEVER believe it, but the ONLY way to make it work was by setting the text to a space _T(" ");
Unbelievable!
Thanks for your quick answer though!
|
|
|
|
|
Hmmm... this does seem like a bug to me. Maybe someone else here can enlighten us.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
It was very odd, and frustrating, as I don't have XP myself. So I kept sending patches, but they didn't work
- Griffith
|
|
|
|
|
Just a hunch; try it without misusing the CString object:
<br />
CRichEditCtrl::SetWindowText( _T( "" ) );<br />
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
That was about the first thing that came to mind with me, and much to my surprise that didn't work.
Especially because the CRichEditCtrl::Clear(); fuction refused to work too.
|
|
|
|
|
Then that sounds like either (1) a serious bug in the RE Control, or (2) a redraw problem.
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
I have am having a problem with my status bars. I have 2 and the first one has 2 panes (don't know if that makes a difference). The problem occurs when I resize when my main window is not maximized and I use the grippers to resize the status bars...When I do this, the status bar does not refresh properly...It keeps drawing the new size on top of the old one. I don't know what I am doing wrong.
Here is some of my code:
static UINT indicators1[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
static UINT indicators2[] =
{
ID_SEPARATOR, // first message line pane left
ID_SEPARATOR, // first message line pane right
};
CMainFrame::OnCreate
--------------------
// Create Status Bar1
if (!m_wndStatusBar1.Create(this) ||!m_wndStatusBar1.SetIndicators(indicators1,sizeof(indicators1)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1;
}
// Create Status Bar2
if (!m_wndStatusBar2.Create(this, WS_CHILD|WS_VISIBLE|CBRS_BOTTOM, ID_RESULT_STATUS_BAR) ||
!m_wndStatusBar2.SetIndicators(indicators2,sizeof(indicators2)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// Set up Status bar styles
m_wndStatusBar1.SetPaneInfo(0,0,SBPS_STRETCH|SBPS_NORMAL,0);
m_wndStatusBar2.SetPaneStyle(1,SBPS_NOBORDERS);
CMainFrame::OnSize
------------------
// Resize the Status Bars
if (m_wndStatusBar2)
{
CRect rect;
m_wndStatusBar2.GetWindowRect(&rect);
m_wndStatusBar2.SetPaneStyle(1,SBPS_NOBORDERS);
m_wndStatusBar2.SetPaneInfo(1, 0,SBPS_NOBORDERS, rect.Width()/2);
}
ANY HELP WOULD BE MUCH APPRECIATED!
Thanks in advance!
Mandy
[akashorty.net]
|
|
|
|