|
Excuse me, but is your code somehow better than the following?
struct Node { Node * children[8]; } *pRoot = 0;
void _Add( Node *pNode, Datum* pDatum )
{
if ( 0 == pNode )
{
pNode = new Node;
memset( pNode->children, 8*sizeof(Node*) );
return;
}
if (...) { _Add(pNode->children[0], pDatum); return; }
}
Hosam Aly Mahmoud
|
|
|
|
|
I'm trying to open my About dialog from a menu item, but it does not seem to work. I've tried putting the about dialog id in the menu about id field, that didn't work. I've tried making an event handler but that doesn't even go to the fuction that was created (I put in a messagebox to pop up when it called that function).So how do I do this?
Thanks for any help
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
First, you need to create a new dialog box:
HWND dlg = CreateDialog (application_instance, MKINTRESOURCE (IDD_DIALOG_NAME),
parent_window, DefDlgProc);
Now show the window:
ShowWindow (dlg, SW_SHOW);
If it does not show properly, then update the window, and force it into focus:
UpdateWindow (dlg);
SetForegroundWindow (dlg);
When the use clicks your okay button, if you have set the resource ID for the Okay button to IDOK, the dialog will close are DefDlgproc (defined by Microsoft) will close the window.
Managing Director of Oiginal Sin Software
www.originalsinsoftware.com
|
|
|
|
|
I guess I'm not making myself very clear. I have a dialog app that has a menu. In the menu is a menu item called "Help" with a sub-item "About" I want to have my menu sub-item "About" to open the about box that was created when I first created my dialog app. The same about box that comes up when I right click on the title bar and choose "About".
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Ah, MFC, yes?
If so, MFC will have created something like CAboutDlg. In which case you can just do:
CAboutDlg *dlg=new CAboutDlg;
dlg->DoModal();
delete dlg;
Managing Director of Oiginal Sin Software
www.originalsinsoftware.com
|
|
|
|
|
okay but how do I call this from my menu sub-item "About"? I've tried creating an event handler but it never drops in to the fuction I created when I choose "About".
MFC....yes
And thanks again for all the help
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Okay, when you edit the menu in the resource editor, use the class viewer (CTRL+W) to add a message handler and add the code there.
Managing Director of Oiginal Sin Software
www.originalsinsoftware.com
|
|
|
|
|
Thanks....I think my problem is that I rush. I kept making the event handler but choosing the wrong class. I kept choosing the CAboutDialog class instead of my main app dialog class. After I choose the correct class it worked fine. Thanks for all the help.
Tom
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
You'll need an entry in the (App's) message map:
BEGIN_MESSAGE_MAP(CMyApp, CWinApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
END_MESSAGE_MAP() Then the handler function:
void CMyApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I need a ComboBox smaller than the standard minimum size that VC7 offers. Is this possible with CComboBox?
Monica
|
|
|
|
|
Can you not edit the .RC file manually, bypassing the resource editor?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Yes, but if I change the size there the list of the combo is resized. I need a combo with the edit control very small (hight very small).
|
|
|
|
|
You could try making it variable-height owner-draw, and implementing the measure item stuff, although of course you might also need to change the font it's using.
Steve S
|
|
|
|
|
Hi,
in case this is still relevant:
i encountered the same problem and wish to trade my solution in return to your advice;).
to control the edit box height, i simply changed the combobox font size. e.g. (12==font height in points):
<code>CFont font;
LOGFONT lf;
font.CreateFont(12, 0, 0, 0, FW_NORMAL, FALSE,
FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS, "Arial");
font.GetLogFont(&lf);
m_newFont.CreateFontIndirect(&lf);
m_ccombobox.Create(WS_CHILD | WS_VSCROLL |CBS_DROPDOWN
, rect, this, 0);
m_ccombobox.SetFont(&m_newFont); </code>
and now for my question: how do you get the size the rectangle wrapping the edit box + the arrow box?
thank you.
<small><b>mstanciu2000 wrote:</b></small>
<i>I need a combo with the edit control very small (hight very small). </i>
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Email: y_becker@netvision.net.il
|
|
|
|
|
Thankyou for the solution but I already found something else to do. Unfortunately, both my solution and yours have the following problem: If the size is smaller than 12 the text in the combo is no longer entierly visible.
As for your question...I am not sure that I understand well but a quick solution would be GetClientRect(&rect).
|
|
|
|
|
Shalom,
sorry for insisting, but the text size is fully visible (i tried 10pt, 8 pt. hell even 6pt.), though at some point a microscope should be attached to the application. you may have some fixed list box style still present at your app.
as for your suggestion: though it is this which is self-evident that is frequently ignored, that is not the case this time. the problem is that i keep on getting the same combo client size, no matter what the actual visible client size is.
Thank you for your quick reply.
Anonymous wrote:
If the size is smaller than 12 the text in the combo is no longer entierly visible.
As for your question...I am not sure that I understand well but a quick solution would be GetClientRect(&rect).
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Email: y_becker@netvision.net.il
|
|
|
|
|
i used the following and got stuck after the recset.GetFieldValue("Address ID",sID);
recset.GetFieldValue("Last Name",sLastname);
coz nt sure how to make my edit box display the data of Address ID and Last name.
the code goes:
void CAccessdbDlg::OnButton2()
{
CDatabase database;
CString SqlString;
CString sID, sLastname;
CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)";
CString sDsn;
CString sFile = "e:\\fyp_2003\\database_sample.mdb";
// Build ODBC connection string
sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s",sDriver,sFile);
TRY
{
// Open the database
database.Open(NULL,false,false,sDsn);
// Allocate the recordset
CRecordset recset( &database );
// Build the SQL statement
SqlString = "SELECT Address ID, Last Name "
"FROM Categories";
// Execute the query
recset.Open(CRecordset::forwardOnly,SqlString,CRecordset::readOnly);
// Copy each column into a variable
recset.GetFieldValue("Address ID",sID);
recset.GetFieldValue("Last Name",sLastname);
????????????
database.Close();
}
CATCH(CDBException, e)
{
// If a database exception occured, show error msg
AfxMessageBox("Database error: "+e->m_strError);
}
END_CATCH;
}
and is this code correct?
|
|
|
|
|
coda_x wrote:
recset.GetFieldValue("Last Name",sLastname);
Now you simply need to call the SetWindowText(sLastname) method of one of the edit control variables.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
like this:m_str_lastname.SetWindowText(sLastname);?
|
|
|
|
|
Yes, assuming m_str_lastname is a CEdit variable.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
oso when i try to run the program, when i click on my button2, a pop out box read:
Database error: Syntex error (missing operator)in query expression "Address ID"
and erm I din add code in Oninit dialog. Thanx for ur help!
|
|
|
|
|
That's why it is considered a bad idea to embed spaces into field names.
SqlString = "SELECT [Address ID], [Last Name] FROM Categories";
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Is there an easy way to modify the VS_VERSIONINFO resource in a Win32 EXE. We currently open the file, search for the unicode string VS_VERSIONINFO, assume thats the start of the resource in the EXE and overwrite the required fields. This method seems a bit flakey as you need to reserve the correct number of characters for each string (file version, file description etc.) when the resource is defined. Also the structure seems to change according to the length of the strings which I think is due to 32bit boundaries. Can anybody recommend better method?
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
you can use some resource editor tools for doing this activity.
I would recomment 'ResHack'. Search and download. A very handy tool.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
No can do. The programs are stamped with the current version number as part of our product generation procedure which involves updating 400+ programs. I was hoping there were API calls available or that someone had written a class to do it. Thanks for trying...
Systems AXIS Ltd - Software for Business ...
|
|
|
|