| View previous topic :: View next topic |
| Author |
Message |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Tue Dec 04, 2012 9:45 pm Post subject: Right click on a BitBtn |
|
|
Is there a way I can tell if a bitbtn has been right clicked on? _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 766 Location: Eastman, GA
|
Posted: Wed Dec 05, 2012 12:05 am Post subject: |
|
|
Yes.
| Code: |
DIALOG CREATE,New Dialog,-1,0,240,160
REM *** Modified by Dialog Designer on 12/4/2012 - 16:47 ***
DIALOG ADD,BITBTN,BITBTN1,45,35,,,C:\Users\Brandon\Desktop\Visual DialogScript 5\group1.bmp
DIALOG SHOW
%%mouseover = bitbtn1
gosub mouseover start
:timer
%%mousedown = @MOUSEDOWN(r)
if %%mousedown
gosub Mouseover Check
end
:evloop
if @equal(%%event,bitbtn1mouseover)
goto bitbtn1rclick
end
wait event,0.1
%%eventdialog = @event(d)
parse "%%event;%%dialog",%%eventdialog
if @equal(%%event,timer)
goto timer
end
dialog select,%%dialog
goto %%event
:bitbtn1rclick
info right click
%%event = timer
goto evloop
:bitbtn1button
info left click
goto evloop
:close
exit
:mouseover start
if @null(%%mouseovercreate)
dialog add,list,mouseover,0,0,0,0
%%mouseovercreate = true
end
repeat
parse "%a;%b",%%mouseover
%%remainder = @substr(%%mouseover,@sum(@len(%a),2),@len(%%mouseover))
if %a
list add,mouseover,%a|@winexists(@winexists(~%a))
%%mouseover = %%remainder
end
until @null(%a)
exit
:mouseover check
list seek,mouseover,0
:mouseloop
parse "%a;%b",@item(mouseover)
%%check = @winatpoint(@mousepos(X),@mousepos(Y))
if @equal(%%check,%b)
%%event = %amouseover
%%mouseover = %a
goto mousedone
end
if @equal(@pred(@count(mouseover)),@index(mouseover))
if @null(%%mouseover)
else
%%lastmouseover = %%mouseover
%%mouseover = ""
end
goto mousedone
else
list seek,mouseover,@succ(@index(mouseover))
goto mouseloop
end
:mousedone
if @null(%%mouseover)
if %%lastmouseover
%%event = %%lastmouseover""mouseout
%%lastmouseover = ""
else
%%event = evloop
end
end
exit
|
|
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Wed Dec 05, 2012 12:38 am Post subject: |
|
|
Thanks, I'll have to look at it more as after the first right click when I mouseover the button it generates a click even if I don't click. _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Wed Dec 05, 2012 12:51 am Post subject: |
|
|
Thanks for the head start! I found a bit of an easier way. @mousedown() has a bug in it and doesn't always work.
| Code: |
dialog CREATE,New Dialog,-1,0,240,160
rem *** Modified by Dialog Designer on 12/4/2012 - 16:47 ***
dialog ADD,BITBTN,BITBTN1,45,35,,,@windir()\explorer.exe,,,mouseover
dialog SHOW
:timer
loadlib user32.dll
if @unequal(@LIB(user32,GetAsyncKeyState,INT:,$02),0)
if %%btn
info %%btn
end
end
freelib user32.dll
:evloop
wait event,0.1
%e = @event()
goto %e
:bitbtn1leave
%%btn =
goto evloop
:bitbtn1enter
%%btn = bitbtn1
goto evloop
:bitbtn1button
info left click
goto evloop
:close
exit
|
_________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Wed Dec 05, 2012 2:24 am Post subject: |
|
|
Well, that works but I am using a lot of bitbtn elements and the longer the app runs the slower it gets because of the mouse over event. I'm going to have to find another way. _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 766 Location: Eastman, GA
|
Posted: Wed Dec 05, 2012 3:24 am Post subject: |
|
|
| Quote: | | Well, that works but I am using a lot of bitbtn elements and the longer the app runs the slower it gets because of the mouse over event. I'm going to have to find another way. |
Which way has the memory leak? Yours or mine? I have suggestions on how to have your code OK, but if it's mine I can't help. |
|
| Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 766 Location: Eastman, GA
|
Posted: Wed Dec 05, 2012 3:31 am Post subject: |
|
|
Clean up for your version....should keep program running better over time.
| Code: |
dialog CREATE,New Dialog,-1,0,240,160
rem *** Modified by Dialog Designer on 12/4/2012 - 16:47 ***
dialog ADD,BITBTN,BITBTN1,45,35,,,@windir()\explorer.exe,,,mouseover
dialog SHOW
loadlib user32.dll
loadlib "psapi.dll"
:timer
%t = @lib("psapi.dll","EmptyWorkingSet",INT:,-1)
if @unequal(@LIB(user32,GetAsyncKeyState,INT:,$02),0)
if %%btn
info %%btn
end
end
:evloop
wait event,0.1
%e = @event()
goto %e
:bitbtn1leave
%%btn =
goto evloop
:bitbtn1enter
%%btn = bitbtn1
goto evloop
:bitbtn1button
info left click
goto evloop
:close
freelib user32.dll
freelib "psapi.dll"
exit
|
|
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Wed Dec 05, 2012 2:23 pm Post subject: |
|
|
Good idea. I'll give that a try. Thanks! _________________ Chris
Http://theblindhouse.com |
|
| 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
|
|