|
Er - from memory if you play with the Group check box in the properties of the cb controls, you should get it - works for radio buttons too I think.
In InitInstance you'll see the main window handled - if you call ModifyStyle to remove the WS_THICKFRAME style for it you should effectively make the window unresizable. Hmmmm might look at WM_MAXIMIZEBOX as well..
|
|
|
|
|
Check a checkbox with CheckDlgButton() - it doesn't matter how many you have or whether they're in a group box.
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
Still looking for an answer to....
MSDN states:
"While it is normal to derive your own dialog classes from CDialog, you do not typically derive your own class for a dialog bar. Dialog bars are extensions to a main window and any dialog-bar control-notification messages, such as BN_CLICKED or EN_CHANGE, will be sent to the parent of the dialog bar — the main window."
I do not know how to use a dialog bar's controls. I can load the dialog bar, but I can't activate the bottons so they may be pressed, I can't set text in textboxes, I can't set the status of check-boxes. How are you supposed to get variables associated with the controls on the dialog bar if you don't have a derived class.
Thanks, John
|
|
|
|
|
Your need a command handler implemented in CMainFrame class to enable button and respond to events. You just have to add this manually. Assuming that your button has and IDC_BUTTON1 id, you have to:
1) insert member declaration in Mainfrm.h:
afx_msg void OnButton1();
Add this line outside the //{{AFX_MSG block
2) insert member definition in Mainfrm.cpp
void CMainFrame::OnButton1()
{
AfxMessageBox("Button1 pressed.");
}
3) add appropriate entry to message map in Mainfrm.cpp
ON_COMMAND(IDC_BUTTON1, OnButton1)
It's safer to have this line outside the //{{AFX_MSG_MAP block - ClassWizard has the tendency to overwrite stuff inside //{{AFX_xxx.
Well, that's all - you should see the msgbox after pressing the button. If you want to conditionally enable/disable control (like toolbar buttons or menu items), use ON_UPDATE_COMMAND_UI macro.
How are you supposed to get variables associated with the controls on the dialog bar if you don't have a derived class
Your CMainFrame probably has a CDialogBar member, say m_dlgbar. Use m_dlgbar.GetDlgItem(IDC_YOURCONTROL) to get access to specific controls. For example, to get access to edit box located on a dialog bar, use this:
CEdit *pEdit = (CEdit *)m_dlgbar.GetDlgItem(IDC_MYEDIT1);
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi,
Is there a possibility to catch when the program is under debug mode of MSVC or not ? ( program is with the debug info in the both cases )
|
|
|
|
|
|
I would really appreciate it if someone would give me a little help with trying to get my program to save the state of the toolbars when I exit. I am using standard MFC generated CToolbar objects and calling the GetToolBarCtrl function to access the CToolbarCtrl functions and trying to use SaveState. Following is my code. The SettingsRegKey is a Cstring with the path to my program in the registry that already exists although the value the SaveState function is supposed to add does not. Any ideas why it is not working? Thank you very much
CString SettingsRegKey = _T("Software\\Star\\Star\\Settings");
m_wndStandardToolBar.GetToolBarCtrl().SaveState(HKEY_CURRENT_USER, SettingsRegKey, _T("Standard ToolBar"));
|
|
|
|
|
Hey!
I've got a plugin system working in my app and it works
great. One thing I'd like to be able to do is to have
some of the plug-ins automatically doc themselves to
the app window (like a toolbar). I've tried several
methods, but haven't figured it out yet.
Any help?
Steve The Plant
|
|
|
|
|
I think I wrote that question too quickly.
I guess it would help to say that I'm working in MFC. And
that each plugin is stored in a DLL. So, that means I wonder
if there's a way to dock a toolbar (that's basically just
a CToolBar or Docking Dialog bar) stored inside a DLL onto my
main app frame.
I've tried passing the window handle and the actual pointer
of the main frame to the DLL and then trying to dock the
toolbar (contained inside the DLL), but it doesn't work. I
get assertions and other errors.
I do call that AFX_ function (forgot the name since I'm
not at work) inside each DLL function before doing anything
in MFC. Does anybody have any suggestions? Ideas?
Steve The Plant
|
|
|
|
|
What kind of DLL it is? Is it an 'extension DLL' (sharing a copy of MFC with the app) or 'regular DLL'?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
It's just a "regular" DLL. The Toolbar stored in the DLL would
be created and docked at runtime.
Steve The Plant
|
|
|
|
|
You should consider using 'extension' dll - they should just snap into main exe and whole system would be one app from MFC point of view. Exe and dlls would share global maps used for mapping HWNDs to CWnds, etc. This makes passing CWnd pointer around possible. You can't achieve that with 'regular' dlls - the dll doesn't know that exe uses MFC and vice versa.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
We are having a problem with the use of rich edit controls in a project.
The rich edit control seems to work fine with the debug build. However, the text gets distorted (the font changes and also its size) in the release build.
Any pointers?
Thanks!
|
|
|
|
|
I fixed it!
|
|
|
|
|
I am building application in Win98 using RichEdit it works
fine on Win98,Win95 and Win Nt 4.0 but it gives the
follwing problem in Win 2000.
My program uses a font which has a accent like charecter.
What is accent charecter?
Accent char is a char drawn on a main char like (A`)
here main char is "A" and accent char is "`" drawn on top
of "A".
Now combained main and accent char is one char.
In Win95/98/NT 4.0/ it works fine but in Win2000 I am
seeing the following display problem:
Whenever a accent char is diplayed in Win2000 I am seeing
an Extra space. (example: this should displayed like "A`a"
instead in Win2000 it displayed like "A` a")
Here is how to reproduced the problem:
To reproduce this problem I am attaching a TTF font(which
is availabale for free from www.tamilnet99.org)
0) download font from: http://www.tamilnet99.org/font.htm
1) Install TABAnna.ttf into Win98 and Win2000.
2) use Charecter Map tool and choose the main charecter
says ("a")[U+0061] then choose the dot char (.)[U+00A2]
(i.e third char from "~")
3) Now it will display "a" and "dot" on top of it.
But if you choose one more char (say "b") now you will
see the extra SPACE between charecters.
4) It should be:"a(dot on top)b"
but itdisplayes: "a(dot on top)<space>b"
5)From charecter map tool copy and past the string to
WordPad it also shows the extra space between chareters.
6)Even a simple MFC (generated) program which uses
CRichEditView shows this problem.
7)Copy/past to MS word it looks FINE
8)If I display the string in a dialog, Edit Box or combo
box it looks fine.
Again this diaplay problem appears only of Win2000 not on
Win98 or Win NT 4.0.
NOTE:
This is not a UNICODE program and enableing and disabling
_MBCS does not make any difference!
Thanks...
Kalai
|
|
|
|
|
...on declarces one class and that class need needs a pointer back to the one that declared it.
I am working on a project that has two classes(named here as Root & Child). They are defined in the same header file an Child is defined before Root is defined. Root declarces Child as shown...
class Root
{
public:/*All memebers public*/
Child myChild;
/*Other memeber class, functions, and variables I want to access in Child.*/
}
Ok, now here come Child and want a point to Root so it can access Root's memebers. I define the class like this...
class Child
{
public:/*All memebers public*/
Root* pmyRoot;
/*Other memeber class, functions, and variables for this class*/
}
Now rememebering Child is defined first in the header when I compiled the project then compiler finds, while declaring the pointer to Root, that Root is undefinded. Same thing happens if the Root is defined before Child. The Child is only is going to be used by Root and won't be in a lib. for others to use so this dependent model is Ok(except for the pointer problem). I have tried using class reference forwarding and can up w/ the same undefining problem, but I am still new to class reference forwarding.
Is there way the to access a pointer back to the declaring Object?
|
|
|
|
|
try this:
in Root.h
class Root
{
public:
Child myChild;
}
in Child.h
class Root;
class Child
{
public:
Root* pmyRoot;
}
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Do da' phrase "spaghetti" ring a bell?
|
|
|
|
|
Great, that part works now I got to setup the pointer and use it. I will post if problems.
|
|
|
|
|
Is there a way to tell how many socket buffers are waitint for recv's at the Kernel level?
In other words, how many recv's are pending, ready for recv calls?
Thanks...
Thanks...
|
|
|
|
|
i am looking for an application that can print an HTML file without any promp dialog box, just print and that's it.i know it can be done with cHtmlView, but i don't know how to bypass the dialog box of the print.
if anyone has an application like that i would be happy to get it
thanks a lot
grospa
|
|
|
|
|
CHtmlView::ExecWB( IDM_PRINT, ...)
|
|
|
|
|
Has anybody else had this problem and if so how do you get round it.
I have the following piece of code
#ifndef Pi
#define Pi 3.1415926535897932384626433832795
#endif
#ifndef DEGS_TO_RADS
#define DEGS_TO_RADS (Pi/180.0)
#endif
double dCosine, dRotationAngle;
dCosine = cos(dRotationAngle * DEGS_TO_RADS);
In one perticular place the rotation angle is 90 degrees, and as I am sure you are aware the cosine of 90 degrees is 0. But in the above code the resulkt from the cos function is a very small number, 6.1230317691119e-017, but but this still is not zero.
Any Ideas
Cheers
AndyC
|
|
|
|
|
|
First multiply, then divide. This could have better precision, but it's hard to tell.
You are doing: angle * (pi/180)
(pi/180) is a small number, while 90 (angle) is not. Multiplying such different numbers could lead to loss of precision.
You could enhance results by doing: (angle * pi) / 180
This way 90*3.14 is comparable to 180, so you lose less precision.
Using double data type should also help.
Paolo.
|
|
|
|