Izuno Posted July 23, 2016 Share Posted July 23, 2016 I've just recently starting using GUICreate and stuff and noticed that when I drag around the generated gui window, if I had a script running that script would be paused for as long as I keep dragging the window around. Is this normal behavior? I also tried making children gui and make them follow the parent gui around when I drag the parent around, but the child will only move to the new position after I let go of the parent window that I've been dragging, cause the function I've set to calculate the new position of the child window is paused while I'm dragging the parent. Is there a way to somehow make the child move with the parent gui more naturally? Tried searching for older threads and it didn't get answered so I hope this doesn't count as a necro of sorts :3 I like my anime and naps :3 Link to comment Share on other sites More sharing options...
InunoTaishou Posted July 23, 2016 Share Posted July 23, 2016 What are you trying to keep running while you move the GUI? Maybe this thread could offer some answers. Link to comment Share on other sites More sharing options...
Bert Posted July 24, 2016 Share Posted July 24, 2016 could you post your script? That would help us debug it too. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
SadBunny Posted July 24, 2016 Share Posted July 24, 2016 I had actually never noticed this before... Here's a reproducer: HotKeySet("{ESC}", "quitter") Global $hGUI = GUICreate("My GUI") GUISetState(@SW_SHOW, $hGUI) Local $counter = 0 While 1 Sleep(400) Beep(1500, 100) $counter += 1 ConsoleWrite($counter & @CRLF) WEnd Func quitter() GUIDelete($hGUI) Exit EndFunc ;==>quitter Script stops beeping and consolewriting as soon as you hold LMB on the titlebar and continues as soon as you release LMB. Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
AutoBert Posted July 24, 2016 Share Posted July 24, 2016 (edited) First issue is normal behaviour. Second issue is a behaviour of implementing the child(s). expandcollapse popup#include <WinAPI.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <Array.au3> #include <Date.au3> Opt('MustDeclareVars', 1) Global $iWatch, $iRes, $bWorking Global $sLocalPath = @ScriptDir & "\TestDLs\" If Not FileExists($sLocalPath) Then DirCreate($sLocalPath) Global $aFiles[5][6] ;zeile 0 für Gesamtgrösse Spalten 2=Grösse aller DownLoaddateien, 3=bereits downheloaded, 4 Bytes durch Neustart verworfen, ;danach Spalten 0=URL, 1=Lokaler Pfad, 2=DL-Grösse,3=DL-Bytes , 4=DL-Handle, 5=Fehler Anzahl Global $aData[1] Global $aKBs[10] $aFiles[0][0] = 4 ;Anzahl der Downloads $aFiles[1][0] = "http://download.bleepingcomputer.com/Xplode/AdwCleaner.exe" $aFiles[1][1] = "AdwCleaner.exe" $aFiles[2][0] = "http://download.iobit.com/action-center/asc920-0330.exe" $aFiles[2][1] = "Advanced_SystemCare.exe" $aFiles[3][0] = "http://download.geo.drweb.com/pub/drweb/cureit/drweb-cureit.exe" $aFiles[3][1] = "DrWeb-CureIt.exe" $aFiles[4][0] = "http://data-cdn.mbamupdates.com/web/JRT.exe" $aFiles[4][1] = "JRT.exe" Dim $hGUI_c[$aFiles[0][0] + 2] Dim $idprgInfo[$aFiles[0][0] + 2] Dim $idlblInfo[$aFiles[0][0] + 2] Global $msg, $sLblText, $tdStart Global $hGuiMain = GUICreate("Multi-Downloader 0.5.2.4", 325, 250) Global $button = GUICtrlCreateButton("Start", 5, 20, 70, 20) Global $Display = GUICtrlCreateButton("Debug", 5, 70, 70, 20) Global $Arrival = GUICtrlCreateLabel("", 95, 25, 185, 50) GUICtrlSetFont(-1, 15, 800) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) For $i = 1 To $aFiles[0][0] _MakeDLPanel($i, $aFiles[$i][1]) GUISwitch($hGuiMain) Next _MakeDLPanel($i, 'Gesamt') Global $idlblKBs = GUICtrlCreateLabel('', 95, 4, 150, 60) GUICtrlSetFont(-1, 15, 800) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUISwitch($hGuiMain) GUISetState() Func _MakeDLPanel($iNo, $sText) $idprgInfo[$iNo] = GUICtrlCreateProgress(8, 70 + $iNo * 30, 310, 30) $hGUI_c[$iNo] = GUICreate("", 309, 30, 8, 70 + $iNo * 30, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TRANSPARENT, $WS_EX_MDICHILD), $hGuiMain) GUISetBkColor(0x989898, $hGUI_c[$iNo]) GUICtrlCreateLabel($sText, 0, 8, 220, 25, $ES_LEFT) GUICtrlSetFont(-1, 12, 1000) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $idlblInfo[$iNo] = GUICtrlCreateLabel("0,0 % ", 221, 8, 90, 25, $ES_RIGHT) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetFont(-1, 12, 1000) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) _WinAPI_SetLayeredWindowAttributes($hGUI_c[$iNo], 0x989898) GUISetState(@SW_SHOWNA, $hGUI_c[$iNo]) EndFunc ;==>_MakeDLPanel While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE $iRes=$IDNO If $bWorking Then $iRes=MsgBox($MB_YESNO+$MB_ICONQUESTION,'Sure',"there are some DL's to be continued"&@CRLF&"Realy exit?") If $iRes=$IDYES Then Exit Case $Display _ArrayDisplay($aFiles) Case $button $tdStart = TimerInit() For $i = 1 To $aFiles[0][0] $aFiles[$i][4] = InetGet($aFiles[$i][0], $sLocalPath & $aFiles[$i][1], 1, 1) GUICtrlSetState($idlblInfo[$i], $GUI_SHOW) Next GUICtrlSetState($idlblInfo[$i], $GUI_SHOW) AdlibRegister('_WatchDL', 10) AdlibRegister('_checkArrival',1000) ;_ArrayDisplay($aFiles) EndSwitch WEnd Func _WatchDL() ;Local Static $iOld Local $iDiff Local $nPercent $iWatch += 1 If $iWatch > $aFiles[0][0] Then $iWatch = 1 If $aFiles[$iWatch][4] > 0 Then $aData = InetGetInfo($aFiles[$iWatch][4], -1) If @error Then ConsoleWrite(@error & @TAB & @extended & @CRLF) Return EndIf If $aFiles[$iWatch][2] = 0 Then $aFiles[$iWatch][2] = $aData[1] ;Downloadgrösse ermittelt $aFiles[0][2] += $aFiles[$iWatch][2] ;und auch zur Gesamtdownloadgrösse hinzuzählen EndIf $nPercent = Round($aData[0] / $aFiles[$iWatch][2] * 100, 1) $nPercent = StringReplace($nPercent, '-1.#IND', '') $aFiles[$iWatch][3] = $aData[0] If Int($nPercent) <> GUICtrlRead($idprgInfo[$iWatch]) Then _ GUICtrlSetData($idprgInfo[$iWatch], Int($nPercent)) If $nPercent <> Number(GUICtrlRead($idlblInfo[$iWatch])) Then _ GUICtrlSetData($idlblInfo[$iWatch], _FormatString($nPercent)) If $aData[2] Then If $aData[3] Then InetClose($aFiles[$iWatch][4]) $aFiles[$iWatch][4] = 'Erfolg' GUICtrlSetData($idprgInfo[$iWatch], 100) Else $aFiles[$iWatch][5] += 1 If $aFiles[$iWatch][5] < 10 Then $aFiles[$iWatch][4] = InetGet($aFiles[$iWatch][0], $sLocalPath & $aFiles[$iWatch][1], 1, 1) $aFiles[0][4] += $aFiles[$iWatch][3] Else $aFiles[0][2] -= $aFiles[$iWatch][2]; von gesamt DL-größe abziehen $aFiles[$iWatch][2] = 0 $aFiles[$iWatch][3] = 0 $aFiles[$iWatch][4] = 'Abbruch' GUICtrlSetData($idprgInfo[$iWatch], 0) GUICtrlSetData($idlblInfo[$iWatch], 'Abbruch') EndIf EndIf EndIf $aFiles[0][3] = 0 For $iWatch = 1 To $aFiles[0][0] $aFiles[0][3] += $aFiles[$iWatch][3] Next #cs If $aFiles[0][3] <> 0 Then $iDiff = $iOld - $aFiles[0][3] _ArrayPush($aKBs, $iDiff) Local $nKBs = 0 For $i = 0 To UBound($aKBs) - 1 $nKBs += $aKBs[$i] Next $nKBs = Round($nKBs / 10240, 2) GUICtrlSetData($idlblKBs, _FormatString($nKBs, 'KByte/sec')) $iOld=$aFiles[0][3] #ce $nPercent = Round($aFiles[0][3] / $aFiles[0][2] * 100, 1) $nPercent = StringReplace($nPercent, '-1.#IND', '') If Int($nPercent) <> GUICtrlRead($idprgInfo[$iWatch]) Then _ GUICtrlSetData($idprgInfo[$iWatch], Int($nPercent)) If $nPercent <> Number(GUICtrlRead($idlblInfo[$iWatch])) Then _ GUICtrlSetData($idlblInfo[$iWatch], _FormatString($nPercent)) EndIf $bWorking = False For $i = 1 To $aFiles[0][0] $bWorking = ($aFiles[$i][4] > 0) If $bWorking Then ExitLoop Next If Not $bWorking Then _ArrayDisplay($aFiles, 'Downloads beendet') AdlibUnRegister('_WatchDL') AdlibUnRegister('_checkArrival') EndIf EndFunc ;==>_WatchDL Func _checkArrival() Local $iOld Local $iElapsed = TimerDiff($tdStart) / 1000 Local $nKBs = Round(($aFiles[0][3] + $aFiles[0][4]) / $iElapsed / 1024, 1) If $nKBs <> Number(GUICtrlRead($idlblKBs)) Then _ GUICtrlSetData($idlblKBs, _FormatString($nKBs, 'KB/s')) Local $iRemaining = Int(($aFiles[0][2] - $aFiles[0][3]) / $nKBs / 1024) if $iRemaining<>$iOld Then _ GUICtrlSetData($Arri both issues can be seen in script above. I don't tested maybe first issue can be avoid using implementing urgent things in idle loop. But as you see the childs are always moved with the maingui. Edited July 24, 2016 by AutoBert Link to comment Share on other sites More sharing options...
Izuno Posted July 24, 2016 Author Share Posted July 24, 2016 (edited) @Bert, Here is my script. I was trying to make a child gui follow its parent around while I dragged the parent. But as it is now, when I drag the parent, as long as I have the LMB held down the child will stay still and will only move to the new position when I let go of the LMB, which although works is not very beautiful. $main = GUICreate("Main", 100, 100) GUISetState() $mainpos = WinGetPos($main) $child = GUICreate("Child", 100, 100, $mainpos[0], $mainpos[0]-110, $WS_POPUP, -1, $main) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch $mainpos = WinGetPos($main) Wend @InunoTaishou, Thanks for the link, shame that it uses OnEvent though. Just getting used to GUIgetmsg or something is hard enough XD @AutoBert That's a lot of things to digest, I'll read through it slowly and pray that it'll have something that'll work Thank you all. Edited July 24, 2016 by Izuno I like my anime and naps :3 Link to comment Share on other sites More sharing options...
AutoBert Posted July 24, 2016 Share Posted July 24, 2016 (edited) 44 minutes ago, Izuno said: @AutoBert I'll try this later, hope it'll work it works using the style and exstyle parameters as i do (maybe also other combinations are possible) but very urgent is setting the maingui as parent of childgui(s). There is no winmove needed for reposition the childgui(s) Edited July 24, 2016 by AutoBert Link to comment Share on other sites More sharing options...
Izuno Posted July 24, 2016 Author Share Posted July 24, 2016 Oh! Using $WS_EX_MDICHILD for the exstyle did the trick indeed. Thanks :3 Now I feel dumb making things more complicated than it should be I like my anime and naps :3 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