Aelc Posted August 22, 2019 Posted August 22, 2019 (edited) Hello is there a way to Hide/Show an _GUIctrlDTP_create like the simply GUIctrlsetstate ? expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiDateTimePicker.au3> #include <WindowsConstants.au3> #include <array.au3> #include <misc.au3> #include <WinAPISysWin.au3> ;~ Global $g_hDTP ;~ Global $array Global $aReturn[3][1] Global $dates[6][3] Global $date_data[10][10] ;~ Global $recover_date[6][3] Global $Check[10] $hGUI = GUICreate("(UDF Created) DateTimePick Create", 400, 400) $top = 20 For $i = 1 To 1 $Check[$i] = GUICtrlCreateCheckbox("activate", 10, $top, 150, 21) $top += 31 * 2 Next GUISetState(@SW_SHOW, $hGUI) While 1 ;~ _WinAPI_SetWindowLong ( $dates[1][1],$GWL_STYLE,0 ) ;~ _WinAPI_SetWindowLong ( $dates[1][1],$GWL_EXSTYLE,0 ) ;~ _WinAPI_SetWindowPos ( $dates[1][1],$hwnd_bottom,-1000,-1000,200,21,$SWP_NOACTIVATE) ;~ Sleep ( 5000 ) ;~ _WinAPI_SetWindowLong ( $dates[1][1],$GWL_STYLE,1375731712 ) ;~ _WinAPI_SetWindowLong ( $dates[1][1],$GWL_EXSTYLE,BitOR ($__UDFGUICONSTANT_WS_CHILD, $__UDFGUICONSTANT_WS_VISIBLE) ) ;~ Sleep ( 5000 ) $cursor = GUIGetCursorInfo() If IsArray($cursor) Then If $cursor[4] = $Check[1] Or _ $cursor[4] = $Check[2] Or _ $cursor[4] = $Check[3] Or _ $cursor[4] = $Check[4] Or _ $cursor[4] = $Check[5] Then Switch $cursor[4] Case $Check[1] If GUICtrlRead($Check[1]) = $GUI_CHECKED Then $cache = _GUICtrlDTP_GetSystemTime($dates[1][1]) If $cache[0] = 0 Then _draw_GUICtrlDTP($dates, $hGUI, 1, 2, 170, 20, 200, 21, 10, -1, 1) Else _GUICtrlDTP_Destroy($dates[1][1]) _GUICtrlDTP_Destroy($dates[1][2]) EndIf EndSwitch EndIf EndIf If _IsPressed("02") Then _ArrayDisplay($date_data) $msg = GUIGetMsg() Switch $msg Case -3 Exit Case Else EndSwitch WEnd Func _draw_GUICtrlDTP(ByRef $var, $hGUI, $for, $to, $lParam, $tParam, $wParam, $hparam, $holder = 30, $mode = -1, $2Dart = False, $3Dart = False) For $i = 1 To $to $var[$2Dart][$i] = _GUICtrlDTP_Create($hGUI, $lParam, $tParam, $wParam, $hparam) $tParam += $hparam + $holder Next GUIRegisterMsg($WM_NOTIFY, "WM_Date") EndFunc ;==>_draw_GUICtrlDTP Func WM_Date($hWnd, $iMsg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $array $tNMHDR = DllStructCreate($tagNMHDR, $lParam) ;Dll Struct $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) ;handle from Ctrl $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") ;ID Ctrl $iCode = DllStructGetData($tNMHDR, "Code") ;code from ctrl Switch $hWndFrom Case -1 Case Else If $iCode = $DTN_CLOSEUP Then $array = _GUICtrlDTP_GetSystemTime($hWndFrom) $aReturn[0][0] = "" $aReturn[0][0] &= $array[2] & "." $aReturn[0][0] &= $array[1] & "." $aReturn[0][0] &= $array[0] $aReturn[1][0] = $hWndFrom EndIf EndSwitch For $z = 1 To UBound($dates, 1) - 1 For $i = 1 To UBound($dates, 2) - 1 If $hWndFrom = $dates[$z][$i] Then $date_data[$z][$i] = $aReturn[0][0] Next Next Return $GUI_RUNDEFMSG EndFunc ;==>WM_Date I actually tried much with _winapi_setwindowlong but it doesn't disappear... it's just like disabled I tried it with _GUIctrlDTP_destroy too, like u can see - but i don't want to safe the Value of the _GUIctrlDTP_create and set it to the old... Attention! This is just a modified simple script and it should work with like 10 DTPs in a big GUI (that's where the arrays coming from ) Edited August 22, 2019 by Aelc why do i get garbage when i buy garbage bags?
Zedna Posted August 22, 2019 Posted August 22, 2019 (edited) ControlHide() / ControlShow() #include <GUIConstants.au3> #include <GuiDateTimePicker.au3> $Form1 = GUICreate('DTP', 400, 300) $hDTP = _GUICtrlDTP_Create($Form1, 10, 10, 150, 150 ) GUISetState(@SW_SHOW) Sleep(3000) ControlHide($Form1, '', $hDTP) Sleep(3000) ControlShow($Form1, '', $hDTP) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited August 22, 2019 by Zedna Aelc 1 Resources UDF ResourcesEx UDF AutoIt Forum Search
Aelc Posted August 22, 2019 Author Posted August 22, 2019 wait that actually works?! i already tried it in my main script but it didn't work so i was looking for other ways.. but then there was an error in my main script before maybe my bad... Thanks anyway why do i get garbage when i buy garbage bags?
Aelc Posted August 25, 2019 Author Posted August 25, 2019 Hey again i still have problems with it... i mean i tested your script and it works but i don't get it work in my script expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiDateTimePicker.au3> #include <WindowsConstants.au3> #include <array.au3> #include <misc.au3> #include <WinAPISysWin.au3> ;~ Global $g_hDTP ;~ Global $array Global $aReturn[3][1] Global $dates[6][3] Global $date_data[10][10] ;~ Global $recover_date[6][3] Global $Check[10] $hGUI = GUICreate("(UDF Created) DateTimePick Create", 400, 400) _draw_GUICtrlDTP($dates, $hGUI, 1, 2, 170, -1020, 200, 21, 10, -1, 1) _draw_GUICtrlDTP($dates, $hGUI, 1, 2, 170, -1020, 200, 21, 10, -1, 2) _draw_GUICtrlDTP($dates, $hGUI, 1, 2, 170, -1020, 200, 21, 10, -1, 3) _draw_GUICtrlDTP($dates, $hGUI, 1, 2, 170, -1020, 200, 21, 10, -1, 4) _draw_GUICtrlDTP($dates, $hGUI, 1, 2, 170, -1020, 200, 21, 10, -1, 5) $top = 20 For $i = 1 To 5 $Check[$i] = GUICtrlCreateCheckbox("activate", 10, $top, 150, 21) $top += 31 * 2 Next GUISetState(@SW_SHOW, $hGUI) While 1 $cursor = GUIGetCursorInfo() If IsArray($cursor) Then If $cursor[4] = $Check[1] Or _ $cursor[4] = $Check[2] Or _ $cursor[4] = $Check[3] Or _ $cursor[4] = $Check[4] Or _ $cursor[4] = $Check[5] Then Switch $cursor[4] Case $Check[1] If GUICtrlRead($Check[1]) = $GUI_CHECKED Then _WinAPI_SetWindowPos($dates[1][1], $hwnd_bottom, 170, 20, 200, 21, $SWP_NOACTIVATE) _WinAPI_SetWindowPos($dates[1][2], $hwnd_bottom, 170, 51, 200, 21, $SWP_NOACTIVATE) Else _WinAPI_SetWindowPos($dates[1][1], $hwnd_bottom, -1000, -1000, 200, 21, $SWP_NOACTIVATE) _WinAPI_SetWindowPos($dates[1][2], $hwnd_bottom, -1000, -1000, 200, 21, $SWP_NOACTIVATE) EndIf Case $Check[2] If GUICtrlRead($Check[2]) = $GUI_CHECKED Then _WinAPI_SetWindowPos($dates[2][1], $hwnd_bottom, 170, 20 + 62, 200, 21, $SWP_NOACTIVATE) _WinAPI_SetWindowPos($dates[2][2], $hwnd_bottom, 170, 51 + 62, 200, 21, $SWP_NOACTIVATE) Else _WinAPI_SetWindowPos($dates[2][1], $hwnd_bottom, -1000, -1000, 200, 21, $SWP_NOACTIVATE) _WinAPI_SetWindowPos($dates[2][2], $hwnd_bottom, -1000, -1000, 200, 21, $SWP_NOACTIVATE) EndIf Case $Check[3] If GUICtrlRead($Check[3]) = $GUI_CHECKED Then _WinAPI_SetWindowPos($dates[3][1], $hwnd_bottom, 170, 20 + 124, 200, 21, $SWP_NOACTIVATE) _WinAPI_SetWindowPos($dates[3][2], $hwnd_bottom, 170, 51 + 124, 200, 21, $SWP_NOACTIVATE) Else _WinAPI_SetWindowPos($dates[3][1], $hwnd_bottom, -1000, -1000, 200, 21, $SWP_NOACTIVATE) _WinAPI_SetWindowPos($dates[3][2], $hwnd_bottom, -1000, -1000, 200, 21, $SWP_NOACTIVATE) EndIf Case $Check[4] If GUICtrlRead($Check[4]) = $GUI_CHECKED Then _WinAPI_SetWindowPos($dates[4][1], $hwnd_bottom, 170, 20 + 186, 200, 21, $SWP_NOACTIVATE) _WinAPI_SetWindowPos($dates[4][2], $hwnd_bottom, 170, 51 + 186, 200, 21, $SWP_NOACTIVATE) Else _WinAPI_SetWindowPos($dates[4][1], $hwnd_bottom, -1000, -1000, 200, 21, $SWP_NOACTIVATE) _WinAPI_SetWindowPos($dates[4][2], $hwnd_bottom, -1000, -1000, 200, 21, $SWP_NOACTIVATE) EndIf Case $Check[5] If GUICtrlRead($Check[5]) = $GUI_CHECKED Then ;~ _WinAPI_SetWindowPos($dates[5][1], $hwnd_bottom, 170, 20 + 248, 200, 21, $SWP_NOACTIVATE) ;~ _WinAPI_SetWindowPos($dates[5][2], $hwnd_bottom, 170, 51 + 248, 200, 21, $SWP_NOACTIVATE) ControlShow ( $hGUI,"",$dates[5][1] ) ControlShow ( $hGUI,"",$dates[5][2] ) Else ControlHide ( $hGUI,"",$dates[5][1] ) ControlHide ( $hGUI,"",$dates[5][2] ) ;~ _WinAPI_SetWindowPos($dates[5][1], $hwnd_bottom, -1000, -1000, 200, 21, $SWP_NOACTIVATE) ;~ _WinAPI_SetWindowPos($dates[5][2], $hwnd_bottom, -1000, -1000, 200, 21, $SWP_NOACTIVATE) EndIf EndSwitch EndIf EndIf If _IsPressed("02") Then _ArrayDisplay($date_data) $msg = GUIGetMsg() Switch $msg Case -3 Exit Case Else EndSwitch WEnd Func _draw_GUICtrlDTP(ByRef $var, $hGUI, $for, $to, $lParam, $tParam, $wParam, $hparam, $holder = 30, $mode = -1, $2Dart = False, $3Dart = False) For $i = 1 To $to $var[$2Dart][$i] = _GUICtrlDTP_Create($hGUI, $lParam, $tParam, $wParam, $hparam) $tParam += $hparam + $holder Next GUIRegisterMsg($WM_NOTIFY, "WM_Date") EndFunc ;==>_draw_GUICtrlDTP Func WM_Date($hWnd, $iMsg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $array $tNMHDR = DllStructCreate($tagNMHDR, $lParam) ;Dll Struct $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) ;handle from Ctrl $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") ;ID Ctrl $iCode = DllStructGetData($tNMHDR, "Code") ;code from ctrl Switch $hWndFrom Case -1 Case Else If $iCode = $DTN_CLOSEUP Then $array = _GUICtrlDTP_GetSystemTime($hWndFrom) $aReturn[0][0] = "" $aReturn[0][0] &= $array[2] & "." $aReturn[0][0] &= $array[1] & "." $aReturn[0][0] &= $array[0] $aReturn[1][0] = $hWndFrom EndIf EndSwitch For $z = 1 To UBound($dates, 1) - 1 For $i = 1 To UBound($dates, 2) - 1 If $hWndFrom = $dates[$z][$i] Then $date_data[$z][$i] = $aReturn[0][0] Next Next Return $GUI_RUNDEFMSG EndFunc ;==>WM_Date the 5th don't work... Did i miss something? actually i tried to move them and it works but thats not clean i guess why do i get garbage when i buy garbage bags?
Aelc Posted August 25, 2019 Author Posted August 25, 2019 oops yea i missed to create the DTPs to the right position why do i get garbage when i buy garbage bags?
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