dufran3 Posted April 9, 2007 Author Share Posted April 9, 2007 I started to change the names like you suggested...however, won't that completely screw up my while loop? If $Start = $Tab1Start and so on...with $Tab1Start through $Tab4 start. My entire while loop will be all shot. I am just finishing for the day. I will come in bright and early tomorrow and see what I can come up with. It looks like the while loops just for getting mouseover on the buttons will be 100 + lines of code, as I will have to account for each variable, $Tab1- $Tab4, with each button, $start, $select, $deselect, $exit. I will have to 4 "checks" per Tab....yikes! Anyway, I will see what my brain can come up with after some rest. Link to comment Share on other sites More sharing options...
dufran3 Posted April 10, 2007 Author Share Posted April 10, 2007 Yes, I was thinking correctly last night. If I change the variable that is assigned to each of the buttons, 4 buttons for each tab, 5 tabs. that is a lot of If's. Below is the original While Loop, and below it, is what I think the While loop will have to look like. expandcollapse popupWhile 1 AutoItSetOption("MouseCoordMode",0) $pos = MouseGetPos() $1 = ControlGetPos($Main,"", $Start) $nMsg = GUIGetMsg() GUISetState(@SW_SHOW) If $nMsg = $GUI_EVENT_CLOSE Then Exit EndIf $Over = _ControlHover(0, $Main) If $Over = 1 Then $tempID = @extended If $tempID = $Select Then GUICtrlSetImage($Select,$ButtonLocation & 'select_over.jpg') Else GUICtrlSetimage($Select,$ButtonLocation & 'select_normal.jpg') EndIf If $tempID = $Start Then GUICtrlSetImage($Start,$ButtonLocation & 'start_over.jpg') Else GUICtrlSetimage($Start,$ButtonLocation & 'start_normal.jpg') EndIf If $tempID = $Deselect Then GUICtrlSetImage($Deselect ,$ButtonLocation & 'deselect_over.jpg') Else GUICtrlSetimage($Deselect ,$ButtonLocation & 'deselect_normal.jpg') EndIf If $tempID = $Exit Then GUICtrlSetImage($Exit ,$ButtonLocation & 'exit_over.jpg') Else GUICtrlSetimage($Exit ,$ButtonLocation & 'exit_normal.jpg') EndIf EndIf $Click = _ControlHover(1, $Main) If $Click = 1 And @extended = $Start Then GUICtrlSetImage($Start,$ButtonLocation & 'start_press.jpg') Install() Sleep(138) If $tempID = $Start Then GUICtrlSetImage($Start,$ButtonLocation & 'start_normal.jpg') Else GUICtrlSetimage($Start,$ButtonLocation & 'start_over.jpg') EndIf EndIf If $Click = 1 And @extended = $Select Then GUICtrlSetImage($Select,$ButtonLocation & 'select_press.jpg') _SelectAll() Sleep(138) If $tempID = $Select Then GUICtrlSetImage($Select,$ButtonLocation & 'select_normal.jpg') Else GUICtrlSetimage($Select,$ButtonLocation & 'select_over.jpg') EndIf EndIf If $Click = 1 And @extended = $Deselect Then GUICtrlSetImage($Deselect,$ButtonLocation & 'deselect_press.jpg') _DeselectAll() Sleep(138) If $tempID = $Deselect Then GUICtrlSetImage($Deselect,$ButtonLocation & 'deselect_normal.jpg') Else GUICtrlSetimage($Deselect,$ButtonLocation & 'deselect_over.jpg') EndIf EndIf If $Click = 1 And @extended = $Exit Then GUICtrlSetImage($Exit,$ButtonLocation & 'exit_press.jpg') Exitier() Sleep(138) If $tempID = $Exit Then GUICtrlSetImage($Exit,$ButtonLocation & 'exit_normal.jpg') Else GUICtrlSetimage($Exit,$ButtonLocation & 'exit_over.jpg') EndIf EndIf WEndoÝ÷ ØÚ0ò!j÷÷Þéínëm¢yÚ붧+pYe¢&¢·¥G+Â)eë-b+a{Mú:÷« I know the second piece isn't complete, but I just showed the first 2 tabs in the "hover" section of the loop. Will I really have to do it this way? Link to comment Share on other sites More sharing options...
dufran3 Posted April 10, 2007 Author Share Posted April 10, 2007 Well...here it is in all it's glory, you were right of course. now that each button has a different name, the hover is showing up on them all, however, it is damn slow! Probably because this while loop is a freaking nightmare. There has to be a better, shorter way of doing what I'm doing below. expandcollapse popupWhile 1 AutoItSetOption("MouseCoordMode",0) $pos = MouseGetPos() $1 = ControlGetPos($Main,"", $ClinicalStart) $nMsg = GUIGetMsg() GUISetState(@SW_SHOW) If $nMsg = $GUI_EVENT_CLOSE Then Exit EndIf $Over = _ControlHover(0, $Main) If $Over = 1 Then $tempID = @extended If $tempID = $ClinicalSelect Then GUICtrlSetImage($ClinicalSelect,$ButtonLocation & 'select_over.jpg') Else GUICtrlSetimage($ClinicalSelect,$ButtonLocation & 'select_normal.jpg') EndIf If $tempID = $ClinicalStart Then GUICtrlSetImage($ClinicalStart,$ButtonLocation & 'start_over.jpg') Else GUICtrlSetimage($ClinicalStart,$ButtonLocation & 'start_normal.jpg') EndIf If $tempID = $ClinicalDeselect Then GUICtrlSetImage($ClinicalDeselect ,$ButtonLocation & 'deselect_over.jpg') Else GUICtrlSetimage($ClinicalDeselect ,$ButtonLocation & 'deselect_normal.jpg') EndIf If $tempID = $ClinicalExit Then GUICtrlSetImage($ClinicalExit ,$ButtonLocation & 'exit_over.jpg') Else GUICtrlSetimage($ClinicalExit ,$ButtonLocation & 'exit_normal.jpg') EndIf If $tempID = $DesktopSelect Then GUICtrlSetImage($DesktopSelect,$ButtonLocation & 'select_over.jpg') Else GUICtrlSetimage($DesktopSelect,$ButtonLocation & 'select_normal.jpg') EndIf If $tempID = $DesktopStart Then GUICtrlSetImage($DesktopStart,$ButtonLocation & 'start_over.jpg') Else GUICtrlSetimage($DesktopStart,$ButtonLocation & 'start_normal.jpg') EndIf If $tempID = $DesktopDeselect Then GUICtrlSetImage($DesktopDeselect ,$ButtonLocation & 'deselect_over.jpg') Else GUICtrlSetimage($DesktopDeselect ,$ButtonLocation & 'deselect_normal.jpg') EndIf If $tempID = $DesktopExit Then GUICtrlSetImage($DesktopExit ,$ButtonLocation & 'exit_over.jpg') Else GUICtrlSetimage($DesktopExit ,$ButtonLocation & 'exit_normal.jpg') EndIf If $tempID = $SettingsSelect Then GUICtrlSetImage($SettingsSelect,$ButtonLocation & 'select_over.jpg') Else GUICtrlSetimage($SettingsSelect,$ButtonLocation & 'select_normal.jpg') EndIf If $tempID = $SettingsStart Then GUICtrlSetImage($SettingsStart,$ButtonLocation & 'start_over.jpg') Else GUICtrlSetimage($SettingsStart,$ButtonLocation & 'start_normal.jpg') EndIf If $tempID = $SettingsDeselect Then GUICtrlSetImage($SettingsDeselect ,$ButtonLocation & 'deselect_over.jpg') Else GUICtrlSetimage($SettingsDeselect ,$ButtonLocation & 'deselect_normal.jpg') EndIf If $tempID = $SettingsExit Then GUICtrlSetImage($SettingsExit ,$ButtonLocation & 'exit_over.jpg') Else GUICtrlSetimage($SettingsExit ,$ButtonLocation & 'exit_normal.jpg') EndIf If $tempID = $ShortcutsSelect Then GUICtrlSetImage($ShortcutsSelect,$ButtonLocation & 'select_over.jpg') Else GUICtrlSetimage($ShortcutsSelect,$ButtonLocation & 'select_normal.jpg') EndIf If $tempID = $ShortcutsStart Then GUICtrlSetImage($ShortcutsStart,$ButtonLocation & 'start_over.jpg') Else GUICtrlSetimage($ShortcutsStart,$ButtonLocation & 'start_normal.jpg') EndIf If $tempID = $ShortcutsDeselect Then GUICtrlSetImage($ShortcutsDeselect ,$ButtonLocation & 'deselect_over.jpg') Else GUICtrlSetimage($ShortcutsDeselect ,$ButtonLocation & 'deselect_normal.jpg') EndIf If $tempID = $ShortcutsExit Then GUICtrlSetImage($ShortcutsExit ,$ButtonLocation & 'exit_over.jpg') Else GUICtrlSetimage($ShortcutsExit ,$ButtonLocation & 'exit_normal.jpg') EndIf If $tempID = $OtherSelect Then GUICtrlSetImage($OtherSelect,$ButtonLocation & 'select_over.jpg') Else GUICtrlSetimage($OtherSelect,$ButtonLocation & 'select_normal.jpg') EndIf If $tempID = $OtherStart Then GUICtrlSetImage($OtherStart,$ButtonLocation & 'start_over.jpg') Else GUICtrlSetimage($OtherStart,$ButtonLocation & 'start_normal.jpg') EndIf If $tempID = $OtherDeselect Then GUICtrlSetImage($OtherDeselect ,$ButtonLocation & 'deselect_over.jpg') Else GUICtrlSetimage($OtherDeselect ,$ButtonLocation & 'deselect_normal.jpg') EndIf If $tempID = $OtherExit Then GUICtrlSetImage($OtherExit ,$ButtonLocation & 'exit_over.jpg') Else GUICtrlSetimage($OtherExit ,$ButtonLocation & 'exit_normal.jpg') EndIf EndIf $Click = _ControlHover(1, $Main) If $Click = 1 And @extended = $ClinicalStart Then GUICtrlSetImage($ClinicalStart,$ButtonLocation & 'start_press.jpg') Install() Sleep(138) If $tempID = $ClinicalStart Then GUICtrlSetImage($ClinicalStart,$ButtonLocation & 'start_normal.jpg') Else GUICtrlSetimage($ClinicalStart,$ButtonLocation & 'start_over.jpg') EndIf EndIf If $Click = 1 And @extended = $ClinicalSelect Then GUICtrlSetImage($ClinicalSelect,$ButtonLocation & 'select_press.jpg') _SelectAll() Sleep(138) If $tempID = $ClinicalSelect Then GUICtrlSetImage($ClinicalSelect,$ButtonLocation & 'select_normal.jpg') Else GUICtrlSetimage($ClinicalSelect,$ButtonLocation & 'select_over.jpg') EndIf EndIf If $Click = 1 And @extended = $ClinicalDeselect Then GUICtrlSetImage($ClinicalDeselect,$ButtonLocation & 'deselect_press.jpg') _DeselectAll() Sleep(138) If $tempID = $ClinicalDeselect Then GUICtrlSetImage($ClinicalDeselect,$ButtonLocation & 'deselect_normal.jpg') Else GUICtrlSetimage($ClinicalDeselect,$ButtonLocation & 'deselect_over.jpg') EndIf EndIf If $Click = 1 And @extended = $ClinicalExit Then GUICtrlSetImage($ClinicalExit,$ButtonLocation & 'exit_press.jpg') Exitier() Sleep(138) If $tempID = $ClinicalExit Then GUICtrlSetImage($ClinicalExit,$ButtonLocation & 'exit_normal.jpg') Else GUICtrlSetimage($ClinicalExit,$ButtonLocation & 'exit_over.jpg') EndIf EndIf If $Click = 1 And @extended = $DesktopStart Then GUICtrlSetImage($DesktopStart,$ButtonLocation & 'start_press.jpg') Install() Sleep(138) If $tempID = $DesktopStart Then GUICtrlSetImage($DesktopStart,$ButtonLocation & 'start_normal.jpg') Else GUICtrlSetimage($DesktopStart,$ButtonLocation & 'start_over.jpg') EndIf EndIf If $Click = 1 And @extended = $DesktopSelect Then GUICtrlSetImage($DesktopSelect,$ButtonLocation & 'select_press.jpg') _SelectAll() Sleep(138) If $tempID = $DesktopSelect Then GUICtrlSetImage($DesktopSelect,$ButtonLocation & 'select_normal.jpg') Else GUICtrlSetimage($DesktopSelect,$ButtonLocation & 'select_over.jpg') EndIf EndIf If $Click = 1 And @extended = $DesktopDeselect Then GUICtrlSetImage($DesktopDeselect,$ButtonLocation & 'deselect_press.jpg') _DeselectAll() Sleep(138) If $tempID = $DesktopDeselect Then GUICtrlSetImage($DesktopDeselect,$ButtonLocation & 'deselect_normal.jpg') Else GUICtrlSetimage($DesktopDeselect,$ButtonLocation & 'deselect_over.jpg') EndIf EndIf If $Click = 1 And @extended = $DesktopExit Then GUICtrlSetImage($DesktopExit,$ButtonLocation & 'exit_press.jpg') Exitier() Sleep(138) If $tempID = $DesktopExit Then GUICtrlSetImage($DesktopExit,$ButtonLocation & 'exit_normal.jpg') Else GUICtrlSetimage($DesktopExit,$ButtonLocation & 'exit_over.jpg') EndIf EndIf If $Click = 1 And @extended = $SettingsStart Then GUICtrlSetImage($SettingsStart,$ButtonLocation & 'start_press.jpg') Install() Sleep(138) If $tempID = $SettingsStart Then GUICtrlSetImage($SettingsStart,$ButtonLocation & 'start_normal.jpg') Else GUICtrlSetimage($SettingsStart,$ButtonLocation & 'start_over.jpg') EndIf EndIf If $Click = 1 And @extended = $SettingsSelect Then GUICtrlSetImage($SettingsSelect,$ButtonLocation & 'select_press.jpg') _SelectAll() Sleep(138) If $tempID = $SettingsSelect Then GUICtrlSetImage($SettingsSelect,$ButtonLocation & 'select_normal.jpg') Else GUICtrlSetimage($SettingsSelect,$ButtonLocation & 'select_over.jpg') EndIf EndIf If $Click = 1 And @extended = $SettingsDeselect Then GUICtrlSetImage($SettingsDeselect,$ButtonLocation & 'deselect_press.jpg') _DeselectAll() Sleep(138) If $tempID = $SettingsDeselect Then GUICtrlSetImage($SettingsDeselect,$ButtonLocation & 'deselect_normal.jpg') Else GUICtrlSetimage($SettingsDeselect,$ButtonLocation & 'deselect_over.jpg') EndIf EndIf If $Click = 1 And @extended = $SettingsExit Then GUICtrlSetImage($SettingsExit,$ButtonLocation & 'exit_press.jpg') Exitier() Sleep(138) If $tempID = $SettingsExit Then GUICtrlSetImage($SettingsExit,$ButtonLocation & 'exit_normal.jpg') Else GUICtrlSetimage($SettingsExit,$ButtonLocation & 'exit_over.jpg') EndIf EndIf If $Click = 1 And @extended = $ShortcutsStart Then GUICtrlSetImage($ShortcutsStart,$ButtonLocation & 'start_press.jpg') Install() Sleep(138) If $tempID = $ShortcutsStart Then GUICtrlSetImage($ShortcutsStart,$ButtonLocation & 'start_normal.jpg') Else GUICtrlSetimage($ShortcutsStart,$ButtonLocation & 'start_over.jpg') EndIf EndIf If $Click = 1 And @extended = $ShortcutsSelect Then GUICtrlSetImage($ShortcutsSelect,$ButtonLocation & 'select_press.jpg') _SelectAll() Sleep(138) If $tempID = $ShortcutsSelect Then GUICtrlSetImage($ShortcutsSelect,$ButtonLocation & 'select_normal.jpg') Else GUICtrlSetimage($ShortcutsSelect,$ButtonLocation & 'select_over.jpg') EndIf EndIf If $Click = 1 And @extended = $ShortcutsDeselect Then GUICtrlSetImage($ShortcutsDeselect,$ButtonLocation & 'deselect_press.jpg') _DeselectAll() Sleep(138) If $tempID = $ShortcutsDeselect Then GUICtrlSetImage($ShortcutsDeselect,$ButtonLocation & 'deselect_normal.jpg') Else GUICtrlSetimage($ShortcutsDeselect,$ButtonLocation & 'deselect_over.jpg') EndIf EndIf If $Click = 1 And @extended = $ShortcutsExit Then GUICtrlSetImage($ShortcutsExit,$ButtonLocation & 'exit_press.jpg') Exitier() Sleep(138) If $tempID = $ShortcutsExit Then GUICtrlSetImage($ShortcutsExit,$ButtonLocation & 'exit_normal.jpg') Else GUICtrlSetimage($ShortcutsExit,$ButtonLocation & 'exit_over.jpg') EndIf EndIf If $Click = 1 And @extended = $OtherStart Then GUICtrlSetImage($OtherStart,$ButtonLocation & 'start_press.jpg') Install() Sleep(138) If $tempID = $OtherStart Then GUICtrlSetImage($OtherStart,$ButtonLocation & 'start_normal.jpg') Else GUICtrlSetimage($OtherStart,$ButtonLocation & 'start_over.jpg') EndIf EndIf If $Click = 1 And @extended = $OtherSelect Then GUICtrlSetImage($OtherSelect,$ButtonLocation & 'select_press.jpg') _SelectAll() Sleep(138) If $tempID = $OtherSelect Then GUICtrlSetImage($OtherSelect,$ButtonLocation & 'select_normal.jpg') Else GUICtrlSetimage($OtherSelect,$ButtonLocation & 'select_over.jpg') EndIf EndIf If $Click = 1 And @extended = $OtherDeselect Then GUICtrlSetImage($OtherDeselect,$ButtonLocation & 'deselect_press.jpg') _DeselectAll() Sleep(138) If $tempID = $OtherDeselect Then GUICtrlSetImage($OtherDeselect,$ButtonLocation & 'deselect_normal.jpg') Else GUICtrlSetimage($OtherDeselect,$ButtonLocation & 'deselect_over.jpg') EndIf EndIf If $Click = 1 And @extended = $OtherExit Then GUICtrlSetImage($OtherExit,$ButtonLocation & 'exit_press.jpg') Exitier() Sleep(138) If $tempID = $OtherExit Then GUICtrlSetImage($OtherExit,$ButtonLocation & 'exit_normal.jpg') Else GUICtrlSetimage($OtherExit,$ButtonLocation & 'exit_over.jpg') EndIf EndIf WEnd Link to comment Share on other sites More sharing options...
Valuater Posted April 10, 2007 Share Posted April 10, 2007 (edited) I don't understand why it needs to be so complicated #include<guiconstants.au3> #include <_ButtonHover.au3> $Main = GUICreate("Button GUI") $XButton_Location = @ScriptDir & '\HoverButton\' $Start = _HoverButton ("START", 280, 265, 75, 25, 0xFFFFFF) GUICtrlSetFont($Start + 1, 10, 600, 4, "Comic Sams"); make it look any way you want $Select = _HoverButton ("SELECT", 280, 310, 75, 25, 0xFFFFFF) _ControlHover (2, "", $Start) _ControlHover (2, "", $Select) GUISetState() While 1 _CheckHoverAndPressed ($Main) If GUIGetMsg() = -3 Then Exit WEnd 8) Edited April 10, 2007 by Valuater Link to comment Share on other sites More sharing options...
dufran3 Posted April 10, 2007 Author Share Posted April 10, 2007 I looked at your example, but, that is to easy. :-) lol. The buttons don't do anything when pressed. I need 4 images, per tab when there is 5 tabs. On top of that, the buttons must call separate functions that I declare later in the script. Your example is very simple....not sure how to integrate such a simple solution into my chaotic mess. Link to comment Share on other sites More sharing options...
dufran3 Posted April 10, 2007 Author Share Posted April 10, 2007 wait a second....wait for it... Link to comment Share on other sites More sharing options...
dufran3 Posted April 10, 2007 Author Share Posted April 10, 2007 I'm an idiot, you were showing me something fantastic...and I wasn't seeing it. I suppose the button images don't have to have the text on them, I can change them with GUICtrlSetFont, like you were showing me. I just didn't see it. And that's it...of course for each tab, but still....wow! I think I should leave you alone for a while. You have really helped me out. If I have any other additional problems....I will just start new threads. My whole reason for starting this was GUI tips and ideas. You have been amazing. I will take a screenie of my GUI, so people can see what I have come up with. ;Buttons $DesktopStart = _HoverButton("START",280,265,75,25, 0xFFFFFF) GUICtrlSetFont( $DesktopStart +1, 9, 600, '', "Comic Sams") GUICtrlSetOnEvent($DesktopStart, 'Install') $DesktopSelect = _HoverButton("SELECT",280,310,75,25, 0xFFFFFF) GUICtrlSetFont( $DesktopSelect +1, 9, 600, '', "Comic Sams") GUICtrlSetOnEvent($DesktopSelect, '_SelectAll') $DesktopDeselect = _HoverButton("DESELECT",280,355,75,25, 0xFFFFFF) GUICtrlSetFont( $DesktopDeselect +1, 9, 600, '', "Comic Sams") GUICtrlSetOnEvent($DesktopDeselect, '_DeSelectAll') $DesktopExit = _HoverButton("EXIT",280,400,75,25, 0xFFFFFF) GUICtrlSetFont( $DesktopExit +1, 9, 600, '', "Comic Sams") GUICtrlSetOnEvent($DesktopExit, 'Exitier') _ControlHover(2, "", $ClinicalStart) _ControlHover(2, "", $ClinicalSelect) _ControlHover(2, "", $ClinicalDeselect) _ControlHover(2, "", $ClinicalExit) While 1 ;GUIGetMsg() <> $GUI_EVENT_CLOSE _CheckHoverAndPressed ($Main) Sleep(10) WEnd Link to comment Share on other sites More sharing options...
dufran3 Posted April 10, 2007 Author Share Posted April 10, 2007 (edited) Here is the pretty much "finished" GUI look.Thanks to all for you advice, tips, and especially Valuater for all the help. Edited April 10, 2007 by dufran3 Link to comment Share on other sites More sharing options...
Valuater Posted April 10, 2007 Share Posted April 10, 2007 8) Link to comment Share on other sites More sharing options...
YozY Posted April 11, 2007 Share Posted April 11, 2007 Well here's a gui i created you can maybe use for inspiration or something For hover and press control i used this code, perhaps it might be useful: #include <_MouseHover.au3> #include <_PressDetect.au3> Func _GUICtrlCreatePicButton($image, $h_image, $p_image, $x, $y, $width, $height) $btnID = GUICtrlCreatePic($image, $x, $y, $width, $height) GUICtrlSetCursor ($btnId,0) _HoverAddCtrl($btnID) _PressDetectAddCtrl($btnId) EnvSet($btnId&"n", $image) EnvSet($btnId&"h", $h_image) EnvSet($btnId&"p", $p_image) Return $btnID EndFunc Func _PicButtonCheck() $ControlID = _HoverCheck() If IsArray($ControlID) Then If $ControlID[0] = "AcquiredHover" Then GUICtrlSetImage($ControlID[1], EnvGet($ControlID[1]&"h")) Else GUICtrlSetImage($ControlID[1], EnvGet($ControlID[1]&"n")) EndIf EndIf $ControlID2 = _PressDetect() If IsArray($ControlID2) Then If $ControlID2[0] = "ButtonDePressed" Then GUICtrlSetImage($ControlID2[1], EnvGet($ControlID2[1]&"p")) Else GUICtrlSetImage($ControlID2[1], EnvGet($ControlID2[1]&"n")) EndIf EndIf EndFunc example: _GUICtrlCreatePicButton("normal.jpg","hover.jpg","active.jpg",10,10,125,105) Link to comment Share on other sites More sharing options...
Jdonner Posted April 11, 2007 Share Posted April 11, 2007 (edited) Sorry, wrong thread Edited April 11, 2007 by Jdonner Link to comment Share on other sites More sharing options...
Armand Posted April 30, 2008 Share Posted April 30, 2008 @dufran3 & @YozY Awesome works... will need to work on some of my GUIs later on [u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?! 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