forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


@MOUSEDOWN() Bug

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Aug 06, 2003 7:46 pm    Post subject: @MOUSEDOWN() Bug Reply with quote

This doesn't work the way it should.

Code:
  DIALOG CREATE,Window,-1,0,180,251,INVISIBLE,ONTOP,CLASS TWin
  DIALOG ADD,BITMAP,BMP,0,0,180,251,#test.bmp,,INVISIBLE,CLICK
  DIALOG SHOW
:Evloop
wait event
goto @event()
  :BMPCLICK
if @mousedown(L)
  %X = @diff(@mousepos(X),@winpos(#TWin,L))
  %Y = @diff(@mousepos(Y),@winpos(#TWin,T))
  while @mousedown(L)   
     %%X2 = @diff(@mousepos(X),%X)
    %%Y2 = @diff(@mousepos(Y),%Y)
    if @greater(0,%%X2)
      %%X2 = 0
     end
    if @greater(0,%%Y2)
      %%Y2 = 0
     end
    window position,#TWin,%%Y2,%%X2
  wend
end
if @mousedown(m)
info Middle
end
if @mousedown(r)
info Right
end
goto evloop

_________________
FreezingFire
VDSWORLD.com
Site Admin Team


Last edited by FreezingFire on Wed Aug 06, 2003 8:25 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Wed Aug 06, 2003 8:03 pm    Post subject: Reply with quote

No it doesn't work. I tried to say that before but got blown off (i don't think on purpose). The same problem exists in VDS 4. I think it is a bug. Sad
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Aug 06, 2003 8:24 pm    Post subject: Reply with quote

I moved this to the bug reports section because I think you're right, this
is a bug. Smile

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Aug 06, 2003 8:33 pm    Post subject: Reply with quote

Actually the same thing can be achieved using the following code:

Code:
if @equal(@click(b),RIGHT)
dialog popup,Settings|Close
end
goto evloop

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Thu Aug 07, 2003 7:31 am    Post subject: Reply with quote

I don't think this is a bug. Instead it is the way @mousedown function has been designed just like GetAsyncKeyState (refer W32HLP) rather than GetKeyState. So the mousebutton state relative to the last active state "on the dialog" is compared(non global key state checking). I think all this is done to compensate for the abscence of its evil brother "@MOUSEUP". So to use @mousedown as above you would need :
1.A timer loop.
2. If you are branching out of the event thread by calling a dialog box etc then you need to do a dummy cycling calling the @mousedown -> showing/hiding something on the dialog (to show to the function that the mouse button has been released) and show the info/dialog only when all the mouse buttons are released.
I have put a code based on the above thinking and I think it should work; although on slow computers some @mousedown events may be lost in que especially in IDE.
I do agree an additional @mouseup and global option for the functions would be nice and it may be put forth as a feature request.
One can use API to achieve a more reliable result in VDS 5 as i used them in some examples.(and also FreezingFire your alternative as in this case).
My 2 cents !
Correct me if i am wrong.
Code:

DIALOG CREATE,Window,-1,0,180,251,INVISIBLE,ONTOP,CLASS TWin
  DIALOG ADD,BITMAP,BMP,0,0,180,251,test.bmp,,INVISIBLE,CLICK
  DIALOG SHOW
:Evloop
wait "0.001",event
goto @event()


:BMPCLICK
  %X = @diff(@mousepos(X),@winpos(#TWin,L))
  %Y = @diff(@mousepos(Y),@winpos(#TWin,T))
  while @mousedown(L)   
     %%X2 = @diff(@mousepos(X),%X)
    %%Y2 = @diff(@mousepos(Y),%Y)
    if @greater(0,%%X2)
      %%X2 = 0
     end
    if @greater(0,%%Y2)
      %%Y2 = 0
     end
    window position,#TWin,%%Y2,%%X2
   gosub infos
  wend
end


:TIMER
gosub infos
Goto EVLOOP

:infos
if @mousedown(L)
 dialog show,bmp
 %L = 1
 else
 %L = 0
 end
if @mousedown(m)
 dialog show,bmp
 %M = 1
 else
 %m = 0
 end
if @mousedown(r)
 dialog show,bmp
 %R = 1
 else
 %R = 0
end
REPEAT
%a = @mousedown(l)
dialog show,bmp
%b = @mousedown(m)
dialog show,bmp
%c = @mousedown(r)
dialog show,bmp
UNTIL @NULL(%A%B%C)
IF @NOT(@ZERO(@SUM(%L,%M,%R)))
    INFO %L|%m|%R!
END
exit

:CLOSE
EXIT

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
sieber
Newbie


Joined: 01 Jul 2003
Posts: 13
Location: Germany

PostPosted: Thu Aug 07, 2003 2:53 pm    Post subject: Reply with quote

Hello,

I already had posted problems with the mousedown function to this forum (VDS 5 @mousedown() bug! ) and also to SADE (VDS 4.x Year 2001) and to the new company (VDS 5) -> I never heard an answer from SADE or from the new one.

A simple trick is to use the DLL from Tommy Sools -> vdskey.dll and use the function @keyboard(rbutton)

Jochen
Back to top
View user's profile Send private message
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Thu Aug 07, 2003 4:44 pm    Post subject: Reply with quote

sieber did you try the above script. I think it never gives a wrong response especially compiled it seems Confused But the function looks clumsy as it is now .
Regards

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
sieber
Newbie


Joined: 01 Jul 2003
Posts: 13
Location: Germany

PostPosted: Fri Aug 08, 2003 7:12 am    Post subject: Reply with quote

Yes this will work for my little testprogram, but I think this is not a real solution. Maybe we get a better function by the next release, update or patch.

Jochen
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Mon Aug 11, 2003 11:16 am    Post subject: Reply with quote

Quote:
Yes this will work for my little testprogram, but I think this is not a real solution. Maybe we get a better function by the next release, update or patch.


VDS never recorded the state of any mouse button pressed for list elements. The click events can be generated by moving the selection with the keyboard, as well as the mouse.

The update will include a fix that @mouse() will return RIGHT if the right mouse button is pressed, but for some reason probably due to the way the Delphi VCL is written it doesn't seem to be possible to obtain the values LEFT or CENTER in the list click event handler.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
sieber
Newbie


Joined: 01 Jul 2003
Posts: 13
Location: Germany

PostPosted: Mon Aug 11, 2003 11:39 am    Post subject: Reply with quote

This sounds great.

The only thing what I want is:

Press the right Mousebutton on an ListControl -> bring up an Popupmenu (for example „Copy, Paste, and so on“)

This are very interesting for the new „multi list“ control
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Mon Aug 11, 2003 12:28 pm    Post subject: Reply with quote

jules wrote:
The update will include a fix ...


Heeeeyyyy, when are we gonna have our fix Question Wink

Dr. Junkie

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group