:?: how to determine if the user clicks on a text field

  • I insert some fields by using 'InputMergeField' function to a document. I want to know if the user clicks on the fields. but the event 'OnTextObjectMouseDown' does not fire when user clicks between the begin position and end position of that field. when user clicks on the begin position or end position, this event works as expected. how to fire the 'OntextObjectMouseDown' event when user clicks between the begin and end?

    thanks a million

    • Offizieller Beitrag

    Hi,

    this will help (in OnMouseDown event):


    Julian

  • yes, this code works, but i found it does not work for calculate fields.

    i insert a calculate field into WPRichText using the following code:

    Code
    obj := WPRichText.InputTextFieldName('PAINT_CALC');  obj.Params := 'some display text';  obj.Source := 'some internal text';

    when i click on inserted field,

    Code
    pobj := WPRichText1.CodeInsideOf(x, y, wpobjTextObject, par, posinpar);

    always returns nil

    how should i do?

  • i tried, it seems working, but not always.

    i want to make one menu item visible when right click on such a field, so i add code to 'OnTextObjMouseDown' Event, when i right click the field, sometimes the event fires but sometimes not. I think it is the same as another problem, that is when mouse move over the field, the cursor not always switch to a hand.

    is there another way to solve this problem?

  • Zitat von littlegg

    i want to make one menu item visible when right click on such a field, so i add code to 'OnTextObjMouseDown' Event, when i right click the field, sometimes the event fires but sometimes not. I think it is the same as another problem, that is when mouse move over the field, the cursor not always switch to a hand.


    I have the same problem.

    • Offizieller Beitrag

    Hi,

    From Version 5.20.5 the cursor positioning algorithm was slightly change to check for clicks on textobjects better. Itr does not use the margin it uese for regular characters. For regular characters this margin is required to make selection with the mouse and positioning of the cursor easier so https://www.wpcubed.com/forum/viewtopic.php?t=2074 is solved.

    Julian