View previous topic :: View next topic |
Author |
Message |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Tue Sep 16, 2003 12:46 pm Post subject: @MousePos() |
|
|
Ok, Big bug here (I think)
@MousePos() - looks like it is returning the coords rel. to the current dialog.
Check it out...
Code: |
DIALOG CREATE,New Dialog,10,10,181,135
DIALOG ADD,TEXT,TEXT1,8,8,26,12,TEXT1
DIALOG ADD,TEXT,TEXT2,26,7,26,12,TEXT2
DIALOG ADD,BUTTON,BUTTON1,51,3,170,24,"Shows Wrong (But Should be right)"
DIALOG ADD,BUTTON,BUTTON2,83,5,170,24,"Shows Right (But should be wrong)"
DIALOG SHOW
:evloop
wait event,0
%e = @event()
goto %e
:timer
dialog set,text1,X=@mousepos(X)
dialog set,text2,Y=@mousepos(Y)
goto evloop
:Button1Button
dialog Popup,Item1|Item2|Item3,@mousepos(X),@mousepos(Y)
goto evloop
:button2button
dialog Popup,Item1|Item2|Item3,@diff(@mousepos(X),@sysinfo(screenwidth)),@diff(@mousepos(X),@sysinfo(screenwidth))
# dialog Popup,Item1|Item2|Item3,@mousepos(Y),@mousepos(X)
goto evloop
:close
|
_________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1562
|
Posted: Wed Sep 17, 2003 2:15 am Post subject: |
|
|
The same is happening for me, this is really strange. It looks like it reports correct values when no dialog is present? |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Wed Sep 17, 2003 2:51 am Post subject: |
|
|
Ok, good. I'm not mad. This is a real problem. _________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Wed Sep 17, 2003 2:37 pm Post subject: |
|
|
PGWARE wrote: | The same is happening for me, this is really strange. It looks like it reports correct values when no dialog is present? |
Yes I think this is there in VDS 4.x too
Just move the dialog the popup menu starts shifting by the amount the dialog is moved !
And it goes on capturing other windows on the way.
I was driven crazy once and I thought I am nuts and used GetCursorPos API instead. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Wed Sep 17, 2003 4:52 pm Post subject: |
|
|
Changing the behavior of this function is likely to break anything that works with it the way it is, such as the Dialog Designer, which the folks at CR won't thank me for. Especially if it's been this way since VDS 4, we'll probably have to live with it as it is. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Wed Sep 17, 2003 5:15 pm Post subject: |
|
|
Just looked at this and @mousepos() just calls the GetCursorPos API function. So why it should return the co-ordinates relative to the dialog is a complete mystery to me. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Wed Sep 17, 2003 6:06 pm Post subject: |
|
|
As you can see by trying this script (VDS 3, 4, 5), @mousepos() is still working pretty
much okay:
Code: | option decimalsep,.
option fieldsep,|
DIALOG CREATE,Cursor Position,-1,0,193,69
DIALOG ADD,TEXT,tX,8,8,,,"X (left) position:"
DIALOG ADD,TEXT,tY,32,8,,,"Y (top) position:"
DIALOG ADD,TEXT,tXp,8,104,,,???
DIALOG ADD,TEXT,tYp,32,104,,,???
DIALOG SHOW
:timer
parse "tXp;tYp",@mousepos(xy)
:evloop
wait event,0.1
goto @event()
:close |
Rather the DIALOG POPUP command expects coordinates relative to the dialog's upper
left corner, but this has always been like this at least since VDS 3, so I do not think this
should be changed.
So I think the code attached to the "Shows Right (But should be wrong)" should indeed
be the way to go. Your script contains a few mistakes though, corrected here:
Code: | DIALOG CREATE,New Dialog,10,10,181,135
DIALOG ADD,TEXT,TEXT1,8,8,26,12,TEXT1
DIALOG ADD,TEXT,TEXT2,26,7,26,12,TEXT2
DIALOG ADD,BUTTON,BUTTON1,51,3,170,24,"Shows Wrong (But Should be right)"
DIALOG ADD,BUTTON,BUTTON2,83,5,170,24,"Shows Right (But should be wrong)"
DIALOG SHOW
:evloop
wait event,0
%e = @event()
goto %e
:timer
dialog set,text1,X=@mousepos(X)
dialog set,text2,Y=@mousepos(Y)
goto evloop
:Button1Button
dialog Popup,Item1|Item2|Item3,@mousepos(Y),@mousepos(X)
goto evloop
:button2button
dialog Popup,Item1|Item2|Item3,@diff(@mousepos(Y),@dlgpos(,T)),@diff(@mousepos(X),@dlgpos(,L))
# dialog Popup,Item1|Item2|Item3,@mousepos(Y),@mousepos(X)
goto evloop
:close |
Still it is not working well exactly as it is using the dialog coordinates rather than the
dialog client area's coordinates which the DIALOG POPUP command seems to be
expecting the supplied coordinates to be relative to. |
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Wed Sep 17, 2003 6:49 pm Post subject: |
|
|
Tommy Your example works OK but LiquidCode's example you corrected still does not work and certainly shows the same unexpected behaviour including the menu postion shift caused by moving the dialog.. I am confused Some thing to with OS ??? _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Thu Sep 18, 2003 8:43 am Post subject: |
|
|
Quote: | Still it is not working well exactly as it is using the dialog coordinates rather than the dialog client area's coordinates which the DIALOG POPUP command seems to be expecting the supplied coordinates to be relative to. |
Yes, the code relativizes the X,Y co-ordinates to the dialog client area although there still appears to be a bug as it looks as if the X and Y values are reversed. I'm informed the release of the update will be at least a week away so there is time to get this issue fixed, but at the moment I'm unclear what to do. Should it be left as it is, left as it is but with the X and Y swapped back, or made to use screen co-ordinates as the help file says? _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Thu Sep 18, 2003 11:02 am Post subject: |
|
|
personally, I like the screen coords. as the help file says. _________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Sep 18, 2003 4:56 pm Post subject: |
|
|
I think I go with LiquidCode as for screen coords(makes more sense I think) X and Y may be left probably with a note in the help file.
But will it not break Dialog Designer ?? I don't know if it uses this. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1562
|
Posted: Thu Sep 18, 2003 5:27 pm Post subject: |
|
|
How about adding an extra parameter for @mousepos(XY,S) S telling it to use system wide values rather then localized. This way it doesn't break any previous programs and new programs can use the new param for system wide screen values |
|
Back to top |
|
|
LOBO Valued Contributor
Joined: 14 Mar 2002 Posts: 241 Location: Wilmington, Delaware, USA
|
Posted: Thu Sep 18, 2003 5:38 pm Post subject: |
|
|
PGWARE wrote: | How about adding an extra parameter for @mousepos(XY,S) S telling it to use system wide values rather then localized. This way it doesn't break any previous programs and new programs can use the new param for system wide screen values |
I think Prakash's suggestion would be the best way to go if it is possible to add into the update.
- Mark |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Sep 18, 2003 6:49 pm Post subject: |
|
|
Me too. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|