Hey Leute,
Vor Kurzem habe ich hier mal eine GUI gebastelt, in der ich eine Child GUI auf der GUI genutzt habe, um darin eine Liste mit eigener Scrollbar zu erstellen. Website parsen - Klappe die tausendste..
Ich fand das so gut, dass ich in meinen anderen Programmen nun auch die Listviews durch Label auf einer Child Gui ersetzt habe. Nun ist mir aber folgendes Problem aufgefallen:
Nachdem mein PC aus dem Standby erwacht, ist die Child GUI verschoben und sitzt nicht mehr an ihrer Position in der GUI.
Hier habe ich mal den leicht angepassten Code aus der Hilfe:
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Example()
Func Example()
; Create a GUI with various controls.
Local $hGUI = GUICreate("Example", 400, 100)
Local $idOK = GUICtrlCreateButton("OK_GUI", 10, 20, 85, 25)
; Display the GUI.
GUISetState(@SW_SHOW, $hGUI)
Local $hChild = GUICreate("", 169, 68, 200, 20, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
Local $idOK2 = GUICtrlCreateButton("OK_Child", 10, 20, 85, 25)
; Display the child GUI.
GUISetState(@SW_SHOW)
; Loop until the user exits.
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idOK
MsgBox(0, "", "Gui 1", 1)
Case $idOK2
MsgBox(0, "", "Gui 2", 1)
EndSwitch
WEnd
; Delete the previous GUIs and all controls.
GUIDelete($hGUI)
GUIDelete($hChild)
EndFunc ;==>Example
Alles anzeigen
So sieht das mit dem Beispielcode aus:
Testweise habe ich es mal mit einer ständigen Neupositionierung der Child GUI versucht. Das scheint zu funktionieren. Kommt mir aber ziemlich ineffizient vor:
Hier noch einmal das Beispiel mit der Änderung, dass in der Schleife (Zeile 29f) die wiederholte Positionierung stattfindet.
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;~ Opt("GUICoordMode", 1)
Example()
Func Example()
; Create a GUI with various controls.
Local $hGUI = GUICreate("Example", 400, 100)
Local $idOK = GUICtrlCreateButton("OK_GUI", 10, 20, 85, 25)
; Display the GUI.
GUISetState(@SW_SHOW, $hGUI)
Local $hChild = GUICreate("", 169, 68, 200, 20, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
Local $idOK2 = GUICtrlCreateButton("OK_Child", 10, 20, 85, 25)
; Display the child GUI.
GUISetState(@SW_SHOWNA)
; Loop until the user exits.
While 1
; HIER: Neupositionierung
Local $aGUI_Pos = WinGetPos($hGUI)
WinMove($hChild, "", $aGUI_Pos[0] + 200, $aGUI_Pos[1] + 40)
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idOK
MsgBox(0, "", "Gui 1", 1)
Case $idOK2
MsgBox(0, "", "Gui 2", 1)
EndSwitch
WEnd
; Delete the previous GUIs and all controls.
GUIDelete($hGUI)
GUIDelete($hChild)
EndFunc ;==>Example
Alles anzeigen
Mache ich da etwas falsch? Kann man das besser lösen?