Why cant I
MFC
Radio Button: When working with more than one groups of MFC Radio
buttons in the same window:
- Sequence: of the radio buttons:
for each radio button group,
make sure the buttons are in sequence.
- Tabbing order of control elements:
when in MFC resource editor type ctrl-D to toggle the tabbing order of GUI elements.
This is the ordering, or when
you type <tab> to advance to the next GUI element, you will observe
focus changing in this order.
- Changing the sequencing: with the
<tab> sequencing order visible, you can change the ordering by
clicking on the numbers.
- MAKE SURE radio buttons in a
group have tabbing numbers in sequence.
- Remember the first radio button (with smaller number) of each group. You
want to make sure only the first
radio button of each group has the group-property set to true.
- Grouping: type another ctrl-D to
switch off the tabbing sequence.
For each group of radio buttons, right-mouse-button click on the first radio button and bring up the
property sheet. Look for the Group property and make sure it is set to
true. Now make sure all non-first radio buttons have their Group
property set to false. Now you can type ctrl-T to try out your radio
buttons. It should work now.
- Initialization: dont forget to
initialize your radio buttons by calling CheckRadioButton() for each radio-button-group in OnInitDialog().
GetCheckedRadiuButton(symbol_A, symbol_B):
if you call this function to determine which if the radio button is click, you should:
- Look
at Resource.h (edit this
file)
- Look
for "symbol_A" and "symbol_B" in the Resource.h
file
- Look
at the numbers that these symbols are defined: Make sure
- symbol_A and symbol_B
corresponds to the first and last of your radio
- make
sure all radio buttons in the group have _CONSECUTIVE_ numbers (you can
hand-edit this, just make sure you use unique numbers)
For example: I have radio button, b1, b2, b3, b4 on my
GUI, and in resource.h I have ...
#define IDC_B1 1012
#define IDC_B2 1110
#define IDC_B3 1013
#define IDC_B4 1000
Notice IDC_B1 does not have the
smallest number, and notice the numbers are not in any consecutive ordering, so
I would type modify the above to make sure:
- b1 has
the smallest number in the group
- b1,b2,b3,b4
are consecutive numbers
- all
numbers are unique, for example, I may do the following editing:
#define IDC_B1 9000
#define IDC_B2 9001
#define IDC_B3 9002
#define IDC_B4 9003
Now when I call: GetCheckedRadiuButton(IDC_B1, IDC_B4), I will be ok. (The above ctrl-D, should do the trick, but sometimes it may fail, and you
have to do all these by hand).
Linking
With MFC library generates tons of error:
- MFC with DLL: The MFC library (and
ALL of our tutorials) are build to run with DLLs
- Your code: must also be compiled
with the MFC DLL option, here is how:
- Set
your Configuration to Debug
- In
the solution view, RMB to call up the property sheet of your project
- Under
General: Use of MFC: make sure you select Use of MFC in a Shared DLL
- Open
up the C++ tab, under Code Generation
- Runtime Library: make sure you
select Multi-threaded Debug DLL
- Now
set your Configuration to Release and repeat the above
steps.
D3D
Performance:
I have a really fancy graphics
card, why does my DX program runs so slowly? Do this:
§
Go to
your Control Panel
§
Find the DirectX
property page
§
Go to the Direct3D
tab
·
Under Debug/Retail
D3D Runtime select Use Retail
Version of Direct3D
Compile/Link
DX programs:
Your directory search path
may be incomplete or wrong. In your development environment, (on VC.net) do
this:
§
Tools ->Options
§
Under the Project folder
§
VC++ Directories
·
Show directories for: Include files
add in C:\DX_PATH\include or wherever you have installed
you DXSDK. Make sure this path comes before any of the existing paths. What
are we doing here?
·
Show
directories for - Library files
add in C:\DX_PATH\Lib or wherever you have installed
you DXSDK. Once again, make sure this path comes before any of the existing
paths. What are we doing here?
DX_PATH depending on your DX version and your exact installation,
this path is usually under:
C:\Program Files\Microsoft
DirectX _SOME_VERSION_NUM\
Please come talk to me (of ask in
class) if you do not understand what I am talking here. If you do, good! Make doubly sure you understand exactly
what the above is doing. I think I will ask a system type question in
the mid term exam J