|
Thanks Ryan
Mazy
No sig. available now.
|
|
|
|
|
|
Is there a common method of providing a UI for adding and deleting rows in a CGridCtrl? I can certainly develop various solutions but I wanted to check to see if there is something useful that already exists.
For adding, one solution is to always have the bottom row be empty and available for adding an entry, such as what MS Access does for tables. Is that a solution that is commonly used? If so then I can probably figure it out easily enough.
For deleting, one solution is to implement a context-menu. I assume it is easy enough to determine the row that the click is in. Another solution is to allow the Delete key to provide that capability and/or a Delete button.
I have implemented code that determines if a cell, but only one cell, is selected. I should improve it to allow as multiple cells to be selected, as long as it is for one row. However it would help to have an option that permits only a single row to be selected. There appears to be an option for that but the option requires "List mode" and I have not become familiar with that. If I can't use that then I hope there is a way to catch the event of the change in selection and to provide single-row selection that way.
|
|
|
|
|
Hi all,
I am experiencing a strange problem when declaring classes outside the main source file in VC++. I have made an experiment that demonstrates my problem. There are two files: “main.cpp” and “class.cpp”.
“main.cpp” content:
#include "class.cpp"
int main() {
return 0;
}
“class.cpp” content:
class Class {
public:
void Test();
};
void Class::Test() {
return;
}
When I try to compile I get following error:
<br />
--------------------Configuration: main - Win32 Debug--------------------<br />
Compiling...<br />
main.cpp<br />
class.cpp<br />
Linking...<br />
class.obj : error LNK2005: "public: void __thiscall Class::Test(void)" (?Test@Class@@QAEXXZ) already defined in main.obj<br />
Debug/main.exe : fatal error LNK1169: one or more multiply defined symbols found<br />
Error executing link.exe.<br />
<br />
main.exe - 2 error(s), 0 warning(s)<br />
It says that the function void Test() is already declared, but how? Please help me, am I doing something wrong?
Aidman » over and out
|
|
|
|
|
pretty simple to fix:
the class prototype should be in a header called class.h
The class implementation (the class' function definitions) should be in class.cpp.
Both main.cpp and class.cpp should #include "class.h"
|
|
|
|
|
Great! Thanks alot
Aidman » over and out
|
|
|
|
|
Hello, I'm curious on how to make the item selection in ComboBoxEx control the way that Michael Dunn's Custom Draw does int the ListView control (without selecting the icon - the last part). Any ideas?
Thanks,
Deian
PS: No custom draw available for ComboBoxEx, according to my MSDN documenation
|
|
|
|
|
I've never used ComboboxEx controls much, but I think they work like the regular combobox - set either the CBS_OWNERDRAWVARIABLE or CBS_OWNERDRAWFIXED style, then handle WM_MEASUREITEM and WM_DRAWITEM .
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Ok, I have an application where many bitmaps are displayed on the screen. The user has to be able to click on the bitmaps and move them around and delete them and other things like that. What I was originally doing was handling WM_LBUTTONDOWN and finding the bitmap that was closest to the cursor position. What I would like to do, and I don't know if this is possible, is have each bitmap in its own little invisible window that could recieve its own messages, like WM_LBUTTONDOWN. I don't know how to do this or even if it's possible, so any help would be greatly appreciated. Is there a better way to go about doing this?
Thanks,
Steve
|
|
|
|
|
It's hard to say what's the "best" way w/o knowing how your app is structured. What I personally would do is keep an array/list of RECT s that hold the coordinates of each bitmap. Then when you get a WM_LBUTTONDOWN message, use PtInRect to find which RECT the cursor was in. Then you'll know which bitmap was clicked.
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Hi
I have a SDI application (made by AppWizard). MRU list is handled in standard way (just like in applications made by AppWizard).
Here is my problem: when recent file list is empty (for example program is launched on some system for the first time or someone has cleaned proper registry key) there is an empty menu item in File menu. Is there an easy way to hide such empty MRU item? I don't want to handle MRU by myself (that will surely solve my problem). Thanks in advance for any help.
Mariusz Popiolek
|
|
|
|
|
You can't just hide menu items - you have to remove them from the menu,
I wouldn't recommend attempting removing this item though. MFC uses the this menu item as a basis for adding the new ones. If you remove the "no files" (or whatever it is) menu entry, then it won't know where to insert any subsequent files in the MRU list.
You're better off just leaving it the way it is, unless you do want to handle the MRU yourself.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I've subclessed a few classes like CEdit, CListBox,...
If I bind these classes to resources created with the resource edit all works fine. But if I use Create(..) then the controls assume System to be their default font and Edit boxes are drawn without a border and not even adding WS_EX_CLIENTDGE does the job.
Does anyone have any idea why this is happening?
Thank you
Artur Jales Moreira
|
|
|
|
|
jales wrote:
if I use Create(..) then the controls assume System to be their default font
'System' is the default font. In order to set the font to the currently selected user font for dialogs, try this: control.SetFont(::GetStockObject(DEFAULT_GUI_FONT)) .
jales wrote:
Edit boxes are drawn without a border
Add the WS_BORDER style to the dwStyle parameter specified in your Create call.
Software Zen: delete this;
|
|
|
|
|
First of all, thank you! SetFont(..) did the job.
As for the border, I didn't explained correctly what happens, the problem is that the border is a single black line instead of a 3D looking border.
Thank you
Artur Jales Moreira
|
|
|
|
|
The 3D border styles are extended styles. To use those, you should call CreateEx, which lets you specify an extended style argument in addition to the normal style argument.
Software Zen: delete this;
|
|
|
|
|
You're the man. That did the job.
At first I did check CWnd::Create() and saw that it called CreateEx but I forgot that the extended styles were a different parameter.
Thank you
Artur Jales Moreira
|
|
|
|
|
Greetings,
I have a visual C++ 6 problem:
I have a Class CBitmapLoader that is defined in BitmapLoaderClass.h
I have a MainShell.cpp file that creates an instance of CBitmapLoader called Background and uses it's functions.
I have a DrawingPhase.cpp file that also wants to access the Background functions.
I have included BitmapLoaderClass.h in MainShell.cpp but including it in DrawingPhase.cpp causes an "already defined" error (despite BitmapLoaderClass.h being "bracketed" by #ifndef, define and #endif.
I have tried to extern the CBitmapLoader Background and its functions.
Would a Namespace allow me to access functions as if it was the same source file ?
Much appreciated.
|
|
|
|
|
It sounds like your bracket symbol (the #ifdef... #define... #endif stuff) may be misspelled someplace.
Software Zen: delete this;
|
|
|
|
|
does anyone know if static libs (non MFC) built with VS.Net 2003 can be used in VS.Net '02 ?
-c
To vote with no response is to follow the way of the coward.
|
|
|
|
|
How to get a random number of BYTE type
|
|
|
|
|
BYTE b = (BYTE)( rand () % 256);
Iain.
|
|
|
|
|
It's so easy!
Thank you.
|
|
|
|
|
How can I make a function to do rand() work?
<marquee>Hosam Aly Mahmoud
|
|
|
|
|
Maybe a random number can be generated as following ways:
1.serial numbers;
2.A mathimatial way, which requires:
(1)Irrelevant;
(2)Diffusing;
(3)Shifting;
(4)Inter-Action;
and so on.
Herein I just have a free think, however, I don't know the how-to-do details.
|
|
|
|