|
thanks for your reply.
But I am really now snatching my hair...Not able to solve this since today morning..please help
I have a tab control in a dialog box. Now I need to have all other dialog ie property pages onto the tabcontrol. I dont want to create another property sheet then attache all pages.
Till now what I have is, the main dialog, which will create a property sheet on oninitdialog
CPropertySheet PropertySheet ("Format");
Style StylePage;
style2 StylePage2;
PropertySheet.AddPage (&StylePage);
PropertySheet.AddPage (&StylePage2);
if (PropertySheet.DoModal () == IDOK)
{
}
It appears as a different dialog.... when i close this property sheet the old/main dialog appears...I want a tabcontrol instead of proerty sheet. so that all pages appears in the main dialog itself
-----------------------------
I am a beginner
|
|
|
|
|
hrishiS wrote: Till now what I have is, the main dialog, which will create a property sheet...
No, the property sheet IS the dialog. All you need to do is change "CDialog " to "CPropertySheet " in the .h and .cpp files. Create a dialog template for each of the tabs you need (two in your case). Create a class for each of those dialog templates. Add a member variable, one for each class, to the sheet's class. Call AddPage() in the sheet's constructor. All of this is spelled out in the link I provided.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I will do the exact same.
But could you please tell me, instead of creating a property sheet. can I do it using the tabcontrol which is there in the control box?
-----------------------------
I am a beginner
|
|
|
|
|
hrishiS wrote: But could you please tell me, instead of creating a property sheet. can I do it using the tabcontrol which is there in the control box?
Presumably. I tried a few times long ago, could not get it to go, and never bothered trying again.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
In MFC, PropertySheet and PropertyPage are intertwined classes, PropertyPages can only be placed on PropertySheets and there is some expectation on the operation of the parent class. Trying to mimic this behavior with your own Dialog / TabControl and Dialogs means trying to replicate many of the functions and interactions provided by the PropertySheet / PropertyPage classes.
What you seem to want to do can be easily done with managed C# and WPF so, unless you are totally committed to C++, I'd say switch languages.
|
|
|
|
|
Chuck O'Toole wrote: In MFC, PropertySheet and PropertyPage are intertwined classes, PropertyPages can only be placed on PropertySheets and there is some expectation on the operation of the parent class.
It's fairly obvious that the two go together. I don't recall stating otherwise.
Chuck O'Toole wrote: Trying to mimic this behavior with your own Dialog / TabControl and Dialogs means trying to replicate many of the functions and interactions provided by the PropertySheet / PropertyPage classes.
Where did I mention trying to mimic/duplicate those classes?
Chuck O'Toole wrote: What you seem to want to do can be easily done with managed C# and WPF so, unless you are totally committed to C++, I'd say switch languages.
Not sure too many PMs would up and go with that suggestion.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
My reply was to the original poster, I replied as I was reading the chain.
Given the original posters problem and their difficulty with the task at hand, and their apparent "requirement" for dialogs in a tab control, I suggested a different language.
I have implemented tabs with dialogs (with tabs with dialogs, ...) and it is not easy and I'm no slouch at programming. It's also something I can't just give out as classes (they are owned by my employer and are "intellectual property" so I'm not free to give them away).
However, in other projects using C#, this was almost trivial to implement. So, some PM's have a choice between investing lots of time trying to implement something difficult (where the skill of the programmer is also a factor), changing the design to not do this (tabs with dialogs), or change languages with a higher probility of success. Their choice, all I did was make the suggestion.
As for that being posted as a reply deeper in the chain, sorry about that.
|
|
|
|
|
Originally posted as a reply to a reply when I meant it as a reply to the original poster. Hope this one's in the right place.
In MFC, PropertySheet and PropertyPage are intertwined classes, PropertyPages can only be placed on PropertySheets and there is some expectation on the operation of the parent class. Trying to mimic this behavior with your own Dialog / TabControl and Dialogs means trying to replicate many of the functions and interactions provided by the PropertySheet / PropertyPage classes.
What you seem to want to do can be easily done with managed C# and WPF so, unless you are totally committed to C++, I'd say switch languages.
|
|
|
|
|
Hello Guys,
I am new to MFC developement.
My problem is,
I am having a full screen dialog. Its hiding task bar perfectly. But when i display the custom messagebox on it ( which is again another dialog) over the full screen dialog, it causes the task bar being visible. I tried to add SHSipPreference(m_hWnd, SIP_FORCEDOWN) in constructor of custom messagebox dialog but its of no use.
I want the below dialog full screen even in case of custom message box over it.
Waiting for your quick reply.
Thanks and Regards,
Rushikesh123
|
|
|
|
|
In my application i have written code for creating process for showing new exe now when i terminated my application my application gets terminated but my pdf remains open it is not terminated anyone tell me how to terminate that process
|
|
|
|
|
|
TerminateProcess may be only the last resource.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Send WM_CLOSE to the application top window, see [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I used the following SheetChange event function, to retrieve the data entered in excel cells.
BEGIN_SINK_MAP(ExcelAppEventHandler)
SINK_ENTRY_INFO(1, __uuidof(Excel::AppEvents), 0x0000061c, &ExcelAppEventHandler::SheetChange, &SheetChangeInfo)
END_SINK_MAP()
where as its not retrieving the automatic changes.
for example, C1 cell contains the function =SUM(A1,B1), A1 = 10, B1=20 then C1=30
if I changed value in A1 to 15, at a time there will changes in two cell, i.e, A1(15) and C1(35).
I'm able to get the A1 value but not C1. How can I trace C1 value (automatic changes).
Please guide me to solve this.
Thanks in advance.
|
|
|
|
|
Hi,
Question: how to pass data between two dialogs (which are in Tab Control)...
For example if we have ListBox1 in Dialog1 and we want to add string to ListBox1 from Dialog2 how to do that?
I try to include Dialog1 header file in Dialog2 and add object ( Dialog1 object_Dialog1;) in to Dialog2,
and then in handler for some button in Dialog2, I wrote:
object_Dialog1.m_ListBox1.AddString(_T("s")); //m_ListBox1 is control variable for ListBox1 in Dialog1
but that cause ASSERT in afxwin2.inl :
_AFXWIN_INLINE int CListBox::AddString(LPCTSTR lpszItem)
{ ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem); }
Does anybody knows how to pass data between two dialogs in Tab Control?
Best Regards
|
|
|
|
|
Hello,
What i usually do in that cases is to use a kind of data model at parent dialog box level.
Each tab works only with the data model.
You monitor Activation unactivation of each tab and update itself based of changes in the common data model.
hope this will help.
Regards
Franck
|
|
|
|
|
Does it means that we can't pass data between dialogs in tab control in a simple way like I try to do it?
Do you know simple way that works ?
And do you know why that ASSERT IsWindow... is triggered?
Regards
|
|
|
|
|
I've never found a reason to fight with a tab control (i.e., CTabCtrl ). Use a property sheet in place of the dialog, and a property page for each tab and you'll be on your way in a matter of minutes. You can use the parent to pass data back and forth between tabs very easily.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Does it means that we can't pass data between dialogs in tab control in a simple way like I try to do it?
Does anybody else knows simple way that works ?
Regards
|
|
|
|
|
The real problem seems to be how you got a dialog 1 object in the dialog 2 class. Your comments seem to say to declared a variable and your reference (with .) seems to say that you instantiated a dialog 1 class inside dialog 2. So, how do you know this instantiation actually points to the dialog 1 that is being displayed.
declaring the variable does *not create the dialog window*. Clearly, to have dialog 1 displayed, somebody has to instantiate it and create it. It was probably your main program (the same one that instantiated dialog 2).
The error is saying that "the object you are referencing (dialog 1) is not a valid window" and that would be true if you never created.
Now what you want to do it obtain the *pointer to dialog 1* created by your parent / main program and store it in a local pointer in dialog 2. Then you can access it with "object_dialog1->m_list......."
Chuck
|
|
|
|
|
Hi Chuck,
I got a class MyTabControl(:public CTabCtrl), in which I create dialog1 and dialog2 in constructor of that class, and in main dialog(called MainDialog) I instantiated those two with object(In main dialog .h I have a object MyTabControl objectMyTC;)
So I try to do this (...on click some button in Dialog1 I wanna to access m_ListBox2 in Dialog2 from Dialog1 in TabControl):
In Dialog1.h I declare:
MainDialog* p_MainDialog;
and in Dialog1.cpp I wrote:
Cwnd* pWnd = (CWnd*) p_MainDialog->objectMyTC.m_Dialog2->GetDlgItem(m_ListBox2);
but when I click button, that also didn't work, I get an exception (..acess violation reading location 0xcdcdeb1).
When I try to debug this line i saw that all objects in MainDialog have hWnd=??? so I guess this has something with it.
Can You please help me what I am doing wrong?
Best Regards and thanks
|
|
|
|
|
0xcdcd...is indicitive of an unitialized variable. You declared p_MainDialog but did you put anything into it?
|
|
|
|
|
Hi Chuck,
I just declare it like I wrote .. I guess I need pointer to parent(main) dialog window....
How You mean "...did you put anything into it? " ...I dont understand?
Can You help me to solve this problem?
Simple sample code (variation of what I wrote)....
Regards
|
|
|
|
|
Where is the statement like:
p_MainDialog = ??????;
as far as I can see, you only declare p_MainDialog but do not initialize it. Since the error indicates an uninitialized variable, I bet they're related.
|
|
|
|