Achilles Posted April 11, 2007 Share Posted April 11, 2007 I've created an example script with one button. When you click on the button and release (with the mouse still over the control) it shows that the mouse is hovering over the control (that's all good), however if you press and hold down and then have the mouse leave the area of the control then it shows that it is still hovering even though it is not. One possible way to change this would be to change the 'presslost' part of the code so that it goes back to the normal button when press is lost... However this would create a different problem: If you click on the button and then release (while it's still over the control) it would show that there was no hover. Hopefully I am making my problem clear, please ask if I have not. I have included the example script with pictures and mardaman's two udfs... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Valuater Posted April 11, 2007 Share Posted April 11, 2007 This works... See ButtonHover() #include <_ButtonHover.au3> $XButton_Location = @ScriptDir $Main_GUI_Name = GuiCreate('Test', 140, 110) $picture = _HoverButton("", 30, 30, 80, 50) GuiSetState() While 1 _CheckHoverAndPressed ($Main_GUI_Name) If GUIGetMsg() = -3 Then Exit Wend 8) Link to comment Share on other sites More sharing options...
Achilles Posted April 11, 2007 Author Share Posted April 11, 2007 (edited) This works... See ButtonHover() #include <_ButtonHover.au3> $XButton_Location = @ScriptDir $Main_GUI_Name = GuiCreate('Test', 140, 110) $picture = _HoverButton("", 30, 30, 80, 50) GuiSetState() While 1 _CheckHoverAndPressed ($Main_GUI_Name) If GUIGetMsg() = -3 Then Exit Wend oÝ÷ ÛÏêº^jëh×6#include <_ButtonHover.au3> Global $XButton_Location = @ScriptDir $Main_GUI_Name = GuiCreate('Test', 230, 110) $picture = _HoverButton('', 30, 30, 80, 50) GuiCtrlCreateButton('', 120, 30, 80, 50) GuiSetState() While 1 _CheckHoverAndPressed ($Main_GUI_Name) If GUIGetMsg() = -3 Then Exit Wend I tried this but it has a problem. As you can see I made another button right next to it (in my actual script there are several buttons ...) but if you move fast enough you can end up with the button looking like it's being pressed on when it's not. . *Note, when testing I used the same pictures as above except renamed as 'Normal.bmp', 'Over.bmp' and 'Press.bmp' How it happens: Click on the hover button and hold the mouse down. Move the mouse to the right (so that it crosses the other button) and when the mouse is on the other side of the second button the first button (the hover one) will look like it is being pressed. I've attached a picture with the two buttons looking like they're being pressed... Also, does this support multiple pictures? In one of your examples I noted that you have four buttons but they are all actually the same picture with just different sizes... Edited April 11, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Valuater Posted April 11, 2007 Share Posted April 11, 2007 (edited) I guess if you "really do it fast" it can get caught on another pic... that just may be a limit to computer speed and Autoit, However, if someone is going to try to play with the GUI at that speed or "looking" for problems, I am sure they can find one... also, i don't have one of these new "dual" Intel processors... do you??? .... second question This _ButtonHover() was designed from _ControlHover() and uses "button themes", however, in the thread for _ControlHover() there are examples with different buttons and controls 8) Edited April 11, 2007 by Valuater Link to comment Share on other sites More sharing options...
Achilles Posted April 11, 2007 Author Share Posted April 11, 2007 (edited) I guess if you "really do it fast" it can get caught on another pic... that just may be a limit to computer speed and Autoit, However, if someone is going to try to play with the GUI at that speed or "looking" for problems, I am sure they can find one... also, i don't have one of these new "dual" Intel processors... do you???.... second questionThis _ButtonHover() was designed from _ControlHover() and uses "button themes", however, in the thread for _ControlHover() there are examples with different buttons and controls8)I think I'm going have it so that it records which button has had it's imaged changed then when a new image gets hovered over it will change the old one and then change the new one and finally record the one just changed as the last changed. Hope that made sense... And no.. unfortunately I couldn't convince my parents to buy the computer with a dual processor, but this one is still pretty good... I've used your _ButtonHover() for this script and switched to marfdaman's because I could end up with all 5 buttons on the screen being pushed with yours. But now I'm not sure, I suppose I could fix either way: I could make the change I suggested above with yours or I could change mardaman's so that every time press is lost it checks for hover again... Whatever, I'll do both! Edited April 11, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Achilles Posted April 12, 2007 Author Share Posted April 12, 2007 Piano_Man:Hi.Since you had problems with Valuater's and marfdaman's scripts, I think you'd have to post this question in one of their threads, to follow things in an easier way. Well, no big dealTry attachedalc Posting in their threads would of probably been a good idea... SWEET! This works perfectly! Thanks My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Valuater Posted April 12, 2007 Share Posted April 12, 2007 Guess there is a price to pay in all directions.... The script by alc uses 25% CPU ( 18 to 30 averaged ) I tried using a larger number for the adlib and lost functionality 8) Link to comment Share on other sites More sharing options...
Achilles Posted April 13, 2007 Author Share Posted April 13, 2007 Guess there is a price to pay in all directions.... The script by alc uses 25% CPU ( 18 to 30 averaged )I tried using a larger number for the adlib and lost functionality8)That's strange, I only got 3-10%... what's your processor speed? I have a 3 ghtz single core processor which is pretty descent but not outstanding... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now