|
You have helped me a lot since I met problems. Thank you very much.
|
|
|
|
|
You're welcome.
|
|
|
|
|
I need a combobox in a project that lists date field of a table of my database. If user selects a date, then she wants to edit other fields. It is possible to have similar dates, so I decided to put both date and PK of the record in to Combobox, but I want the PK to be hidden (It makes the combo dirty).
Is there any alternative way, any better approach?
If not, is it possible to add a hidden text to combo box? (I can't use space, because I set the Combo to RightAligned text)
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
Each item can be associated with a data via CComboBox::SetItemData function. Later you can retrieve the stored 'hidden' data via CComboBox::GetItemData.
Also there is SetItemDataPtr/GetItemDataPtr for storing pointers to objects.
--
=====
Arman
|
|
|
|
|
Thank you so much.
I'll just check that out.
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
hai,
I am storing my data in a file.i.e for eg i am saving some names to the file & i am using some delimiters (eg.&&^^)between names.i want to read data till the delimiter & store it in a variable & then read the next name and so on. iam using fstream. any one please help me
|
|
|
|
|
Hi,
why those delimiters? Is not ok for you the simple "empty space"?
If they are necessary... I think it will be better if you read each letter and check, check the character if it is one of you delimiters... If it is not one of them, save the char in a buffer with the others, if it is... save the content of the buffer in the variable you want to hold the already saved chars.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Nelek wrote: why those delimiters? Is not ok for you the simple "empty space"?
Then how would you differentiate between a space within a name vs. a space separating a name?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Well... You are right :P
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Hi all:
Evening to all.
I create an instance of ifstream:
ifstream in(argv[1], ios_base::binary); //argv[1] is the name of a text file.
and try to read something from it.
in.open(argv[1]);
string line;
while(!in.eof()) {
cout << "I am here" <
|
|
|
|
|
Hi,
In other message from you, someone asked you something about the large of the file name.
Im not as fit as I should to answer your question, but the infinite number of "I am here" is logical. If he tries and tries to get a line without exit... you will have the "I am here" as well. This is because you are having a problem by accessing your file and read it. You can try to put a break in the while, or make the loop in other form. Can you check if the file has been sucessfully opened? And its length? Then go in the while with the condition "file opened" and "end not reached".
Re-read the answers to your other message, maybe you have forgotten something.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
C_Zealot wrote: ifstream in(argv[1], ios_base::binary); //argv[1] is the name of a text file.
Should you be opening the file in binary mode, but treating it as line-delimited later on?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I think you try to open the file twice.
first when you construct the stream and then
again in the next line. Maybe this triggers an error and corrupts your
stream. Then nothing would be read and you would never reach EOF.
|
|
|
|
|
I've only just started to have a go with VS2005, and noticed something odd when I tried a function call, after typing the "." character, the function that popped up in the list was suffixed with a "W", I assumed this was to do with "wide" characters, i.e a UNICODE thing, and that maybe I'd turned that on during the dialog wizard. When I opened an old VC6 project (which was then converted), though, the functions then popped up with an "A" after them e.g. LoadMenuA or whatever. What is this for. I think it did then allow me to just delete the A and call what I thought was the "normal" function name, though that wasn't available as an option when the IDE popped up the list of functions etc following typing the "." after the class name
|
|
|
|
|
For all most all functions that accepts a string there are two veresion of funtion. For example say SetWidowText().
Actually there is no SetWidowText() function, but only SetWidowTextA() and SetWidowTextW() functions. And the SetWidowText() is a #define as follows
#ifdef _UNICODE<br />
#define SetWidowText() SetWidowTextW()<br />
#else<br />
#define SetWidowText() SetWidowTextA()<br />
#endif
nave
|
|
|
|
|
If we take for example LoadMenu: for this function, LoadMenu is in fact a macro that resolves to LoadMenuW if unicode is defined or to LoadMenuA if unicode is not defined. So you can simply ignore the A or the W. It doesn't pop-up in the list because LoadMenu is a macro, and not a function.
(Take a look at this macro and you'll probably understand).
|
|
|
|
|
Thank you Cedric
|
|
|
|
|
ldsdbomber wrote: I've only just started to have a go with VS2005...function that popped up in the list was suffixed with a "W", I assumed this was to do with "wide" characters, i.e a UNICODE thing, and that maybe I'd turned that on during the dialog wizard.
Unlike VS6, Unicode is the default with VS2005.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have an MFC dialog in VC++ 6, and the following two lines in my dialogs oninitdialog function seem to correctly display the menu I made in the resource editor.
CMenu theMenu;
theMenu.LoadMenu(IDR_MENU1);
When I switch to Visual Studio 2005, it doesn't seem to work without a call to SetMenu(&theMenu); as another line of code
What is the reason for this, or am I missing some difference elsewhere....
|
|
|
|
|
ldsdbomber wrote: CMenu theMenu;
theMenu.LoadMenu(IDR_MENU1);
In vc6 also you will not get the menu unless you call the SetMenu(). May be there is a chance that u have set the menu for the dialog in the resource it self.
nave
|
|
|
|
|
it shouldn't work correctly in VC6 (as Naveen said) unless you did it inside the resource editor.
open your dialog with the dialog editor, and see if the property "menu" is not fulfilled ?!
|
|
|
|
|
sorry guys, I don't understand - I only know how to make menus (at the moment) by adding it in the resource editor as IDR_MENU1 and manually adding sections to it. I have tried "system menu" on and off in the dialog properties, in both cases, the menu I made with File/View/Help across the top and several sub items appears correctly WITHOUT a call to SetMenu.
I made the menu in exactly the same way in VS2005 (actually I may have even converted the project as well, and it would not display unless I added the SetMenu line.
BOOL CTestFolderBrowseDlg::OnInitDialog()
{
CDialog::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
// TODO: Add extra initialization here
/*
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
*/
CMenu theMenu;
theMenu.LoadMenu(IDR_MENU1);
CRect rect;
m_Table.GetClientRect(&rect);
int nColInterval = rect.Width()/6;
m_Table.InsertColumn(0, _T("E(nominal)"), LVCFMT_LEFT, nColInterval);
m_Table.InsertColumn(1, _T("E(measured)"), LVCFMT_LEFT, nColInterval);
m_Table.InsertColumn(2, _T("Geske Dose"), LVCFMT_LEFT, nColInterval);
m_Table.InsertColumn(3, _T("E(actual)"), LVCFMT_LEFT, nColInterval);
m_Table.InsertColumn(4, _T("Tolerance"), LVCFMT_LEFT, nColInterval);
m_Table.InsertColumn(5, _T("Result"), LVCFMT_LEFT, rect.Width()-5*nColInterval);
m_wndStaticFilePath.SubclassDlgItem (IDC_STATIC2, this);
m_wndStaticFilePath.SetPath (TRUE);
m_CalFactor.SetWindowText("1");
//EnableToolTips(TRUE);
return TRUE; // return TRUE unless you set the focus to a control
}
|
|
|
|
|
Please check the following thing in the vc6.
right click on your dialog->Take properties->And in the "General tab" there will be combobox with name Menu. Tell me is there any thing selected in that combobox.
nave
|
|
|
|
|
ah yes - there it is. Many thanks Naveen!
|
|
|
|
|
Does anyone have a solution for trapping the proper messages which will allow you to enable your menu item in some hooked programs which always disable the menu items?
I guess I'm looking for something equivalent to ON_COMMAND_UPDATE_UI but as a message caught using a hook dll. My attached menu items can be enabled by trapping some messages from the other program but when it paints the window my menu is disabled again.
Any help would be appreciated.
Jeremy Pemberton-Pigott
A programmer with a dream can accomplish anything. So, start by implementing your castle in the clouds and then working on its interface to a foundation
Quote by: Jeremy Pemberton-Pigott
New Dawn Engineering
|
|
|
|