I have two classes, both inherited from TImage
In the object of the first class there is a pointer to the object of the second class, the picture of it is smaller in size)
When I click on the first class object, its OnClick handler OnClick and the second class object is created, which almost completely overlaps the first object.
When I click on the object of the first class again, the object of the second class should be removed, but because of its size, I have to click on the edge of the first object
You can somehow make it so that when you click on an object of the first class, the object of the second class is ignored, so to speak, so that the handler catches the event through the second object
- It is easier to shoot the second object and not suffer. As comrade Stalin said, there is a person — there is a problem. No man - no problem. :) - Vlad from Moscow
- @VladfromMoscow yes, but I need the first object to know that the second one has been destroyed. In this case, the picture of the first object should change - andrew
|
1 answer
Andrew, on Sea Builder a long time ago programmer, therefore - I will not provide you with a code. But the recommendations will give, and I am sure they will help you.
Can I do something so that when I click on an object of the first class, the object of the second class is ignored, so to speak, so that the handler catches the event through the second object?
Hike wrong
We have
- Class "A" object
- An object of class "B", which is a "descendant" of an object of class "A", and may partially overlap it
- The object of class "B" is "higher" in the Z-coordinate of the object of class "A"
We provide
- All objects have a field of reference to "parent"
- All objects have a list (array) field for children
This ensures the communication of GUI objects, in other terms, widgets.
Pass
- One of the widgets caught a click on the coordinate (x, y)
- Under the terms of the question, this widget should call the handler from the "parent", in other words - "to throw". And we have the corresponding pointer.
- What can a parent say? "Made" or "Handle it yourself"
- What can a parent do? 1) Do it yourself, 2) Give the task to "other descendants", "Refuse"
|