how can i select a particular object using the list pointers to objects?
-
I drawn multiple objects using pointers.i stored all pointers.how can i select a particular object using the pointer list?or any other simple method to serve the same purpose? Please answer in detail. thanks in advance.:) eeshwar_g@nagar.com
Could you present the question in detail ? Are these pointers to bitmaps you have drawn ? To child windows that have been drawn in the sense of creation ? I'd suggest that if you *need* this pointer list, and assuming they are all of the same object type, a map and a pile of global const int declarations would solve your problems very nicely. You could use a string, but why slow things down ? Christian #include "std_disclaimer.h" People who love sausage and respect the law should never watch either one being made. The things that come to those who wait are usually the things left by those who got there first.
-
Could you present the question in detail ? Are these pointers to bitmaps you have drawn ? To child windows that have been drawn in the sense of creation ? I'd suggest that if you *need* this pointer list, and assuming they are all of the same object type, a map and a pile of global const int declarations would solve your problems very nicely. You could use a string, but why slow things down ? Christian #include "std_disclaimer.h" People who love sausage and respect the law should never watch either one being made. The things that come to those who wait are usually the things left by those who got there first.
hai Thanks for fast response. I have drawn a few lines by instantiating class and I stored the pointers to objects in a list.now I want to select a particular line using this list of pointers.If I want to select a line to resize or drag it.for that purpose how can I get the pointer to particular object?I used pointers.I have written it in vc++. Thanks again. bhikshapathi_g@semanticspace.com
-
hai Thanks for fast response. I have drawn a few lines by instantiating class and I stored the pointers to objects in a list.now I want to select a particular line using this list of pointers.If I want to select a line to resize or drag it.for that purpose how can I get the pointer to particular object?I used pointers.I have written it in vc++. Thanks again. bhikshapathi_g@semanticspace.com
Now this is a little different. I presume you've got a list of pointers to objects that tell you the points you've drawn lines between ? If not, then you do not have a prayer, but I'm not sure if you do because if you do then your original question was too vague to be answerable. You need to iterate through your list of points and figure out if the point you have selected sits on one of the lines. I've had a quick scan of 'principles & practice' but cannot see an algorithm for finding if a point is in a line. ( I'm sure it's there, but it's early and I am tired ). One way to do it would be a/ find out first if the point is in the bounding box of the two points. b/ figure out the ratio between x and y. c/ apply that ratio to the x value of your point and see if the y value corresponds within an acceptable margin. I suspect something with paths is also possible. Christian #include "std_disclaimer.h" People who love sausage and respect the law should never watch either one being made. The things that come to those who wait are usually the things left by those who got there first.