AppTux Posted December 15, 2009 Share Posted December 15, 2009 I have a gui. if you press a button, then opens a new gui. now, the problem is, if you move the gui and the small gui is open, then the small gui have to go with the normal gui. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: AppTux Script Function: Run a program and open a folder, document or Internet Adress. #ce ---------------------------------------------------------------------------- #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIEdit.au3> #include <File.au3> Opt('MustDeclareVars', 1) _WindowsTools_Run() Func _WindowsTools_Run() Local $GUI,$GUIP,$pBAN,$pMIN,$pMIN2 Local $Msg,$MOV,$ST = 0,$STW = 0 Local $WINP,$LOCGUI,$lWT,$lRUN,$lRNO,$lROP $GUI = GUICreate("WindowsTools Run",300,190) $GUIP = WinGetPos($GUI) GUISetIcon("WindowsTools.ico",1,$GUI) GUISetBkColor(0xFFFFFF,$GUI) GUICtrlCreatePic("Data\Images\bk.bmp",0,20,300,170) GUICtrlSetState(-1,$Gui_Disable) ;------------------------------------------------Begin of Controls---------------------------------; $pBAN = GUICtrlCreatePic("Data\Images\banner_run.bmp",0,0,300,20) $pMIN = GUICtrlCreatePic("Data\Images\expand1.bmp",5,165,20,20) $pMIN2 = GUICtrlCreatePic("Data\Images\min1.bmp",5,165,20,20) GUICtrlSetState($pMIN2,$GUI_HIDE) GUISetState() While 1 $Msg = GUIGetMsg($GUI) $MOV = GUIGetCursorInfo($GUI) $WINP = WinGetPos($GUI) If $Msg = $GUI_EVENT_CLOSE Then Exit EndIf If $MOV[4] = $pMIN Then If $STW = 0 Then GUISetState(@SW_SHOW,$GUI) GUICtrlDelete($pMIN) $pMIN = GUICtrlCreatePic("Data\Images\expand2.bmp",5,165,20,20) GUICtrlSetState($pMIN,$GUI_SHOW) GUISetState(@SW_SHOW,$LOCGUI) While $MOV[4] = $pMIN $Msg = GUIGetMsg() If $Msg = $pMIN Then GUICtrlSetState($pMIN2,$GUI_SHOW) $WINP = WinGetPos($GUI) $LOCGUI = GUICreate("Locations",150,188,$WINP[0] -150,$WINP[1] +28,$WS_POPUP,"",$GUI) GUISetIcon("WindowsTools.ico",1,$LOCGUI) GUISetBkColor(0xffffff,$LOCGUI) GUICtrlCreatePic("Data\Images\bk.bmp",0,0,150,188) GUICtrlCreatePic("Data\Images\treeexpand.bmp",5,6,9,9) $lWT = GUICtrlCreateLabel("WindowsTools",20,5,70,15) GUICtrlCreatePic("Data\Images\treeexpand.bmp",15,23,9,9) $lRUN = GUICtrlCreateLabel("Run",30,22,50,15) GUICtrlCreateIcon("WindowsTools.ico",1,20,37,16,16) $lRNO = GUICtrlCreateLabel("Run",40,39,50,15) GUICtrlCreateIcon("WindowsToolsOpt.ico",1,20,56,16,16) $lROP = GUICtrlCreateLabel("Options",40,58,60,15) GUISetState() GUICtrlSetState($pMIN,$GUI_HIDE) $STW = 1 EndIf $MOV = GUIGetCursorInfo($GUI) Sleep(50) WEnd If $STW = 0 Then GUISetState(@SW_SHOW,$GUI) GUICtrlDelete($pMIN) $pMIN = GUICtrlCreatePic("Data\Images\expand1.bmp",5,165,20,20) GUICtrlSetState($pMIN,$GUI_SHOW) GUISetState(@SW_SHOW,$LOCGUI) ElseIf $STW = 1 Then GUICtrlSetState($pMIN,$GUI_HIDE) EndIf ElseIf $STW = 1 Then ; EndIf EndIf WEnd EndFunc not all of the functions work, but i can expand the gui i hope i give enough information PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 15, 2009 Moderators Share Posted December 15, 2009 AppTux,I think you have just won the prize for the most unintelligible script I have seen this year! I have tried to help out where I can - at least your secondary GUI now follows the main one. I changed all the GUICtrlCreatePics into GUICtrlCreateButtons so I could see what was going on:expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIEdit.au3> #include <File.au3> Opt('MustDeclareVars', 1) _WindowsTools_Run() Func _WindowsTools_Run() Local $GUI,$GUIP,$pBAN,$pMIN,$pMIN2 Local $Msg,$MOV,$ST = 0,$STW = 0 Local $WINP,$LOCGUI,$lWT,$lRUN,$lRNO,$lROP ; Create Main GUI $GUI = GUICreate("WindowsTools Run",300,190) $GUIP = WinGetPos($GUI) GUISetIcon("WindowsTools.ico",1,$GUI) GUISetBkColor(0xFFFFFF,$GUI) GUICtrlCreatePic("Data\Images\bk.bmp",0,20,300,170) GUICtrlSetState(-1,$Gui_Disable) ;------------------------------------------------Begin of Controls---------------------------------; $pBAN = GUICtrlCreateButton("Run",0,0,300,20) $pMIN = GUICtrlCreateButton("E1",5,165,20,20) $pMIN2 = GUICtrlCreateButton("M",5,165,20,20) GUICtrlSetState($pMIN2,$GUI_HIDE) GUISetState() ; Create LOC GUI and hide $LOCGUI = GUICreate("Locations",150,130,0,20,$WS_POPUP,$WS_EX_MDICHILD,$GUI) ; This is how you make a child wondow!! <<<<<<<<<<<<<<<<<<<<<<<<< GUISetIcon("WindowsTools.ico",1,$LOCGUI) GUISetBkColor(0xffffff,$LOCGUI) GUICtrlCreatePic("Data\Images\bk.bmp",0,0,150,188) GUICtrlCreatePic("Data\Images\treeexpand.bmp",5,6,9,9) $lWT = GUICtrlCreateLabel("WindowsTools",20,5,70,15) GUICtrlCreatePic("Data\Images\treeexpand.bmp",15,23,9,9) $lRUN = GUICtrlCreateLabel("Run",30,22,50,15) GUICtrlCreateIcon("WindowsTools.ico",1,20,37,16,16) $lRNO = GUICtrlCreateLabel("Run",40,39,50,15) GUICtrlCreateIcon("WindowsToolsOpt.ico",1,20,56,16,16) $lROP = GUICtrlCreateLabel("Options",40,58,60,15) GUISetState(@SW_HIDE, $LOCGUI) While 1 ;$Msg = GUIGetMsg($GUI) ; $GUI is not a valid parameter <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $Msg = GUIGetMsg() $MOV = GUIGetCursorInfo($GUI) ; Why?????????? $WINP = WinGetPos($GUI) ; Why ????????????????? Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $pMIN If $STW = 0 Then ;GUISetState(@SW_SHOW,$GUI) ; How can you press a control on this GUI if it is not already visible? <<<<<<<<<<<<<<<<<<<<<<< GUICtrlDelete($pMIN) $pMIN = GUICtrlCreateButton("E2",5,165,20,20) ; GUICtrlSetState($pMIN,$GUI_SHOW) ; It is already visible by default GUISetState(@SW_SHOW,$LOCGUI) While $MOV[4] = $pMIN ;$Msg = GUIGetMsg() ; you have already done this! <<<<<<<<<<<<<<<<<<<<<<< ;If $Msg = $pMIN Then ; As the cursor is already on this control it is very likely that this will be true GUICtrlSetState($pMIN,$GUI_HIDE) GUICtrlSetState($pMIN2,$GUI_SHOW) ;$WINP = WinGetPos($GUI) ; You did this already! <<<<<<<<<<<<<<<<<<<<<<<<<<<<< $STW = 1 ;EndIf ; $MOV = GUIGetCursorInfo($GUI) ; You did this already! <<<<<<<<<<<<<<<<<<<<<<<<<<<<< If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit ; You always need an exit in a loop! WEnd #cs If $STW = 0 Then ; This is the same condition as above!! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ;GUISetState(@SW_SHOW,$GUI) ; How can you press a control on this GUI if it is not already visible? <<<<<<<<<<<<<<<<<<<<<<< GUICtrlDelete($pMIN) $pMIN = GUICtrlCreateButton("E1",5,165,20,20) GUICtrlSetState($pMIN,$GUI_SHOW) GUISetState(@SW_SHOW,$LOCGUI) #ce ElseIf $STW = 1 Then GUICtrlSetState($pMIN,$GUI_HIDE) EndIf ;ElseIf $STW = 1 Then ; you just did this 3 lines above!!! <<<<<<<<<<<<<<<<<<<<<<<<<<< ; ;EndIf EndSwitch WEnd EndFuncPlease try and rework the script before you come back for more help - that really hurt my head! Or try and explain what you want to happen - you are testing for an identical condition several times over. See you soon, no doubt! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
AppTux Posted December 17, 2009 Author Share Posted December 17, 2009 Sorry for that strange script. I have now school holiday so I go to rewrite the script. And change some things so you can understand it much more But the rewriting can during a long, long time with a lot of bugs. PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 17, 2009 Moderators Share Posted December 17, 2009 AppTux, I will be waiting! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
AppTux Posted December 18, 2009 Author Share Posted December 18, 2009 I have this now: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Gert-Jan van Ginkel Name: WindowsTools Run Script Function: Run a program and open a folder, document or Internet Adress. #ce ---------------------------------------------------------------------------- #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $WST = "Normal" ;The other GUI is not opened $GUI = GUICreate("WindowsTools",300,180) GUISetBkColor(0xFFFFFF) $bEXP = GUICtrlCreateButton("<<",0,155,25,25) GUISetState() Do $Msg = GUIGetMsg() Switch $Msg Case $bEXP If $WST = "Normal" Then ;If the other GUI isn't opened. GUICtrlSetData($bEXP,">>") $GUI2 = GUICreate("",150,180,-152,25,$WS_POPUP,$WS_EX_MDICHILD,$GUI) GUISetBkColor(0xFFFFFF) GUICtrlCreatePic("Data\bk.bmp",0,0,150,180) GUICtrlSetState(-1,$GUI_DISABLE) ; TREEVIEW ONE $TREE = GUICtrlCreateTreeView(5, 5, 140, 170) $TREEI1 = GUICtrlCreateTreeViewItem("WindowsTools", $TREE) $T1RUN = GUICtrlCreateTreeViewItem("Run", $TREEI1) $T1TCL = GUICtrlCreateTreeViewItem("Temp Cleaner",$TREEI1) $TREEI2 = GUICtrlCreateTreeViewItem("Options", $TREE) $T2RUN = GUICtrlCreateTreeViewItem("Run Options",$TREEI2) GUICtrlSetState($TREEI1, $GUI_EXPAND) GUICtrlSetState($TREEI2 ,$GUI_EXPAND) GUISetState() $WST = "Expanded" ;Set the value to Expanded so if you again press the button the GUI will be deleted. ElseIf $WST = "Expanded" Then ;If the other GUI is opened. GUICtrlSetData($bEXP,"<<") GUIDelete($GUI2) $WST = "Normal" ;Set the value to Normal so if you again press the button the GUI will be created again. EndIf EndSwitch Until $Msg = $GUI_EVENT_CLOSE I hope you can understand it now better. The child windows works, but i have a really strange result: do you have the same result? because it does not matter what I want PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 18, 2009 Moderators Share Posted December 18, 2009 AppTux,Good work! I have only one real comment - do not keep creating and destroying the second GUI - create it just the once and then Hide/Show it as required. The script below shows how.I have also changed your GUIGetMsg loop slightly - there was nothing wrong with yours, but I prefer it this way! expandcollapse popup#include <WindowsConstants.au3> $WST = "Normal" ;The other GUI is not opened $GUI = GUICreate("WindowsTools", 300, 180) GUISetBkColor(0xFFFFFF, $GUI) $bEXP = GUICtrlCreateButton("<<", 0, 155, 25, 25) GUISetState(@SW_SHOW) $GUI2 = GUICreate("", 150,180,-152,25, $WS_POPUP, $WS_EX_MDICHILD, $GUI) GUISetBkColor(0xFFFF00, $GUI2) $hPic = GUICtrlCreatePic("Data\bk.bmp", 0, 0, 150, 180) GUICtrlSetState($hPic, $GUI_DISABLE) ; TREEVIEW ONE $TREE = GUICtrlCreateTreeView(5, 5, 140, 170) $TREEI1 = GUICtrlCreateTreeViewItem("WindowsTools", $TREE) $T1RUN = GUICtrlCreateTreeViewItem("Run", $TREEI1) $T1TCL = GUICtrlCreateTreeViewItem("Temp Cleaner", $TREEI1) $TREEI2 = GUICtrlCreateTreeViewItem("Options", $TREE) $T2RUN = GUICtrlCreateTreeViewItem("Run Options", $TREEI2) GUICtrlSetState($TREEI1, $GUI_EXPAND) GUICtrlSetState($TREEI2, $GUI_EXPAND) GUISetState(@SW_HIDE) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $bEXP If $WST = "Normal" Then ;If the other GUI isn't opened. GUICtrlSetData($bEXP, ">>") GUISetState(@SW_SHOW, $GUI2) $WST = "Expanded" ;Set the value to Expanded so if you again press the button the GUI will be deleted. ElseIf $WST = "Expanded" Then ;If the other GUI is opened. GUICtrlSetData($bEXP, "<<") GUISetState(@SW_HIDE, $GUI2) $WST = "Normal" ;Set the value to Normal so if you again press the button the GUI will be created again. EndIf EndSwitch WEndThe yellow colour for the second GUI was just so I could see it easily with my old eyes. And NO I do not get the same effect as you - the small GUI follows its parent like a good child should. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
AppTux Posted December 18, 2009 Author Share Posted December 18, 2009 Melba23, That's what I wanted to hear. I go look for the solution of the problem. Maybe I have to look the solution in the drivers of my graphic card. I really don't know... PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore. 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