|
i have to create dyanmic tab ie i have to increase the tab programmatically based on a falg. if flag = 3 then i have to create three tabs. how to do this. pls help me
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Use CTabCtrl::InsertItem() function?
nave
|
|
|
|
|
ok how to prepare a dialog (separate page) for each dialog
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
You can use a property sheet for this
Follow the below path to add a property sheet
in the project menu->Add to project->Components and controls->Visual C++ Components->property sheet
nave
|
|
|
|
|
how to add property sheet dynamically
|
|
|
|
|
you can call AddPage() function of the CPropertySheet to add a tab
nave
|
|
|
|
|
This problem cropped up after I converted the dialog from modal to non-modal, so that might have something to do with it. The question: why should I have to call GetDlgItem to get a pointer to a dialog box control in every function instead of just once in OnInitDialog?
I've got these pointers in my modeless dialog box header file:
CListBox* ExpressionsListBoxPtr;
CListBox* FiltersListBoxPtr;
CListBox* TargetsListBoxPtr;
All were initialized to null by the constructor. In OnInitDialog() I put this (I checked to make shure OnInitDialog got called, and that the pointers were not null afterwords):
ExpressionsListBoxPtr = (CListBox*)(GetDlgItem(IDC_DLGS_EXPRESSIONLISTBOX));
FiltersListBoxPtr = (CListBox*)(GetDlgItem(IDC_DLGS_FILTERLISTBOX));
TargetsListBoxPtr = (CListBox*)(GetDlgItem(IDC_DLGS_TARGETLISTBOX));
The issue is that when I execute this fuction I get a debug assertation error and I've determined that the class level pointers are the source of the problem. I have worked around it by calling GetDlgItem in the function itself instead of just in OnInitDialog:
afx_msg void CRatiosNewSearchDialog::OnAddFilter()
{
CListBox* TempListBoxPtr = (CListBox*)(GetDlgItem(IDC_DLGS_EXPRESSIONLISTBOX));
int CurrentSelection = TempListBoxPtr->GetCurSel();
int Pos = 0;
CString Expression = "";
if(CurrentSelection == LB_ERR)
MessageBox("You must select an expression before you can add a filter. LB_ERR.", "User Error", MB_ICONHAND);
else
{
ExpressionsListBoxPtr->GetText(CurrentSelection, Expression);
Pos = Expression.Find(" - ", 0);
Expression.Delete(0, Pos + 3);
Pos = FiltersListBoxPtr->AddString(Expression);
ResetListboxScrollbar(FiltersListBoxPtr);
FiltersListBoxPtr->SetCurSel(Pos);
}
}
Can anyone tell me why it is not letting me just call GetDlgItem once when the dialog pops up instead of making me call it every time I want to use a control?
|
|
|
|
|
from MSDN
CWnd::GetDlgItem
Return Value
A pointer to the given control or child window. If no control with the integer ID given by the nID parameter exists, the value is NULL.
The returned pointer may be temporary and should not be stored for later use.
Why don't you simply associate control variables with your controls - i.e. associate a CListBox with IDC_DLGS_EXPRESSIONLISTBOX etc.
see: http://www.flounder.com/getdlgitem.htm[^]
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Thanks for the help. I got it working now...I just have to get rid of all of those GetDlgItem calls now. Guess I'll be using find and replace a lot too. ![Dead | X|](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_dead.gif)
|
|
|
|
|
I should have explained the cause of the problem: Creating a listbox in the dialog creates a windows listbox (identified by a handle) but not any CWnd object. MFC overloads the GetDlgItem() to return a CWnd* so that you can use all the MFC CWnd:: functions, but as there is no CWnd object, it creates a temporary one which is cleaned up later in some idle processing time. I guess that your experience shows that this cleanup doesn't usually happen during DoModal(), but does if the dialog is run modeless.
What you could get and save is the HWND of each of your controls, this would stay valid for the lifetime of the dialog window. This is what you are essentially doing when you add a CListBox data member to your class and associate it with the particular windows control in the DoDataExchange() function. The HWND of the control is set in the DDX_Control() function from the ID you provide.
Adding these data members is automated (in VC6 use the class wizard, in VS2005 simply right click on the control in the dialog editor and select "Add Variable"). Then you have a CListBox that you can use in any member function once the dialog has been created.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
|
You can write Windows Services with the Standard Edition. However, there is no wizard available for native C++ or C++/CLI. The comments about not being able to write Window Services is directed toward C++/CLI in the standard version of VS.NET since there is a Windows Service wizard in the Professional version.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Ah, thanks for clarifying. So it won't help you create one from scratch, but if you have the code you can build it. Cool.
Thanks again,
DB
|
|
|
|
|
int j;
j=4; //100
printf("\n\nj value:%d",(~j));//100-->(NOT)-->011-->So shouldn't this be 2??
It prints -5??? Why?
----------------------------
286? WOWW!
|
|
|
|
|
(4) is hex 0x00000004
~(4) is hex 0xfffffffb which is a signed integer which is (-5)
Jeron
|
|
|
|
|
_8086 wrote: 011-->So shouldn't this be 2
Actually that's 3
The ~ operator effects ALL the bits of the integer
int j;
j=4;
j=~j;
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Mark Salsbery wrote: Actually that's 3
Thanks
----------------------------
286? WOWW!
|
|
|
|
|
|
Hi
I want to compile source code of a program written under linux.
I want to compile the source under windows xp.
Is there any tool to do the port.? please suggest me any...
regards
The Best Religion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Hi
How about cygwin?
anyone familiar with it?
Regards
The Best Religion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Zainu wrote: How about cygwin?
it's been a while since i've used it, but i think that if you want to run the program on XP, cygwin is the way to go. but, if you want to compile the program on XP to run on a Linux machine, the process is very complicated - IIRC, you have to rebuild all the tools (gc, the linker, the libraries, maybe even the kernel) first.
a few years ago, i needed to build an EXE that could run on a specific Linux distribution, and i went down they cygwin path for a few days, trying to get it to work; but it quickly became far too much hassle. i ended up spending a couple hundred $ to buy a cheap PC, installed the Linux distribution on it and built the EXE there. then i moved the EXE to the target computer, and got on with my life.
|
|
|
|
|
What kind of program is it ? Was it planned to be cross-platform ? If no, then as far as I know you can't do that. But it all depends of the program itself. If it is a simple console application that doesn't use any linux API, then it is cross-platfrom. If it is a program that display a GUI for instance using the Linux API, then it won't work.
|
|
|
|
|
Zainu wrote: Is there any tool to do the port.?
Yes[^]
led mike
|
|
|
|
|
AHHH I just HAD to click on the link. When it popped up I spewed root beer on my
monitor.
Thanks man.
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
cygwin is great.
I was using to compile a 3d game. For the past two days i was sitting on this.
The only problem is initial setting up of the libraries and headers and then too download the cygwin packages you require.
Regards
The Best Religion is Science.
Once you understand it, you will know God.
|
|
|
|