LB Booster
« Mouse event on redraw »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 03:35am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Mouse event on redraw  (Read 116 times)
Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Mouse event on redraw
« Thread started on: Feb 9th, 2018, 2:32pm »

One small anomaly between Windows XP and subsequent versions I have noticed is that under XP, if my program closes a graphics window and then reopens it, I get an automatic mouse move event occur. However, under subsequent versions of Windows this event does not occur.

This is actually beneficial to my program so I was wondering if I can get the mouse coordinates using a dll call after reopening the window without having to wait for an actual mouse event?

I should add that my program is closing and reopening the window on a keyboard event.

So the new window might be a different size or location to the first window and I need to know the position of the mouse pointer relative to the new window even though the mouse hasn't moved and triggered an event.

I could derive it automatically from the movement of the window if there is no direct way.
« Last Edit: Feb 9th, 2018, 2:47pm by Monkfish » User IP Logged

tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Mouse event on redraw
« Reply #1 on: Feb 9th, 2018, 5:13pm »

GetCursorPos function ?
User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Mouse event on redraw
« Reply #2 on: Feb 9th, 2018, 5:58pm »

The mouse may not even be inside the window when it opens? Surely the user has to take some action first?
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Mouse event on redraw
« Reply #3 on: Feb 9th, 2018, 7:44pm »

on Feb 9th, 2018, 5:13pm, tsh73 wrote:
GetCursorPos function ?

Yes, GetCursorPos followed by ScreenToClient typically.

Richard.
User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Mouse event on redraw
« Reply #4 on: Feb 10th, 2018, 08:50am »

Code:


    'open a window and graphicbox
    WindowHeight = 300
    WindowWidth = 400
    graphicbox #w.g, 0, 0, 400, 300
    open "test" for window_nf as #w
    print #w, "trapclose [quit]"
    #w.g "setfocus"

    hw = hWnd(#w.g)
    struct MouseRect ,mx as long,my as long
    calldll #user32, "GetCursorPos",MouseRect As struct,re As Long
    calldll #user32, "ScreenToClient",hw As ulong,MouseRect As struct,re as long
    print MouseRect.mx.struct
    print MouseRect.my.struct
    wait


[quit]

    close #w
    end
 
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls