|
Wishing you all a great break.
To those regulars who post great answers, thanks for educating me.
To those posting interesting questions - thanks for helping me educate myself!
Merry christmas all - those presents need opening, and I can't find the API...
Iain.
|
|
|
|
|
Merry Christmas to you, Iain (an anonymous fan ).
Iain Clarke wrote: To those regulars who post great answers, thanks for educating me.
To those posting interesting questions - thanks for helping me educate myself!
BTW it looks like you missed the meritorious George_George.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Cheers Iain!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Iain Clarke wrote: Merry christmas all - those presents need opening, and I can't find the API...
You too Iain. Merry Christmas!!!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
|
Merry Christmas Iain and all the others
|
|
|
|
|
Merry Christmas Iain... and Happy New Year... and Happy birthday... and Happy easter...
|
|
|
|
|
Getting your wishes in early, eh? Don't think I'm letting you off from clubbing together to but me a birthday present in april...
Iain.
|
|
|
|
|
Merry Christmas!!! and Happy New Year Iain..
Regards,
Sandip.
|
|
|
|
|
Merry Christmas sir. I'm a little late though (was still on vacation).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I have four or five kinds of objects, all derived from an indexedObject. indexedObject's have an integer id which can be set and they can be compared with <, >, etc to facilitate sorting, pretty simple class.
I would like to create one class that wraps a list and adds some other functionality and can hold all these kinds of objects. Problem is if I use a std::list<indexedObject> to hold the objects, I lose access to the functions not in indexedObject.
I would store pointers but then sorting and looking up the objects would require lots of extra code.
Is there a way to use the std::list<indexedObject> list to store the objects and cast them back to their derived type as appropriate? I can't use the assignment operator, I get an error.
I thought about all kinds of things like memcpy or something but it seems as if I resort to that I am getting pretty far off the reservation.
Any suggestions?
|
|
|
|
|
Is RTTI [^] what are you looking for?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
If i understood you right, what you are doing is a bit dangerous... however, if you are sure about what you are doing, you could try simply get the address of the certain item and convert it to a pointer of the right class and access it thorough that pointer, so what i mean is something like this:
((CIndexedObjectDerivant *)(&list_of_CIndexedObjects[12]))->MyRequiredMethod();
Good luck and marry xmass!
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
FWIW, I was able to do the following -
std::list<iObj> _listA;
std::list<iObj>::iterator _iA;
std::list<dObj<int>> _listB;
std::list<dObj<int>>::iterator _iB;
dObj<int> * p;
int i;
dObj<int> o;
for (i = 5; i > 0; --i)
{
o.setID(i); // method in base class (iObj)
o.setValue(i); // method in derived class (dObj)
_listA.push_back(o);
_listB.push_back(o);
}
_listA.sort();
_listB.sort();
_iA = _listA.begin();
_iB = _listB.begin();
i = (*_iB).getValue(); // works
i = _iB->getValue(); // works although it's not necessarily defined?
p = static_cast<dObj<int> *>(&(*_iA));
i = p->getValue(); // works
_iA++;
p = static_cast<dObj<int> *>(&(*_iA));
i = p->getValue(); // WRONG answer. The id associated with iObj was correct (2) but the
//member variables associated with the derived object have vanished.
return 0;
Guess I will just go with sub classing several different kinds of lists.
|
|
|
|
|
I am getting an error of " stdprn not defined " when I use the folowing code in Code Blocks. I am using Windows Xp.
#include <stdio.h>
main()
{
FILE *stream;
stream = fopen("PRN", "w");
fprintf(stream, "a line of text\n");
}
What should I do?
|
|
|
|
|
|
Uhm...Looks like a deja vu...[^]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I need the capablitiy to right click on dialog button and display a CMenu object that will have list of options that can be performed. As of right now, I am unable to capture a right mouse click over a dialog button. I am using the ON_WM_RBUTTONDOWN(). The message captures the right mouse clicks over the empty dialog space but no use for me. .
Anyone can recommend, a way to capture right mouse clicks over dialog buttons. I do need to know which button i am over.
Scott Dolan
Jernie Corporation
Engineering & Manufacturing
Software, Hardware, & Enclosures
|
|
|
|
|
Subclass CButton (for the buttons on your dialog) to detect the right button clicks and send some form of notification (a Windows message of some sort) to the dialog?
That's pretty much what I'd do in WTL, although as WTL has the concept of forwarding messages from sub-classed controls to their containers, it'd be a bit simpler.
|
|
|
|
|
Check out this article[^]. It does exactly what you needs - a context menu when you right click on a button!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
i want to creat an bitmap by the mean of CreatBitMap(), but if the DIB data are over 20M, it failed, if the DIB data is 5M,it succeed. is there data length limit?
how can i creat an bit bitmap with the DIB data?
thanks.
|
|
|
|
|
Here[^] it says:
Windows 95/98/Me: The created bitmap cannot exceed 16MB in size.
Could it be that you are using Windows 95/98/Me?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
|
Hope for quick action........
|
|
|
|
|
class ZoomableObject
{
public:
void zoom(double dZoomFactor);
};
void ZoomableObject::zoom(double dZoomFactor);
{
}
just fill the ellipses.
That is: pointless question => pointless answer.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|