I don't have any special checkbox. I am using the standard WPTools checkbox. Here is my code that creates a WPTools checkbox and a picture object.
procedure TForm1.Button8Click(Sender: TObject);
var
_img: TWPOImage;
_obj: TWPTextObj;
begin
// Add an under text image.
_img := TWPOImage.Create(WPRichText1);
_img.LoadFromFile('C:\temp\test.JPG');
_obj := WPRichText1.TextObjects.Insert(_img);
_obj.Name := 'BACKGROUND_IMAGE';
_obj.Wrap := wpwrNone;
_obj.Mode := _obj.Mode + [wpobjObjectUnderText, wpobjRelativeToPage];
// Add checkbox
_obj := WPRichText1.InputTextFieldName('FORMCHECKBOX');
// Give it a name
_obj.Source := 'CHECKBOX_1';
// Uncheck the checkbox
_obj.Params := 'False';
end;
Alles anzeigen
-When I click on the checkbox, it triggers an OnTextObjectClick event for the checkbox and also an OnClick event, which is correct.
-When I click on the picture or anywhere else on the page, it only triggers an OnClick event, which is correct.
-When I press the shift key an click on the picture, it triggers an OnTextObjectClick event for the picture and also an OnClick event, which is correct.
-When I press the shift key an click on the checkbox, it triggers an OnTextObjectClick event for the picture and also an OnClick event, which is NOT correct because I clicked on the checkbox and not on the picture.
Now, if I do the same tests but with the DONTREQ_SHIFT_FOR_UNDER_TEXT_OBJ conditional define.
-When I click on the checkbox, it triggers an OnTextObjectClick event for the picture object and also an OnClick event, which is NOT correct because I clicked on the checkbox and not the picture.
-When I click on the picture, it triggers an OnTextObjectMouseDown event for the picture and also an OnClick event, which is correct.
What I need to do is to be able to detect which TWPTextObj that the user really clicked on even if the picture is under text and even if some other TWPTextObj objects appear on top of the picture. So if a checkbox appears on top of a picture and the user clicks on this checkbox, I need OnTextObjectClick, OnTextObjectDblClick and OnTextObjectMouseDown to be triggered for checkbox object, but if the user clicks on the picture object, I need OnTextObjectClick, OnTextObjectDblClick and OnTextObjectMouseDown to be triggered for the picture object.
I hope that gives you all of the information you need to tell me if this is a problem with WPTools or if you have some other way to make this work.
Thanks,