MouseUp event not firing

  1. 2 weeks ago

    Luigi F

    Sep 6 Pre-Release Testers, Xojo Pro

    Ok, I am doing something stupid....

    I have textfields on a folder tab. I have code under
    the MouseUp event handlers, but it dose not seem
    to run. I This is on win7. Is there and enable or
    something I have missed?

    Code under the KeyUp event fires and works
    just fine on these text fields.

    Thanks.

  2. Jürg O

    Sep 6 Pre-Release Testers, Xojo Pro

    From the Docs: MouseUp event

    This event will not occur unless you return True in the MouseDown event. The return value is ignored.

  3. Jürg O

    Sep 6 Pre-Release Testers, Xojo Pro

    And check the coordinates in MouseUp to figure out if the MouseClick has been released within or outside of the Control.
    You probably don‘t want/expect an Action if it‘s released outside...

  4. Luigi F

    Sep 6 Pre-Release Testers, Xojo Pro

    Ummm,
    Like I said, I am doing something stupid..
    how do I " return True in the MouseDown event." ??

    Sorry for the stupid questions.

  5. Dave S

    Sep 6 San Diego, California USA

    you add the line

    RETURN TRUE

    in the MouseDown Event

  6. I knew this one before, but must add this line into the forum field:

    Xojo is full of surprises. :)

  7. Luigi F

    Sep 6 Pre-Release Testers, Xojo Pro

    OK, how do I get key up to work in a text box?

  8. Emile S

    Sep 6 Europe (France, Strasbourg)

    Add a MouseDown Event in a text box (TextField or TextArea),
    Add: Return True in that Event,

    Add a MouseUp Event in the same text box (TextField or TextArea),
    Put code that deals with the MouseUp in the COde Editor: this is your part.

    Clear ?

    No ?
    Read the documentation (and download the book there: http://www.xojo.com/learn ).

  9. Michel B

    Sep 7 Pre-Release Testers, Xojo Pro RubberViews.com
    Edited 2 weeks ago

    You can't return True to MouseDown in a TextField or TextArea. It would suppress all keyboard entries.

    The only solution would be to start a 100ms or so multiple timer in keydown which would monitor the keyboard down state:

    In Keydown:

    TimerKeyUp.Mode = Timer.ModeMultiple

    In The timer Action event:

    Dim down as boolean
    For i as Integer = 0 to 255
    if Keyboard.Asynkeydown(i) then
    down = True
    end if
    If not down then 
    Sender.Mode = Timer.ModeOff
    //This is the keyup 
    
    end if
    next

    Why do you need KeyUp there ? What are you trying to achieve ?

  10. Dale A

    Sep 7 San Diego, California, USA

    @Michel B You can't return True to MouseDown in a TextField or TextArea. It would suppress all keyboard entries.

    Not if you have another way to set the focus to the control. True, you can't click in it but if another control gives it the focus, or you TAB into it, keystrokes are seen and handled fine.

  11. Dave S

    Sep 7 San Diego, California USA
    Edited 2 weeks ago

    @Michel B You can't return True to MouseDown in a TextField or TextArea. It would suppress all keyboard entries.

    This statement confuses me.... as to how it would be considered correct?

    What does the mousedown (true or false) have to do with normal keyboard operations?

    I just created a test project with two textfield, one with TRUE in MD and one with nothing. I can click between them, and edit them both just fine...... So I'm not sure what you consider the issue to be????

    @Dale A Not if you have another way to set the focus to the control.

    seems to get focus just fine in my tests

  12. Michel B

    Sep 7 Pre-Release Testers, Xojo Pro RubberViews.com
    Edited 2 weeks ago

    @Dale A Not if you have another way to set the focus to the control. True, you can't click in it but if another control gives it the focus, or you TAB into it, keystrokes are seen and handled fine.

    @Dave S This statement confuses me.... as to how it would be considered correct?

    What does the mousedown (true or false) have to do with normal keyboard operations?

    Both of you are correct - Sorry. I must have read much too fast. Returning True in MouseDown does not impair keyword operation in a TextField/TextArea.

    However, indeed, returning True in MouseDown will impair all normal mouse operation. Meaning, no more selecting words or paragraphs with the mouse in order to copy or to delete.

    @Luigi F :

    Here is the solution with a timer:

    In MouseDown:

    TimerMouseUp.Mode = Timer.ModeMultiple

    In the Action event of the TimerMouseUp Action event:

    If not System.MouseDown then 
    Sender.Mode = Timer.ModeOff
    //This is the MouseUp code
    
    end if
    next

or Sign Up to reply!