Jump to content

mLipok

MVPs
  • Posts

    11,869
  • Joined

  • Last visited

  • Days Won

    66

mLipok last won the day on March 29

mLipok had the most liked content!

About mLipok

  • Birthday 07/19/1978

Profile Information

  • Member Title
    Sometimes... even usually I'm nitpicky.
  • Location
    Europe, Poland, Upper Silesia, Zabrze
  • Interests
    ¯\_(ツ)_/¯

Recent Profile Visitors

30,464 profile views

mLipok's Achievements

  1. @WildByDesign you UDF is for _GUIDarkTheme_* .... ahhhh... wondering why not for Theme at all ? EDIT: rewordering: you UDF is for _GUIDarkTheme_* .... ahhhh... wondering why not for all possible Theme cases?
  2. Also here are some interesting findings: https://superuser.com/a/1435181/1049106 about Registry settings: also you may want to take a look here:
  3. Here is my another approach: #include <ColorConstants.au3> #include <GuiConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> _Example() Func _Example() Local $hGUI = GUICreate("Test", 400, 200, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_HSCROLL, $WS_VSCROLL)) GUISetBkColor($COLOR_LIGHTSEAGREEN, $hGUI) Local $hScrollBarGUI = _SBCreate($hGUI, 1000, 20, 30, 330, 30) #forceref $hScrollBarGUI ;~ GUIRegisterMsg($WM_CTLCOLORSCROLLBAR, __WM_CTLCOLORSCROLLBAR) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Example Func _SBCreate($hWnd, $idCtrlID, $iX, $iY, $iWidth, $iHeight, $iStyle = -1, $iExStyle = $WS_EX_TOPMOST, $bBorder = True) If $iStyle = -1 Then $iStyle = BitOR($WS_VISIBLE, $WS_CHILD) If $iExStyle = -1 Then $iExStyle = 0 If $bBorder Then Local $idLabel = GUICtrlCreateLabel("", $iX - 2, $iY - 2, $iWidth + 4, $iHeight + 4, $SS_BLACKRECT) GUICtrlSetColor($idLabel, $COLOR_LIGHTCORAL) EndIf Return _WinAPI_CreateWindowEx($iExStyle, $WC_SCROLLBAR, "", $iStyle, $iX, $iY, $iWidth, $iHeight, $hWnd, $idCtrlID, _WinAPI_GetModuleHandle(0), 0) EndFunc ;==>_SBCreate Func __WM_CTLCOLORSCROLLBAR($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam ;~ Return _WinAPI_GetStockObject($BLACK_BRUSH) ;~ Return _WinAPI_GetStockObject($DKGRAY_BRUSH) Return _WinAPI_GetStockObject($GRAY_BRUSH) ;~ Local $tItem = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) ; $tagNMLVCUSTOMDRAW is defined in #include <StructureConstants.au3> ; https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmlvcustomdraw ;~ Local $hDC = $tItem.hdc ; Device context ;~ Return _WinAPI_SetDCBrushColor($hDC, $COLOR_LIGHTBLUE) EndFunc ;==>__WM_CTLCOLORSCROLLBAR But I see that $WS_EX_TOPMOST is not working as I expected. I mean I can't click / move the ScrollBar created with _SBCreate() as my $idLabel is cover this scrollbar. Any body has better / easier way to draw border in specific color for this ScrollBar created with _SBCreate() ? Or just move Z order of the ScrollBar over the Label ?
  4. Little modified #include <ColorConstants.au3> #include <GuiConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> _Example() Func _Example() Local $hGUI = GUICreate("Test", 400, 200, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_HSCROLL, $WS_VSCROLL)) GUISetBkColor($COLOR_LIGHTSEAGREEN, $hGUI) Local $hScrollBarGUI = _SBCreate($hGUI, 1000, 20, 30, 330, 30) #forceref $hScrollBarGUI GUIRegisterMsg($WM_CTLCOLORSCROLLBAR, __WM_CTLCOLORSCROLLBAR) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Example Func _SBCreate($hWnd, $idCtrlID, $iX, $iY, $iWidth, $iHeight, $iStyle = -1, $iExStyle = -1) If $iStyle = -1 Then $iStyle = BitOR($WS_VISIBLE, $WS_CHILD) If $iExStyle = -1 Then $iExStyle = 0 Return _WinAPI_CreateWindowEx($iExStyle, $WC_SCROLLBAR, "", $iStyle, $iX, $iY, $iWidth, $iHeight, $hWnd, $idCtrlID, _WinAPI_GetModuleHandle(0), 0) EndFunc ;==>_SBCreate Func __WM_CTLCOLORSCROLLBAR($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam ;~ Return _WinAPI_GetStockObject($BLACK_BRUSH) ;~ Return _WinAPI_GetStockObject($DKGRAY_BRUSH) Return _WinAPI_GetStockObject($GRAY_BRUSH) ;~ Local $tItem = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) ; $tagNMLVCUSTOMDRAW is defined in #include <StructureConstants.au3> ; https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmlvcustomdraw ;~ Local $hDC = $tItem.hdc ; Device context ;~ Return _WinAPI_SetDCBrushColor($hDC, $COLOR_LIGHTBLUE) EndFunc ;==>__WM_CTLCOLORSCROLLBAR I read here: https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getstockobject about: For this reason I was trying to use my specific color like $COLOR_LIGHTBLUE in this part: Local $tItem = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) ; $tagNMLVCUSTOMDRAW is defined in #include <StructureConstants.au3> ; https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmlvcustomdraw Local $hDC = $tItem.hdc ; Device context Return _WinAPI_SetDCBrushColor($hDC, $COLOR_LIGHTBLUE) EndFunc ;==>__WM_CTLCOLORSCROLLBAR But with no success Any help please ? EDIT: also tried this way: Local Static $hBrush = _WinAPI_CreateSolidBrush($COLOR_AQUA) Local $tItem = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) ; $tagNMLVCUSTOMDRAW is defined in #include <StructureConstants.au3> ; https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmlvcustomdraw Local $hDC = $tItem.hdc ; Device context _WinAPI_SelectObject($hDC, $hBrush) Return $CDRF_SKIPDEFAULT EndFunc ;==>__WM_CTLCOLORSCROLLBAR Still with no success
  5. I want to ask if somebody already tried WM_CTLCOLORSCROLLBAR for changing color for ScrollBar ? Maybe someone already has a ready example?
  6. For example, I was thinking about creating an additional window with zero height or a height suitable for displaying a ScrollBar. This additional window could be displayed above the ListView window, or generally above the ListView, so the ListView could remain in the main GUI. Then somehow combine the scrolling of this additional window (maybe in WM_NOTIFY) with the moving of the invisible scrollbar for the Listview.
  7. Hello @Melba23 I just tried to use your example. just modified a little: #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include "GUIScrollbars_Ex.au3" $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0xFFCCCC) $cButton_1 = GUICtrlCreateButton("Recreate LV", 10, 450, 80, 30) GUISetState() $hAperture = GUICreate("", 400, 400, 50, 10, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xCCFFCC) $cLV = _CreateLV(10, 10) _GUIScrollbars_Generate($hAperture, 920, 0, 0, 0, False, 0, True) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton_1 ; Get current horizontal scroll position $iPos = _GUIScrollBars_GetScrollPos($hAperture, $SB_HORZ) ; Move to full left scroll _GUIScrollBars_SetScrollInfoPos($hAperture, $SB_HORZ, 0) Sleep(1000) ; These Sleep lines are just to slow the process for visualisation, they are not otherwise required ; Delete ListView GUICtrlDelete($cLV) Sleep(1000) ; Recreate ListView _CreateLV(50, 50) Sleep(1000) ; Scroll back to previous position _GUIScrollBars_SetScrollInfoPos($hAperture, $SB_HORZ, $iPos) EndSwitch WEnd Func _CreateLV($iX, $iY) $cListView = GUICtrlCreateListView("", $iX, $iY, 900, 300) GUICtrlSetBkColor($cListView, 0xCCCCFF) For $i = 0 To 8 _GUICtrlListView_AddColumn($cListView, "Column " & $i, 100) Next Return $cListView EndFunc ;==>_CreateLV I have 2 questions. Is there a way to use Horizontal scroll a the top of the $hAperture gui. and Is there a way to set different color fo the scroll bar ? maybe with WM_CTLCOLORSCROLLBAR ?
  8. https://www.codeproject.com/ is not available any more ?
  9. Here is my next example: ;~ https://www.autoitscript.com/forum/topic/213665-how-can-i-detect-if-a-control-is-within-a-tab-control #AutoIt3Wrapper_UseX64=n #include <GUIConstantsEx.au3> #include <GuiTab.au3> #include <WinAPITheme.au3> #include <WinAPISysWin.au3> ; initiate System DPI awareness DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2) Example() Func Example() Local $hGUI_Main = GUICreate("My GUI Tab", 220, 180) ConsoleWrite("$hGUI_Main= " & $hGUI_Main & @CRLF) GUISetBkColor(0x808080) GUISetFont(9, 300) Local $id_Tab_Main = GUICtrlCreateTab(10, 10, 200, 100) Local $h_Tab_Main = ControlGetHandle($hGUI_Main, "", $id_Tab_Main) ConsoleWrite("$id_Tab_Main= " & $id_Tab_Main & @CRLF) ConsoleWrite("$h_Tab_Main= " & $h_Tab_Main & @CRLF) ConsoleWrite("WIN GET HANDL= " & WinGetHandle($h_Tab_Main) & @CRLF) Local $id_Tab_0 = GUICtrlCreateTabItem("Tab 0") Local $id_CheckBox_0 = GUICtrlCreateCheckbox("Checkbox 0", 20, 50) Local $h_CheckBox_0 = ControlGetHandle($hGUI_Main, "", $id_CheckBox_0) ConsoleWrite("$id_Tab_0= " & $id_Tab_0 & @CRLF) ConsoleWrite("$h_CheckBox_0= " & $h_CheckBox_0 & @CRLF) ConsoleWrite("WIN GET HANDL= " & WinGetHandle($h_CheckBox_0) & @CRLF) Local $hParent = _WinAPI_GetParent($h_CheckBox_0) ConsoleWrite("$hParent= " & WinGetHandle($hParent) & @CRLF) ConsoleWrite("$GA_PARENT= " & _WinAPI_GetAncestor($h_CheckBox_0, $GA_PARENT) & @CRLF) ConsoleWrite("$GA_ROOT= " & _WinAPI_GetAncestor($h_CheckBox_0, $GA_ROOT) & @CRLF) ConsoleWrite("$GA_ROOTOWNER= " & _WinAPI_GetAncestor($h_CheckBox_0, $GA_ROOTOWNER) & @CRLF) Local $id_Tab_1 = GUICtrlCreateTabItem("Tab 1") Local $id_CheckBox_1 = GUICtrlCreateCheckbox("Checkbox 1", 20, 50) ConsoleWrite("$id_Tab_1= " & $id_Tab_1 & @CRLF) ConsoleWrite("$id_CheckBox_1= " & $id_CheckBox_1 & @CRLF) Local $id_Tab_2 = GUICtrlCreateTabItem("Tab 2") Local $id_CheckBox_2 = GUICtrlCreateCheckbox("Checkbox 2", 20, 50) ConsoleWrite("$id_Tab_2= " & $id_Tab_2 & @CRLF) ConsoleWrite("$id_CheckBox_2= " & $id_CheckBox_2 & @CRLF) Local $id_TAB_END = GUICtrlCreateTabItem("") ; end tabitem definition ConsoleWrite("! WARRNING FAKE ID : $id_TAB_END= " & $id_TAB_END & @CRLF) Local $id_TAB_END_DUMMY = GUICtrlCreateDummy() ConsoleWrite("$id_TAB_END_DUMMY= " & $id_TAB_END_DUMMY & @CRLF) Local $id_CheckBox_Out = GUICtrlCreateCheckbox("Checkbox outside the TAB area", 20, 120) ConsoleWrite("$id_CheckBox_Out= " & $id_CheckBox_Out & @CRLF) Local $id_DUMMY_END = GUICtrlCreateDummy() For $IDX = 0 To $id_DUMMY_END ConsoleWrite($IDX & " >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($IDX)) & " >>> " & ControlGetText($hGUI_Main, "", $IDX) & @CRLF) Next GUISetState(@SW_SHOW) Local $idMsg ; Loop until the user exits. While 1 $idMsg = GUIGetMsg() If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop ElseIf $idMsg > $id_Tab_0 And $idMsg < $id_Tab_1 Then ConsoleWrite("Clicked control: " & $idMsg & " on TAB 0 >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($idMsg)) & " >>> " & ControlGetText($hGUI_Main, "", $idMsg) & @CRLF) ElseIf $idMsg > $id_Tab_1 And $idMsg < $id_Tab_2 Then ConsoleWrite("Clicked control: " & $idMsg & " on TAB 1 >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($idMsg)) & " >>> " & ControlGetText($hGUI_Main, "", $idMsg) & @CRLF) ElseIf $idMsg > $id_Tab_2 And $idMsg < $id_TAB_END_DUMMY Then ConsoleWrite("Clicked control: " & $idMsg & " on TAB 2 >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($idMsg)) & " >>> " & ControlGetText($hGUI_Main, "", $idMsg) & @CRLF) EndIf WEnd #Region ; TAB DELETE TEST ConsoleWrite("DELETE TEST 0: " & $id_CheckBox_1 & " >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($id_CheckBox_1)) & " >>> " & ControlGetText($hGUI_Main, "", $id_CheckBox_1) & @CRLF) _GUICtrlTab_DeleteAllItems($id_Tab_Main) ConsoleWrite("DELETE TEST 1: " & $id_CheckBox_1 & " >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($id_CheckBox_1)) & " >>> " & ControlGetText($hGUI_Main, "", $id_CheckBox_1) & @CRLF) MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'Check what happens with CheckBoxes after TabItems was Deleted') GUICtrlDelete($id_Tab_Main) #QUESTION How AutoIt knows that deleting TAB control also internal checkboxes should be deleted ? ConsoleWrite("! DELETE TEST 2: " & $id_CheckBox_1 & " >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($id_CheckBox_1)) & " >>> " & ControlGetText($hGUI_Main, "", $id_CheckBox_1) & @CRLF) MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'Check what happens with CheckBoxes after Tab control was Deleted') #EndRegion ; TAB DELETE TEST EndFunc ;==>Example Take a look speciffically for #Region ; TAB DELETE TEST and
  10. Another question is why GUICtrlCreateTabItem("") does not immediately create a DUMMY control ID. Local $id_TAB_END = GUICtrlCreateTabItem("") ; end tabitem definition ConsoleWrite("! WARRNING FAKE ID : $id_TAB_END= " & $id_TAB_END & @CRLF) Local $id_TAB_END_DUMMY = GUICtrlCreateDummy() ConsoleWrite("$id_TAB_END_DUMMY= " & $id_TAB_END_DUMMY & @CRLF) It seemed to me that I understood that this ID was being created, because the HelpFile documentation does not mention that it should happen otherwise. what is your opinion?
  11. It seems that in C++, the programmer, as the application creator, determines by WM_NOTIFY that user is changing TAB from 0 to 1 and calls a function that hides or shows all controls inside TAB 0 or TAB 1. In this case, it seems that AutoIt handles this internally. You'd have to ask @jpm or @Jon about that .
  12. This isn't a good approach. A given control located in the same area as a TAB may be obscured by it or may obscure the TAB by being outside of that TAB's structure. Like in this following example #include <GUIConstantsEx.au3> #include <WinAPITheme.au3> ; initiate System DPI awareness DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2) Example() Func Example() GUICreate("My GUI Tab", 220, 110) GUISetBkColor(0x808080) GUISetFont(9, 300) Local $idTab = GUICtrlCreateTab(10, 10, 200, 100) GUICtrlCreateTabItem("tab0") GUICtrlCreateCheckbox("Checkbox 1", 20, 50) GUICtrlCreateTabItem("tab1") GUICtrlCreateTabItem("tab2") GUICtrlCreateTabItem("") ; end tabitem definition GUICtrlCreateCheckbox("Checkbox 2", 0, 0, 220, 110) GUISetState(@SW_SHOW) Local $idMsg ; Loop until the user exits. While 1 $idMsg = GUIGetMsg() If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example
  13. and maybe this MSDN article will be handy: https://learn.microsoft.com/en-us/windows/win32/controls/tab-controls?source=recommendations https://learn.microsoft.com/en-us/windows/win32/controls/tab-controls#default-tab-control-message-processing https://learn.microsoft.com/en-us/windows/win32/controls/tab-controls?source=recommendations#display-area
  14. just modified the example just try to click each CheckBox and observe the console
  15. Check also GUICtrlRead() In 'advanced' mode
×
×
  • Create New...