How not to activate a floating window?

  1. last week

    Marc C

    is not verified Aug 9 Pre-Release Testers, Xojo Pro near Lyon, France
    Edited last week

    Please try this project http://www.marinelabel.com/xo/floatwin.zip (xojo 2019r11)
    run it and clic on the show pal button, then click on the white square of the palette or the white square of the window
    - on Mac it gives something like this:
    activate Win
    deactivate Win
    activate Pal
    rect pal clic
    deactivate Pal
    activate Win
    rect win clic
    rect pal clic
    rect win clic
    rect pal clic
    - on Windows the 2 windows activate/deactivate all the time:
    activate Win
    deactivate Win
    activate Win
    deactivate Win
    activate Pal
    rect pal clic
    deactivate Pal
    activate Win
    rect win clic
    rect win clic
    deactivate Win
    activate Pal
    rect pal clic
    deactivate Pal
    activate Win
    rect win clic
    deactivate Win
    activate Pal
    rect pal clic
    deactivate Pal
    activate Win
    ---> how to avoid this behavior on Windows ?

  2. Dale A

    Aug 9 San Diego, California, USA

    I tried it on Windows 10 with no changes to your posted app and am not seeing the problem. My steps were

     Click 'show pal'
     click in rect on pal
     click 'hide pal'
     click 3 time in rect on main window

    Results:

    activate Win
    deactivate Win
    activate Pal
    rect pal clic
    deactivate Pal
    activate Win
    rect win clic
    rect win clic
    rect win clic

    I got the same results if in the IDE or built app. What version of Windows are you running?

  3. Marc C

    is not verified Aug 9 Pre-Release Testers, Xojo Pro near Lyon, France
    Edited last week

    on Mac 10.14, when both windows are open, I can click on the rect in the window or rect in the palette without causing any activate
    on Win 10, activate or deactivate events always happen

    try to get this result on Win:
    rect win clic
    rect pal clic
    rect win clic
    rect pal clic

    for me, the correct behavior of a floating palette is the one I observe on Mac, not on Win

  4. Michael D

    Aug 9 Pre-Release Testers, Xojo Pro

    Search for SWP_NOACTIVATE and/or see https://forum.xojo.com/35103-prevent-a-window-from-being-activable/0

  5. Marc C

    is not verified Aug 9 Pre-Release Testers, Xojo Pro near Lyon, France

    Thanks I downloaded WFS and will try it

  6. Dale A

    Aug 10 San Diego, California, USA

    Ah. What you are wanting is for the floating window to not activate. I didn't get that from the original post. Michael's response should get you there.

  7. Michel B

    Aug 10 Pre-Release Testers, Xojo Pro RubberViews.com

    I used that to create an on-screen keyboard. What I did was to show the main window in the floating window Activate event.

  8. Marc C

    is not verified Aug 12 Pre-Release Testers, Xojo Pro near Lyon, France

    I installed WFS and don't see any SharedMethod for deactivate the window ?
    Should I write the method and, if so, can you help me ?

  9. 5 days ago

    Marc C

    is not verified Aug 14 Pre-Release Testers, Xojo Pro near Lyon, France

    I asked Paul but he's on vacation ...
    I do not know any windows API, Michel or Michael a little help? Thank you !!
    Marc

  10. yesterday

    Julian S

    yesterday Pre-Release Testers, Xojo Pro UK
    Edited yesterday

    Here you go Marc, sorry it took me so long to get around to this, I've been a bit busy.

    https://www.dropbox.com/s/7tqntta0qtr59uo/TestNoMouseActivate.xojo_binary_project?dl=0

    I changed the super of Pal to myWindow which then implements the code required to stop the window taking focus when clicked.

    For future searches, to implement this you need to listen for WM_MOUSEACTIVATE in WndProc and return MA_NOACTIVATE. SW_SHOWNOACTIVATE will stop the window taking focus when opened (if you require that, see note in the code).

or Sign Up to reply!