Valuater Posted November 20, 2006 Author Share Posted November 20, 2006 Nice Job... and Dandy..lol 8) Link to comment Share on other sites More sharing options...
clearguy Posted November 26, 2006 Share Posted November 26, 2006 Hey all, here is my example script: 2.) This one is my example of being able to move the controls around (only the label moves as of now): UPDATED: The new example lets you move any of the three controls, and right clicking allows you to rename them. expandcollapse popup#include<GuiConstants.au3> #include<ControlHover.au3> Opt("MouseCoordMode", 2) $Main_GUI = GuiCreate("DanGui", 400, 250) $MoveMe = GuiCtrlCreateLabel("Move Me (Test)", 150, 70, 80, 20) $OK_BUT = GuiCtrlCreateButton("OK", 70, 160, 80, 20) $CANCEL_BUT = GuiCtrlCreateButton("CANCEL", 220, 160, 90, 20) $Move_But = GUICtrlCreateButton("Unlock Controls", 150, 220) $Allow_Move = 0 _ControlHover(2, "", $MoveMe) _ControlHover(2, "", $OK_BUT) _ControlHover(2, "", $CANCEL_BUT) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $OK_BUT If $Allow_Move = 0 Then MsgBox(0, "Title", "This button still works!") EndIf Case $msg = $CANCEL_BUT If $Allow_Move = 0 Then MsgBox(0, "Title", "This button still works!") EndIf Case $msg = $Move_But If $Allow_Move = 0 Then GUICtrlSetData(6, "Lock Controls") $Allow_Move = 1 ElseIf $Allow_Move = 1 Then GUICtrlSetData(6, "Unlock Controls") $Allow_Move = 0 EndIf Case $msg = $GUI_EVENT_CLOSE Exit EndSelect ;If moving is enabled If $Allow_Move = 1 Then ;Check for a Hover $Over = _ControlHover(0, $Main_GUI) If $Over = 1 Then If @extended = $MoveMe Then GUICtrlSetBkColor(3, 0xFF0000) Else GUICtrlSetBkColor(3, 0xECE9D8) EndIf If @extended = $OK_BUT Then GUICtrlSetColor(4, 0xFF0000) Else GUICtrlSetColor(4, 0xECE9D8) EndIf EndIf ;Check for a Click $Click = _ControlHover(1, $Main_GUI) If $Click = 1 Then Select Case @extended = $MoveMe MoveControl(3) Case @extended = $OK_BUT MoveControl(4) Case @extended = $CANCEL_BUT MoveControl(5) EndSelect EndIf $Check_Click = GUIGetCursorInfo() Select Case $Check_Click[4] = 3 And $Check_Click[3] = 1 Text_Change(3) Case $Check_Click[4] = 4 And $Check_Click[3] = 1 Text_Change(4) Case $Check_Click[4] = 5 And $Check_Click[3] = 1 Text_Change(5) EndSelect EndIf WEnd ;Text_Change ==> To rename a control in "Unlocked" mode when it is right-clicked on. Func Text_Change($IDtoRename) $New_Name = InputBox("Label Change", "Input new text for this label:") If $New_Name = "" Then MsgBox(0, "ERROR!", "The entered text was invalid. No changes have been made.") Else GUICtrlSetData($IDtoRename, $New_Name) EndIf EndFunc ;MoveControl ==> When a control is clicked on in "Unlocked" mode. Func MoveControl($IDtoMove) Do $Check_Click = GUIGetCursorInfo() $mousepos = MouseGetPos() GUICtrlSetPos($IDtoMove, $mousepos[0] - 40, $mousepos[1] - 10) Sleep(20) Until $Check_Click[2] = 0 EndFunc Enjoy! I hope Val get's a sticky for this . I love your script! I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
Valuater Posted December 24, 2006 Author Share Posted December 24, 2006 I love your script! I really think this could help alot of peoples scripts...again, nice job Dandyand thanks for the post clearguy8) Link to comment Share on other sites More sharing options...
fisofo Posted December 30, 2006 Share Posted December 30, 2006 Has anyone gotten this to work with GUIONEventMode where an event fires when someone hovers, etc...? I'll post if I can figure it out Link to comment Share on other sites More sharing options...
clearguy Posted December 31, 2006 Share Posted December 31, 2006 Has anyone gotten this to work with GUIONEventMode where an event fires when someone hovers, etc...?I'll post if I can figure it out I think it must first be integrated in the au3 EXE file to use it, I tryed quiet all possibilities with GUIOnEventMode with no result lol.IMO you should better try to use it with the MessageLoop Mode since it doesn't work with GUIOnEventMode . I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
fisofo Posted December 31, 2006 Share Posted December 31, 2006 Yeah, I finally just converted my code to a msg loop.... oh well But now I've got another issue... When I have a program run on a "isReleased" event, the button does not go back to it's normal state! It's like ControlHover just stops responding for that button until I do something with another button?!? If I remove the program from running, then everything works fine... but of course, that kind of defeats the purpose Anyway, i've attached the code with my buttons that i've worked so hard to create... anyone want to take a stab at getting this to work? See any obvious errors? I've used a ton of different configurations from the different demo's posted, but they all seem to have the same issue, so i'm guessing it is something inherent to _ControlHover. thanks! Link to comment Share on other sites More sharing options...
Valuater Posted December 31, 2006 Author Share Posted December 31, 2006 Very nice.... you just have one small issue with the wrong letter in the command replace Func _ButtonReleased($ControlID) _ParseRun($ControlID, "H") with Func _ButtonReleased($ControlID) _ParseRun($ControlID, "N") The "N" worked for me 8) Link to comment Share on other sites More sharing options...
fisofo Posted December 31, 2006 Share Posted December 31, 2006 Very nice....you just have one small issue with the wrong letter in the commandreplaceFunc _ButtonReleased($ControlID) _ParseRun($ControlID, "H")withFunc _ButtonReleased($ControlID) _ParseRun($ControlID, "N")The "N" worked for me8)Thanks for the quick reply! That does seem to "reset" it for me... but it looks like it is exhibiting some odd behavior still. Upon clicking the "Show Desktop" button, none of the buttons respond to my mouse movement (aka Hover events) until I click something new with the mouse. Perhaps I can force some sort of reset in the GUI to get it responding again?Does it do that to you too when you test? Link to comment Share on other sites More sharing options...
Valuater Posted December 31, 2006 Author Share Posted December 31, 2006 (edited) Yes... _ControlHover only works if it is the active window, and was deigned that way... The reason is, if it is not active and you click on another window but your gui is underneath, the click would be activated and cause problems... to simply fix your problem, just place this code Case $_ShowDesktop ShowDesktop() WinActivate($_GUI) 8) Edited December 31, 2006 by Valuater Link to comment Share on other sites More sharing options...
fisofo Posted December 31, 2006 Share Posted December 31, 2006 Yes..._ControlHover only works if it is the active window, and was deigned that way...The reason is, if it is not active and you click on another window but your gui is underneath, the click would be activated and cause problems...to simply fix your problem, just place this codeCase $_ShowDesktop ShowDesktop() WinActivate($_GUI)8)That's it!!! Geez, go figure it was an easy fix Thanks Valuater, I'll be sure to link to this topic once I post the final script I'm making. ControlHover aught to get added as an official UDF. Link to comment Share on other sites More sharing options...
Valuater Posted January 1, 2007 Author Share Posted January 1, 2007 _ButonHover() made from _ControlHover()is an easy way to have theme buttons ....and a demo for on-event-modehttp://www.autoitscript.com/forum/index.ph...st&p=2884288) Link to comment Share on other sites More sharing options...
fisofo Posted January 13, 2007 Share Posted January 13, 2007 Hey Val, I'm just curious, do you think using Larry's "WindowFromPoint" stuff would make your _ControlHover any faster... or even make it possible for Hover to be detected if the GUI is NOT the active window?I've been playing around with it in a few scripts and it seems pretty quick, but I'm still working on understanding his example. Link to comment Share on other sites More sharing options...
Valuater Posted January 14, 2007 Author Share Posted January 14, 2007 Hey Val, I'm just curious, do you think using Larry's "WindowFromPoint" stuff would make your _ControlHover any faster... or even make it possible for Hover to be detected if the GUI is NOT the active window?I've been playing around with it in a few scripts and it seems pretty quick, but I'm still working on understanding his example.let me know what you find... so far, i don't see any advantage to implementing this to _ControlHover()for sure i am having problems with the script from Larry recognizing a control on a tab8) Link to comment Share on other sites More sharing options...
Shevilie Posted May 14, 2007 Share Posted May 14, 2007 Trolling for UDF list Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
marian001 Posted July 9, 2009 Share Posted July 9, 2009 This doesn't work with Menu Items, does it? Link to comment Share on other sites More sharing options...
Valuater Posted July 10, 2009 Author Share Posted July 10, 2009 This doesn't work with Menu Items, does it?Nope!!8) Link to comment Share on other sites More sharing options...
bo8ster Posted July 10, 2009 Share Posted July 10, 2009 I like the UDF Valuater. I have created one that gets the Control Info under the mouse here http://www.autoitscript.com/forum/index.php?showtopic=93527. Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
diferent Posted July 11, 2009 Share Posted July 11, 2009 Great UDF!!! Make an example changing a label text, msgbox stop the script. Link to comment Share on other sites More sharing options...
Ashalshaikh Posted July 13, 2009 Share Posted July 13, 2009 Thank You Nice ... Link to comment Share on other sites More sharing options...
Valuater Posted July 13, 2009 Author Share Posted July 13, 2009 THANKS GUYS!!! 3 compliments in a row and NO complaints!!!! ... Can I get a Mod to lock this thread now!!!...??? 8) 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