Jump to content

Search the Community

Showing results for tags 'WM_NOTIFY'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 11 results

  1. I have a LV with different coloured Cols: ;https://autoit.de/index.php/Thread/84279-Unterschiedliche-Textfarben-innerhalb-einer-ListView/?postID=674195#post674195 #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <array.au3> #include <ListViewConstants.au3> #include <StructureConstants.au3> #include <WindowsConstants.au3> $aColBK = IniReadSection(@ScriptDir & "\lv_format.ini", "ColBKColor") _ArrayDelete($aColBK, 0) ;_ArrayDisplay($aColBK) $aRowBK = IniReadSection(@ScriptDir & "\lv_format.ini", "RowBKColor") _ArrayDelete($aRowBK, 0) ;_ArrayDisplay($aColBK) $aColText = IniReadSection(@ScriptDir & "\lv_format.ini", "ColTextColor") _ArrayDelete($aColText, 0) ;_ArrayDisplay($aColBK) $aRowText = IniReadSection(@ScriptDir & "\lv_format.ini", "RowTextColor") _ArrayDelete($aRowText, 0) ;_ArrayDisplay($aRowText) $GUI = GUICreate("Listview Farbig", 1024, 300, 0, 0) ;<==== Breite geändert $cListView = GUICtrlCreateListView("", 2, 2, 1020, 294, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) ;<==== Breite geändert $hListView = GUICtrlGetHandle($cListView) For $i = 1 To 31 _GUICtrlListView_InsertColumn($hListView, $i - 1, $i, 25) _GUICtrlListView_SetColumnWidth($hListView, $i - 1, 32) ;<==== eingefügt für Spaltenbreite Next For $i = 0 To 21 ; alle Item/SubItem erstellen _GUICtrlListView_AddItem($hListView, "Item: " &$i, $i) For $j = 1 To 30 _GUICtrlListView_AddSubItem($hListView, $i, "Sub: "&$j, $j) Next Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() While True $msg = GUIGetMsg() Switch $msg Case -3 ExitLoop EndSwitch WEnd Func WM_NOTIFY($hWnd, $msg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CUSTOMDRAW Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) Local $iDrawStage, $iItem, $iSubitem, $hDC, $tRect $iDrawStage = DllStructGetData($tCustDraw, 'dwDrawStage') Switch $iDrawStage Case $CDDS_ITEMPREPAINT Return $CDRF_NOTIFYSUBITEMDRAW Case BitOR($CDDS_ITEMPREPAINT, $CDDS_SUBITEM) ; Item/SubItem das aktuell gezeichnet werden soll ermitteln $iItem = DllStructGetData($tCustDraw, 'dwItemSpec') $iSubitem = DllStructGetData($tCustDraw, 'iSubItem') Switch $iItem ; Zeilenwahl Case -1 ;kommt nicht vor ist aber notwendig, damit case else verwendet werden kann Case Else $iIndex = _ArraySearch($aRowBK, $iItem, 0, 0, 0, 0, 1, 0) If $iIndex = -1 Then ;nicht im Array für spezielle Zeilen also weiß DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR(0xFFFFFF)) Else DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aRowBK[$iIndex][1])) ;ConsoleWrite('Item '&$iItem&' BK: '&$aRowBK[$iIndex][1] & @CRLF) EndIf $iIndex = _ArraySearch($aRowText, $iItem, 0, 0, 0, 0, 1, 0) If $iIndex = -1 Then ;nicht im Array für spezielle Zeilen also schwarz DllStructSetData($tCustDraw, 'clrText', RGB2BGR(0x000000)) Else DllStructSetData($tCustDraw, 'clrText', RGB2BGR($aRowText[$iIndex][1])) ;ConsoleWrite('Item '&$iItem&' Text: '&$aRowText[$iIndex][1] & @CRLF) EndIf EndSwitch Switch $iSubitem Case -1 ;kommt nicht vor ist aber notwendig, damit case else verwendet werden kann Case Else $iIndex = _ArraySearch($aColBK, $iSubitem, 0, 0, 0, 0, 1, 0) If $iIndex <> -1 Then DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aColBK[$iIndex][1])) ;ConsoleWrite('SubItem '&$iSubitem&' BK: '&$aColBK[$iIndex][1] & @CRLF) EndIf $iIndex = _ArraySearch($aColText, $iSubitem, 0, 0, 0, 0, 1, 0) If $iIndex <> -1 Then DllStructSetData($tCustDraw, 'clrText', RGB2BGR($aColText[$iIndex][1])) ;ConsoleWrite('SubItem '&$iSubitem&' Text: '&$aColText[$iIndex][1] & @CRLF) EndIf EndSwitch Return $CDRF_NEWFONT EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func RGB2BGR($iColor) Local $sH = Hex($iColor, 6) Return '0x' & StringRight($sH, 2) & StringMid($sH, 3, 2) & StringLeft($sH, 2) EndFunc ;==>RGB2BGR i use lv_format.ini for defining the cols Background- and Textcolour. Now i want to colour the cols in the LV-Header also, but i can't figure it out.
  2. Hi. Attempting to catch and process a keystroke in a GUI window. Here's the code: ; ---------------------------------------------------------------------- ; | Library includes ; ---------------------------------------------------------------------- #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> #include <WinAPISys.au3> #include <WinAPIvkeysConstants.au3> #include <GuiButton.au3> global $g_MainGUI CreateMainGUI() ; ---------------------------------------------------------------------- func CreateMainGUI() $g_MainGUI = GUICreate("Test", 600, 600, -1, -1) ; $b = _GUICtrlButton_Create($g_MainGUI, "Foo", 10, 10, 100, 30) ; <--- Line #21 $lv = _GUICtrlListView_Create($g_MainGUI, "", 50, 50, 100, 100) ; <--- Line #22 GUISetState(@SW_SHOW, $g_MainGUI) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") do ; until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() endfunc ; ---------------------------------------------------------------------- func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) local $hdr = DllStructCreate($tagNMHDR, $lParam) local $from = HWnd(DllStructGetData($hdr, "hWndFrom")) local $id = DllStructGetData($hdr, "IDFrom") local $event = DllStructGetData($hdr, "Code") ; Exit on [ctrl-Q] if ($event = $LVN_KEYDOWN) then $info = DllStructCreate($tagNMLVKEYDOWN, $lParam) $vkey = DllStructGetData($info, "VKey") if ($vkey = 0x51) and BitAND(_WinAPI_GetKeyState($VK_CONTROL), 0x8000) then ConsoleWrite('[ctrl-Q]' & @CRLF) ; <--- Line #48 _SendMessage($g_MainGUI, $GUI_EVENT_CLOSE) endif endif return $GUI_RUNDEFMSG endfunc There are two things about this code that don't work the way I expected, and I've been unable to figure out why: 1) As it stands, the code creates a GUI window, then a ListView. If I run it then immediately press ctrl-Q, the keystroke triggers WM_NOTIFY(). I know that because if I run in SciTE, '[ctrl-Q]' appears in the console window, so the ConsoleWrite() call on line #48 must have executed. If I comment out the _GUICtrlListView_Create() call on line #22 and uncomment line #21 so that a Button is created instead, then run it, WM_NOTIFY() is never triggered. Why the difference? Doesn't the GUIRegisterMsg() call register WM_NOTIFY on behalf of the parent GUI? Why does it work with one control type, but not the other? 2) In the case with the ListView control, where it does catch the ctrl-Q, it executes _SendMessage($g_MainGUI, $GUI_EVENT_CLOSE). In my simple mind, I'd have thought that would send the $GUI_EVENT_CLOSE message to the main GUI and cause it to exit the do/until loop. But evidently not? Because it doesn't. Thanks in advance. Just when I think I understand ... /John
  3. I have several context menus that's been built using _GUICtrlMenu_CreatePopup() and _GUICtrlMenu_AddMenuItem(). When using _GUICtrlMenu_CreatePopup() it returns the identifier of the clicked item, sure. But it blocks the main loop while the menu is open. When using _GUICtrlMenu_CreatePopup($MNS_MODELESS) it returns immediately (of course), but I cannot figure out how/where to read the item that was clicked. Is there a Windows Message (WM) somewhere that is triggered? I've spend an entire day trying to figure out how to do this, but I'm not getting anywhere. My google fu is depleted (I must have tried like hundreds of script variations today), I'm about to smash my keyboard and just go to bed, and abandon the entire endeavor of making pretty menus and go back to using Koda and forget about using menu icons, colors, etc. Anyone wanna help me out with how to read the clicked item? Before I smash my keyboard, please... Example script here: #include <GuiMenu.au3> #include <WinAPIError.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> GUIRegisterMsg($WM_CONTEXTMENU, "_WM_CONTEXTMENU") Global $idMenuItem = 10000, $counter = 0 Global $hGUI = GUICreate("Menu test", 400, 300) Global $hListview = GUICtrlCreateListView("", 2, 2, 396, 200) GUISetState(@SW_SHOW) ;~ Global $hMenuContext = _GUICtrlMenu_CreatePopup() Global $hMenuContext = _GUICtrlMenu_CreatePopup($MNS_MODELESS) _GUICtrlMenu_AddMenuItem($hMenuContext, "Menu item", $idMenuItem) Global $hTimer = TimerInit() Do If TimerDiff($hTimer)>200 Then $counter += 1 ConsoleWrite($counter & " " ) $hTimer = TimerInit() EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE Exit Func _WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch $wParam Case GUICtrlGetHandle($hListview) ConsoleWrite( @CRLF & "_GUICtrlMenu_TrackPopupMenu = " & _GUICtrlMenu_TrackPopupMenu($hMenuContext, $wParam, -1, -1, 1, 1, 2) & @CRLF) EndSwitch EndFunc
  4. Hi Best example I could find is here ::/html/libfunctions/_GUICtrlTreeView_ClickItem.htm The way I understand this, the standard Windows messages, such as Left/Right Click etc are covered by AutoIt macros, but the real power is locked up inside this WM_NOTIFY . I have tried, but I am not even sure I understand what I am looking at. I need help understanding this. What I am looking for is Help file or Tutorial explaining how this works? Perhaps if there is a script showing both the working of an AutoIt macro and the WM_NOTIFY in action, it would help. Right now I am so lost, I do not even know what are the right questions to ask. One issue I have is on ListViews, how to combine the "Click" of a line with a standard Switch loop? Like users clicks a line, then get the loop to detect the click and ;do something ... Any ideas? Skysnake
  5. Hi all, I am trying to get the selected item text from a tree view control. For that i am using this code. Please take a look. In this code, i am using console write function so that i am able to know that the user clicks in an item. This code works perfectly at the first click. But when i click on an item second time, it will work twice, That means, console write will work twice. Same result is at the third and fourth click also. Func TreeView_WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview $hWndTreeview = $tv1 If Not IsHWnd($tv1) Then $hWndTreeview = GUICtrlGetHandle($tv1) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeview Switch $iCode Case $TVN_SELCHANGINGW ConsoleWrite("Clicked" & @CRLF) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
  6. Hey guys, After much searching and reading I Siao's example script from the below link is the closest to what I need to do. I have a ListView that is populated with the names of different configurations. When a Listview item is selected, a form is populated with that items data. Right now I have a column that shows which item's data is shown in the form, but it would be much cleaner to just have the current item highlighted. My problem is this - The highlighting in Siao's example works great, but inside the Listview when you select in the "empty" space to essentially deselect everything the highlighting disappears. How can I keep the last selected item highlighted when clicking in this empty space? Also - I do not understand enough about Windows notifications to understand if we could utilize SendMessage to initiate a custom draw.... It seems to me that you could specify an item and then invoke the DLL function to redraw the item that you specified with the colors that you specified.... That's the idea I get when I read the MSDN documentation on it: https://msdn.microsoft.com/en-us/library/windows/desktop/ff919573(v=vs.85).aspx Siao's Example modified for latest AutoIt: #Include <GuiConstantsEx.au3> #Include <GuiListView.au3> #include <WindowsConstants.au3> #cs ;custom draw constants Global Const $CDDS_ITEM = 0x10000 Global Const $CDDS_MAPPART = 0x5 Global Const $CDDS_POSTERASE = 0x4 Global Const $CDDS_POSTPAINT = 0x2 Global Const $CDDS_PREERASE = 0x3 Global Const $CDDS_PREPAINT = 0x1 Global Const $CDDS_SUBITEM = 0x20000 Global Const $CDDS_ITEMPOSTERASE = BitOR($CDDS_ITEM, $CDDS_POSTERASE) Global Const $CDDS_ITEMPOSTPAINT = BitOR($CDDS_ITEM, $CDDS_POSTPAINT) Global Const $CDDS_ITEMPREERASE = BitOR($CDDS_ITEM, $CDDS_PREERASE) Global Const $CDDS_ITEMPREPAINT = BitOR($CDDS_ITEM, $CDDS_PREPAINT) Global Const $CDIS_CHECKED = 0x8 Global Const $CDIS_DEFAULT = 0x20 Global Const $CDIS_DISABLED = 0x4 Global Const $CDIS_FOCUS = 0x10 Global Const $CDIS_GRAYED = 0x2 Global Const $CDIS_HOT = 0x40 Global Const $CDIS_INDETERMINATE = 0x100 Global Const $CDIS_MARKED = 0x80 Global Const $CDIS_SELECTED = 0x1 Global Const $CDIS_SHOWKEYBOARDCUES = 0x200 Global Const $CDRF_DODEFAULT = 0x0 Global Const $CDRF_NEWFONT = 0x2 Global Const $CDRF_NOTIFYITEMDRAW = 0x20 Global Const $CDRF_NOTIFYPOSTERASE = 0x40 Global Const $CDRF_NOTIFYPOSTPAINT = 0x10 Global Const $CDRF_NOTIFYSUBITEMDRAW = 0x20 Global Const $CDRF_SKIPDEFAULT = 0x4 #ce ;fonts for custom draw example ;bold Global $aFont1 = DLLCall("gdi32.dll","int","CreateFont", "int", 14, "int", 0, "int", 0, "int", 0, "int", 700, _ "dword", 0, "dword", 0, "dword", 0, "dword", 0, "dword", 0, "dword", 0, "dword", 0, _ "dword", 0, "str", "") ;italic Global $aFont2 = DLLCall("gdi32.dll","int","CreateFont", "int", 14, "int", 0, "int", 0, "int", 0, "int", 400, _ "dword", 1, "dword", 0, "dword", 0, "dword", 0, "dword", 0, "dword", 0, "dword", 0, _ "dword", 0, "str", "") $GUI = GUICreate("Listview Custom Draw", 400, 300) $cListView = GUICtrlCreateListView("", 2, 2, 394, 268, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) $hListView = GUICtrlGetHandle($cListView) _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100) _GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100) ; Add items For $i = 1 To 30 _GUICtrlListView_AddItem($hListView, "Row" & $i & ": Col 1", $i-1) For $j = 1 To 2 _GUICtrlListView_AddSubItem ($hListView, $i-1, "Row" & $i & ": Col " & $j+1, $j) Next Next GUICtrlCreateInput("", 50, 275, 100, 15) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE DLLCall("gdi32.dll","int","DeleteObject", "hwnd", $aFont1[0]) DLLCall("gdi32.dll","int","DeleteObject", "hwnd", $aFont2[0]) Exit Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CUSTOMDRAW If Not _GUICtrlListView_GetViewDetails($hWndFrom) Then Return $GUI_RUNDEFMSG Local $tCustDraw = DllStructCreate('hwnd hwndFrom;int idFrom;int code;' & _ 'dword DrawStage;hwnd hdc;long rect[4];dword ItemSpec;int ItemState;dword Itemlparam;' & _ 'dword clrText;dword clrTextBk;int SubItem;' & _ 'dword ItemType;dword clrFace;int IconEffect;int IconPhase;int PartID;int StateID;long rectText[4];int Align', _ ;winxp or later $lParam), $iDrawStage, $iItem, $iSubitem, $hDC, $tRect, $iColor1, $iColor2, $iColor3 $iDrawStage = DllStructGetData($tCustDraw, 'DrawStage') Switch $iDrawStage Case $CDDS_PREPAINT Return $CDRF_NOTIFYITEMDRAW Case $CDDS_ITEMPREPAINT Return $CDRF_NOTIFYSUBITEMDRAW Case $CDDS_ITEMPOSTPAINT Case BitOR($CDDS_ITEMPREPAINT, $CDDS_SUBITEM) $iItem = DllStructGetData($tCustDraw, 'ItemSpec') $iSubitem = DllStructGetData($tCustDraw, 'SubItem') If _GUICtrlListView_GetItemSelected($hWndFrom, $iItem) Then $hDC = _WinAPI_GetDC($hWndFrom) $tRect = DllStructCreate('long;long;long;long') If $iSubitem = 0 Then DllCall('user32.dll','int','SendMessage', 'hwnd',$hWndFrom, 'uint',$LVM_GETSUBITEMRECT, 'wparam',$iItem, 'lparam',DllStructGetPtr($tRect)) DllStructSetData($tRect, 1, 2) DllCall('user32.dll', 'int', 'FillRect', 'ptr', $hDC, 'ptr', DllStructGetPtr($tRect), 'int', _WinAPI_GetStockObject(4)) EndIf DllStructSetData($tRect, 1, 2) DllStructSetData($tRect, 2, $iSubitem) DllCall('user32.dll','int','SendMessage', 'hwnd',$hWndFrom, 'uint',$LVM_GETSUBITEMRECT, 'wparam',$iItem, 'lparam',DllStructGetPtr($tRect)) Local $sText = _GUICtrlListView_GetItemText($hWndFrom, $iItem, $iSubitem) DLLCall("gdi32.dll","int","SetTextColor", "ptr", $hDC, "int", RGB2BGR(0xffff00)) DLLCall("gdi32.dll","int","SetBkMode", "ptr", $hDC, "int", 1) DllStructSetData($tRect, 1, DllStructGetData($tRect, 1)+2) _WinAPI_DrawText($hDC, $sText, $tRect, 0x8000) ;; $DT_END_ELLIPSIS _WinAPI_ReleaseDC($hWndFrom, $hDC) Return $CDRF_SKIPDEFAULT EndIf Switch $iItem Case 0 To 9 ;for rows 1-10 lets do this $iColor1 = RGB2BGR(0xFBFFD8) $iColor2 = RGB2BGR(-1) $iColor3 = RGB2BGR(0xFF0000) If Mod($iSubitem, 2) Then ;odd columns DllStructSetData($tCustDraw, 'clrTextBk', $iColor1) DllStructSetData($tCustDraw, 'clrText', 0) Else ;even columns DllStructSetData($tCustDraw, 'clrTextBk', $iColor2) DllStructSetData($tCustDraw, 'clrText', $iColor3) EndIf Case 10 To 19 ;for rows 11-20 lets do this $iColor1 = RGB2BGR(0xFBFFD8) $iColor2 = RGB2BGR(0x3DF8FF) $hDC = DllStructGetData($tCustDraw, 'hdc') If Mod($iItem, 2) Then If Mod($iSubitem, 2) Then DllStructSetData($tCustDraw, 'clrTextBk', $iColor1) Else DllStructSetData($tCustDraw, 'clrTextBk', $iColor2) EndIf DLLCall("gdi32.dll","hwnd","SelectObject", "hwnd", $hDC, "hwnd", $aFont1[0]) ;select our chosen font into DC Else If Mod($iSubitem, 2) Then DllStructSetData($tCustDraw, 'clrTextBk', $iColor2) Else DllStructSetData($tCustDraw, 'clrTextBk', $iColor1) EndIf DLLCall("gdi32.dll","hwnd","SelectObject", "hwnd", $hDC, "hwnd", $aFont2[0]) EndIf Case 20 To 29 ;for rows 21-30 lets do this $iColor1 = RGB2BGR(0xFBFFD8) $iColor2 = RGB2BGR(-1) If Mod($iItem, 2) Then ;odd rows DllStructSetData($tCustDraw, 'clrTextBk', $iColor2) Else DllStructSetData($tCustDraw, 'clrTextBk', $iColor1) EndIf EndSwitch Return $CDRF_NEWFONT Case BitOR($CDDS_ITEMPOSTPAINT, $CDDS_SUBITEM) Case Else EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func RGB2BGR($iColor) Return BitAND(BitShift(String(Binary($iColor)), 8), 0xFFFFFF) EndFunc Source:
  7. I have a script that writes a message to the console whenever a WM_NOTIFY event is detected. but I don't get the events. Here is my test script: Opt("GUICloseOnESC", 1) ; ESC closes GUI Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Opt('MustDeclareVars', 1) OnAutoItExitRegister("ExitStageLeft") #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $hMainWin _Main() Func _Main() $hMainWin = GUICreate("test", 300, 300) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, 'ExitStageLeft') GUISetState() While (1) Sleep(250) WEnd EndFunc ;==>_Main Func ExitStageLeft() Exit (1) EndFunc ;==>ExitStageLeft Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ConsoleWrite("+++: WM_NOTIFY(" & Hex($hWnd) & "|" & Hex($iMsg) & "|" & Hex($iwParam) & "|" & Hex($ilParam) & ") entered" & @CRLF) EndFunc ;==>WM_NOTIFY
  8. Issue: If either date picker controls receive focus, then use arrow keys to change date in edit portion, flags do not set to True until mouse move or mouse click. I have used this exact method in the past & it works perfectly. I just can't figure out what I am doing wrong here. The only thing different I can think of is I just updated my Autoit version to ;Autoit v3.3.14.0 & if it matters system I am using is running Win7 Pro x86. #include <WindowsConstants.au3> #include <GuiRichEdit.au3> #include <Date.au3> #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> ;If either date picker controls recieve focus, then use arrow keys to change date ; in edit portion, flags do not set to True until mouse move or mouse click. ;Flags set fine when drop down is closed Global $fdpLogChange = False, $fdpMainChange = False Global $hDailyLogGUI, $g_id_dpDailyLog Global $hMainGui = GUICreate("GardenBuddy", @DesktopWidth / 1.5, @DesktopHeight / 1.4, -1, -1) Global $g_id_dpMain = GUICtrlCreateDate(_NowDate(), 8, 20, 181, 25) Global $mView = GUICtrlCreateMenu("&View") Global $mPlantChart = GUICtrlCreateMenuItem("Plant Chart", $mView, 0) GUICtrlCreateMenuItem("", $mView, 1) Global $mDailyLog = GUICtrlCreateMenuItem("Daily Log", $mView, 2) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $Msg = GUIGetMsg(1) Switch $Msg[1] Case $hMainGui Switch $Msg[0] Case $GUI_EVENT_CLOSE GUIDelete($hMainGui) Exit Case $mDailyLog __CreateDailyLog() Case Else If $fdpMainChange = True Then __DateChangeMain() EndSwitch Case $hDailyLogGUI Switch $Msg[0] Case $GUI_EVENT_CLOSE GUIDelete($hDailyLogGUI) Case Else If $fdpLogChange = True Then __DateChangeDL() EndSwitch EndSwitch WEnd Func __CreateDailyLog() Local $iW = @DesktopWidth / 2, $iH = @DesktopHeight / 2 $hDailyLogGUI = GUICreate("Daily Log", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW) $g_reDailyLog = _GUICtrlRichEdit_Create($hDailyLogGUI, "", 0, 60, $iW, $iH - 110, _ BitOR($WS_VSCROLL, $ES_WANTRETURN, $ES_AUTOVSCROLL, $ES_MULTILINE)) _GUICtrlRichEdit_SetFont($g_reDailyLog, 12) $g_id_dpDailyLog = GUICtrlCreateDate(_NowDate(), 8, 20, 181, 25) GUISetState() EndFunc ;==>__CreateDailyLog Func __DateChangeDL();Would like to be instantly notified if user changes the date through any means. $fdpLogChange = False ConsoleWrite("Log Changed" & @CRLF) EndFunc ;==>__DateChangeDL Func __DateChangeMain() $fdpMainChange = False ConsoleWrite("Main Changed" & @CRLF) EndFunc ;==>__DateChangeMain Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $hWndDateDailyLog, $hWndDateMain $hWndDateDailyLog = GUICtrlGetHandle($g_id_dpDailyLog) $hWndDateMain = GUICtrlGetHandle($g_id_dpMain) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndDateDailyLog, $hWndDateMain Switch $iCode Case $DTN_DATETIMECHANGE If $iIDFrom = $g_id_dpDailyLog Then $fdpLogChange = True If $iIDFrom = $g_id_dpMain Then $fdpMainChange = True Return 0 Case $DTN_CLOSEUP ;no return value Case $DTN_USERSTRING Return 0 Case $DTN_WMKEYDOWN Return 0 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
  9. Added WM_NOTIFY to my code to handle events from a couple controls (Toolbar button clicks and Treeview events) Simply defining WM_NOTIFY and putting in the function makes my GUI go crazy when I resize it, more so when I maximize. If I comment out all the WM_NOTIFY code - it resizes and runs correctly. Any advice? (The code below runs correctly, to see the problem uncomment the WM_NOTIFY function.) Edit**** I have verified that this isn't anything inside of the WM_NOTIFY function. It is simply the function itself. If you uncomment only the function, the force ref, the return and the endfunc. It will still produce the same issue when you maximize / resize the window. #Region Includes #include <winapi.au3> #include <WinAPIEx.au3> #include <GuiToolbar.au3> #include <GuiImageList.au3> #include <GUIConstants.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GUITab.au3> #include <GuiTreeView.au3> #EndRegion AutoItSetOption('MouseCoordMode', 2) GUIRegisterMsg($WM_SIZE, "WM_SIZE") ;~ GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") #Region Vars ;Only Tested on Win7 64 machine Local $fIconsLoc1 = "imageres.dll" Local $fIconsLoc2 = "Resources\Icons\Undo.ico" Global $aStrings[12] Local $iNew,$iBrowse,$iEdit,$iDelete,$iSave,$iPrint Global Enum $e_new =1000, $e_edit, $e_delete, $e_save, $e_print, $e_undo Global $aOffsets_1, $aOffsets_inner1,$aOffsets_inner2 Global $iItem, $cTreeView1, $cTreeView2 ; Icon Index from DLL $iNew = 2 ;$iBrowse = 202 $iEdit = 111 $iDelete = 84 $iSave = 23 $iPrint = 46 $iGuiWidth = 660 $iGUIHeight = 320 $DividerOffset = 250 Global $aOffsets_1[2],$aOffsets_inner1[2],$aOffsets_inner2[2] $BkColor = 0xf0f0f0 ;Create Form, Toobar and ImageList $hGui = GUICreate("EDM and CNC Schedule",$iGuiWidth,$iGUIHeight,-1,-1, BitOR($WS_OVERLAPPEDWINDOW, $WS_POPUP,$WS_CLIPCHILDREN)) _WinAPI_SetClassLongEx($hGui, $GCL_STYLE, BitAND(_WinAPI_GetClassLongEx($hGui, $GCL_STYLE), BitNOT(1), BitNOT(2))) GUISetState() Global $hToolbar1 = _GUICtrlToolbar_Create($hGui) $imgs = _GUIImageList_Create(32,32,5) ; change first 2 params to Size the icons accordingly. #EndRegion Vars #Region Toolbar ;Populate Image List _GUIImageList_AddIcon($imgs, $fIconsLoc1,$iNew,True) _GUIImageList_AddIcon($imgs, $fIconsLoc1,$iEdit,True) _GUIImageList_AddIcon($imgs, $fIconsLoc1,$iDelete,True) _GUIImageList_AddIcon($imgs, $fIconsLoc1,$iSave,True) _GUIImageList_AddIcon($imgs, $fIconsLoc1,$iPrint,True) _GUIImageList_AddIcon($imgs, $fIconsLoc2,0,True) ;Add Text to Buttons in Toolbar $aStrings[0] = _GUICtrlToolbar_AddString($hToolbar1, "&New") $aStrings[1] = _GUICtrlToolbar_AddString($hToolbar1, "&Edit") $aStrings[2] = _GUICtrlToolbar_AddString($hToolbar1, "&Delete") $aStrings[3] = _GUICtrlToolbar_AddString($hToolbar1, "&Save") $aStrings[4] = _GUICtrlToolbar_AddString($hToolbar1, "&Print") $aStrings[5] = _GUICtrlToolbar_AddString($hToolbar1, "&Undo") ;Set Imagelist of Toolbar to my ImageList $t = _GUICtrlToolbar_SetImageList($hToolbar1, $imgs) ;Add buttons to toolbar $cBtn_New = _GUICtrlToolbar_AddButton($hToolbar1, $e_new, 0,$aStrings[0]) $cBtn_Edit =_GUICtrlToolbar_AddButton($hToolbar1, $e_edit, 1,$aStrings[1]) $cBtn_Delete =_GUICtrlToolbar_AddButton($hToolbar1, $e_delete, 2,$aStrings[2]) $cBtn_Save =_GUICtrlToolbar_AddButton($hToolbar1, $e_save, 3,$aStrings[3]) $cBtn_Print =_GUICtrlToolbar_AddButton($hToolbar1, $e_print, 4,$aStrings[4]) $cBtn_Undo =_GUICtrlToolbar_AddButton($hToolbar1, $e_undo, 5,$aStrings[5]) GUISetState() #EndRegion Toolbar #Region Create Tabs $hGui1 = GUICreate("",$iGuiWidth-10,$iGUIHeight-70,-1,60, $WS_POPUP, $WS_EX_MDICHILD, $hgui) ; Create top level Tab Items $hTab1 = GUICtrlCreateTab(-1,1,665,265) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKBOTTOM, $GUI_DOCKWIDTH,$GUI_DOCKRIGHT)) $hTab1_0 = GUICtrlCreateTabItem("Schedule1") ;cTreeView 1 $cTreeView1 = GUICtrlCreateTreeView(0, 25, 245, 225, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1,BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKBOTTOM, $GUI_DOCKWIDTH)) ;Set TreeView Data $generalitem = GUICtrlCreateTreeViewItem("parent1", $cTreeView1) GUICtrlSetColor(-1, 0x0000C0) $displayitem = GUICtrlCreateTreeViewItem("parent2", $cTreeView1) GUICtrlSetColor(-1, 0x0000C0) GUICtrlCreateTreeViewItem("node1", $generalitem) GUICtrlCreateTreeViewItem("node2", $generalitem) GUICtrlCreateTreeViewItem("node3", $generalitem) GUICtrlCreateTreeViewItem("node4", $displayitem) GUICtrlCreateTreeViewItem("node5", $displayitem) GUICtrlSetState($generalitem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)) GUICtrlSetState($displayitem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)) GUISetState() $hTab1_1 = GUICtrlCreateTabItem("Schedule2 ") ;cTreeView 2 $cTreeView2 = GUICtrlCreateTreeView(0, 25, 245, 225, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_SHOWSELALWAYS),$WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1,BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKBOTTOM, $GUI_DOCKWIDTH)) $generalitem = GUICtrlCreateTreeViewItem("parent1a", $cTreeView2) GUICtrlSetColor(-1, 0x0000C0) $displayitem = GUICtrlCreateTreeViewItem("parent2a", $cTreeView2) GUICtrlSetColor(-1, 0x0000C0) GUICtrlCreateTreeViewItem("node1", $generalitem) GUICtrlCreateTreeViewItem("node2", $generalitem) GUICtrlCreateTreeViewItem("node3", $generalitem) GUICtrlCreateTreeViewItem("node4", $displayitem) GUICtrlCreateTreeViewItem("node5", $displayitem) GUICtrlSetState($generalitem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)) ; Expand the "General"-item and paint in bold GUICtrlSetState($displayitem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)) ; Expand the "Display"-item and paint in bold. GUICtrlCreateTabItem("") GUISetState() ;Create Inner GUI to hold the listviews for first tab $hGuiInner1 = GUICreate("", 403, 225, 252,28, $WS_POPUP, $WS_EX_MDICHILD, $hgui1) $hTab2 = GUICtrlCreateTab(0,0,403,225) $hTab2_0 = GUICtrlCreateTabItem("1 ") $ListView5 = GUICtrlCreateListView("col1|col2|col3", 0, 20, 403, 205) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKBOTTOM, $GUI_DOCKRIGHT)) $hTab2_1 = GUICtrlCreateTabItem("2") $ListView6 = GUICtrlCreateListView("col1|col2|col3", 0, 20, 403, 205) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKBOTTOM, $GUI_DOCKRIGHT)) GUICtrlCreateTabItem("") GUISetState() ;Create Inner GUI to hold the listviews for second tab $hGuiInner2 = GUICreate("", 403, 225, 252,28, $WS_POPUP, $WS_EX_MDICHILD, $hgui1) $hTab3 = GUICtrlCreateTab(0,0,403,225) $hTab3_0 = GUICtrlCreateTabItem("1") $ListView7 = GUICtrlCreateListView("col1|col2|col3", 0, 20, 403, 205) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKBOTTOM, $GUI_DOCKRIGHT)) $hTab3_1 = GUICtrlCreateTabItem("2") $ListView8 = GUICtrlCreateListView("col1|col2|col3", 0, 20, 403, 205) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKBOTTOM, $GUI_DOCKRIGHT)) $hTab3_2 = GUICtrlCreateTabItem("3") $ListView9 = GUICtrlCreateListView("col1|col2|col3", 0, 20, 403, 205) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKBOTTOM, $GUI_DOCKRIGHT)) $hTab3_3 = GUICtrlCreateTabItem("4") $ListView10 = GUICtrlCreateListView("col1|col2|col3", 0, 20, 403, 205) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKBOTTOM, $GUI_DOCKRIGHT)) $hTab3_4 = GUICtrlCreateTabItem("5") $ListView11 = GUICtrlCreateListView("col1|col2|col3", 0, 20, 403, 205) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKBOTTOM, $GUI_DOCKRIGHT)) GUICtrlCreateTabItem("") GUISetState() $aOffsets_1 = _GetGuiOffset($hGUI1) $aOffsets_inner1 = _GetGuiOffset($hGuiInner1) $aOffsets_inner2 = _GetGuiOffset($hGuiInner2) #EndRegion End tabs #Region GUI Message Loop While 1 $idMsg = GUIGetMsg() Switch $idMsg Case $GUI_EVENT_CLOSE Exit Case $htab1 Switch GUICtrlRead($htab1) Case 0 ; Adjust child GUIs accordingly GUISetState(@SW_HIDE, $hGuiInner1) GUISetState(@SW_SHOW, $hGuiInner2) Case 1 GUISetState(@SW_HIDE, $hGuiInner2) GUISetState(@SW_SHOW, $hGuiInner1) EndSwitch EndSwitch WEnd #EndRegion GUI Message Loop #Region Functions Func WM_SIZE($hWndGUI, $MsgID, $wParam, $lParam) _WinAPI_SetWindowPos($hgui1, 0, 0, 0, _WinAPI_LoWord($lParam)-$aOffsets_1[0]+16, _WinAPI_HiWord($lParam)-$aOffsets_1[1]+38,BitOR($SWP_NOMOVE, $SWP_NOZORDER)) _WinAPI_SetWindowPos($hGuiInner1, 0, 0, 0, _WinAPI_LoWord($lParam)-$aOffsets_inner1[0]+16, _WinAPI_HiWord($lParam)-$aOffsets_inner1[1]+38,BitOR($SWP_NOMOVE, $SWP_NOZORDER)) _WinAPI_SetWindowPos($hGuiInner2, 0, 0, 0, _WinAPI_LoWord($lParam)-$aOffsets_inner2[0]+16, _WinAPI_HiWord($lParam)-$aOffsets_inner2[1]+38,BitOR($SWP_NOMOVE, $SWP_NOZORDER)) Return $GUI_RUNDEFMSG EndFunc ;==> WM_SIZE ; WM_NOTIFY event handler ;~ Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) ;~ #forceref $hWndGUI, $MsgID, $wParam ;~ Local $tNMHDR, $event, $hwndFrom, $icode, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld, $sButtonName, $hTreeView1, $hTreeView2 ;~ Local $tNMTOOLBAR, $tNMTBHOTITEM ;~ $tNMHDR = DllStructCreate($tagNMHDR, $lParam) ;~ $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom") ;~ $idFrom = DllStructGetData($tNMHDR, "IDFrom") ;~ $icode = DllStructGetData($tNMHDR, "Code") ;~ $hTreeview1 = $cTreeView1 ;~ $hTreeview2 = $cTreeView2 ;~ If Not IsHWnd($cTreeView1) Then $hTreeview1 = GUICtrlGetHandle($cTreeView1) ;~ If Not IsHWnd($cTreeView2) Then $hTreeview2 = GUICtrlGetHandle($cTreeView2) ;~ Switch $hwndFrom ;~ Case $hToolbar1 ;~ Switch $icode ;~ Case $NM_LDOWN ;~ ;case for which button was clicked ;~ Switch $iItem ;~ Case $e_new ;~ _button_Click($e_new) ;~ Case $e_edit ;~ _button_Click($e_edit) ;~ Case $e_save ;~ _button_Click($e_save) ;~ Case $e_delete ;~ _button_Click($e_delete) ;~ Case $e_print ;~ _button_Click($e_print) ;~ Case $e_undo ;~ _button_Click($e_undo) ;~ EndSwitch ;~ Case $TBN_HOTITEMCHANGE ;~ $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam) ;~ $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld") ;~ $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew") ;~ $iItem = $i_idNew ;~ $dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags") ;~ EndSwitch ;~ Case $hTreeView1, $hTreeView2 ;~ Switch $icode ;~ Case $NM_CLICK ; The user has clicked the left mouse button within the control ;~ _DebugPrint("$NM_CLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ ;~ "-->IDFrom:" & @TAB & $iDFrom & @CRLF & _ ;~ "-->Code:" & @TAB & $iCode) ;~ ; Return 1 ; nonzero to not allow the default processing ;~ Return 0 ; zero to allow the default processing ;~ Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control ;~ _DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ ;~ "-->IDFrom:" & @TAB & $iDFrom & @CRLF & _ ;~ "-->Code:" & @TAB & $iCode) ;~ ; Return 1 ; nonzero to not allow the default processing ;~ Return 0 ; zero to allow the default processing ;~ Case $NM_RCLICK ; The user has clicked the right mouse button within the control ;~ _DebugPrint("$NM_RCLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ ;~ "-->IDFrom:" & @TAB & $iDFrom & @CRLF & _ ;~ "-->Code:" & @TAB & $iCode) ;~ ; Return 1 ; nonzero to not allow the default processing ;~ Return 0 ; zero to allow the default processing ;~ Case $NM_RDBLCLK ; The user has double-clicked the right mouse button within the control ;~ _DebugPrint("$NM_RDBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ ;~ "-->IDFrom:" & @TAB & $iDFrom & @CRLF & _ ;~ "-->Code:" & @TAB & $iCode) ;~ ; Return 1 ; nonzero to not allow the default processing ;~ Return 0 ; zero to allow the default processing ;~ Case $NM_KILLFOCUS ; control has lost the input focus ;~ _DebugPrint("$NM_KILLFOCUS" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ ;~ "-->IDFrom:" & @TAB & $iDFrom & @CRLF & _ ;~ "-->Code:" & @TAB & $iCode) ;~ ; No return value ;~ Case $NM_RETURN ; control has the input focus and that the user has pressed the key ;~ _DebugPrint("$NM_RETURN" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ ;~ "-->IDFrom:" & @TAB & $iDFrom & @CRLF & _ ;~ "-->Code:" & @TAB & $iCode) ;~ ; Return 1 ; nonzero to not allow the default processing ;~ Return 0 ; zero to allow the default processing ;~ ; Case $NM_SETCURSOR ; control is setting the cursor in response to a WM_SETCURSOR message ;~ ; Local $tInfo = DllStructCreate($tagNMMOUSE, $lParam) ;~ ; $hWndFrom = HWnd(DllStructGetData($tInfo, "hWndFrom")) ;~ ; $iIDFrom = DllStructGetData($tInfo, "IDFrom") ;~ ; $iCode = DllStructGetData($tInfo, "Code") ;~ ; _DebugPrint("$NM_SETCURSOR" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ ;~ ; "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ ;~ ; "-->Code:" & @TAB & $iCode & @CRLF & _ ;~ ; "-->ItemSpec:" & @TAB & DllStructGetData($tInfo, "ItemSpec") & @CRLF & _ ;~ ; "-->ItemData:" & @TAB & DllStructGetData($tInfo, "ItemData") & @CRLF & _ ;~ ; "-->X:" & @TAB & DllStructGetData($tInfo, "X") & @CRLF & _ ;~ ; "-->Y:" & @TAB & DllStructGetData($tInfo, "Y") & @CRLF & _ ;~ ; "-->HitInfo:" & @TAB & DllStructGetData($tInfo, "HitInfo")) ;~ ; Return 0 ; to enable the control to set the cursor ;~ ; Return 1 ; nonzero to prevent the control from setting the cursor ;~ Case $NM_SETFOCUS ; control has received the input focus ;~ _DebugPrint("$NM_SETFOCUS" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ ;~ "-->IDFrom:" & @TAB & $iDFrom & @CRLF & _ ;~ "-->Code:" & @TAB & $iCode) ;~ ; No return value ;~ Case $TVN_BEGINDRAGA, $TVN_BEGINDRAGW ;~ _DebugPrint("$TVN_BEGINDRAG") ;~ Case $TVN_BEGINLABELEDITA, $TVN_BEGINLABELEDITW ;~ _DebugPrint("$TVN_BEGINLABELEDIT") ;~ Case $TVN_BEGINRDRAGA, $TVN_BEGINRDRAGW ;~ _DebugPrint("$TVN_BEGINRDRAG") ;~ Case $TVN_DELETEITEMA, $TVN_DELETEITEMW ;~ _DebugPrint("$TVN_DELETEITEM") ;~ Case $TVN_ENDLABELEDITA, $TVN_ENDLABELEDITW ;~ _DebugPrint("$TVN_ENDLABELEDIT") ;~ Case $TVN_GETDISPINFOA, $TVN_GETDISPINFOW ;~ _DebugPrint("$TVN_GETDISPINFO") ;~ Case $TVN_GETINFOTIPA, $TVN_GETINFOTIPW ;~ _DebugPrint("$TVN_GETINFOTIP") ;~ Case $TVN_ITEMEXPANDEDA, $TVN_ITEMEXPANDEDW ;~ _DebugPrint("$TVN_ITEMEXPANDED") ;~ Case $TVN_ITEMEXPANDINGA, $TVN_ITEMEXPANDINGW ;~ _DebugPrint("$TVN_ITEMEXPANDING") ;~ Case $TVN_KEYDOWN ;~ _DebugPrint("$TVN_KEYDOWN") ;~ Case $TVN_SELCHANGEDA, $TVN_SELCHANGEDW ;~ _DebugPrint("$TVN_SELCHANGED") ;~ Case $TVN_SELCHANGINGA, $TVN_SELCHANGINGW ;~ _DebugPrint("$TVN_SELCHANGING") ;~ Case $TVN_SETDISPINFOA, $TVN_SETDISPINFOW ;~ _DebugPrint("$TVN_SETDISPINFO") ;~ Case $TVN_SINGLEEXPAND ;~ _DebugPrint("$TVN_SINGLEEXPAND") ;~ EndSwitch ;~ EndSwitch ;~ Return $GUI_RUNDEFMSG ;~ EndFunc Func _GetGuiOffset($hTargGUI) Local $aGUIPos[4] $aWin1 = WinGetPos($hGUI) $aWin2 = WinGetPos($hTargGUI) $aGUIPos[0] = $aWin1[2]-$aWin2[2] $aGUIPos[1] = $aWin1[3]-$aWin2[3] return $aGUIPos EndFunc ;==> _GetGuiOffset func _button_Click($btn_ID) Switch $btn_ID Case $e_new _DebugPrint("Clicked New button" & @LF) case $e_edit _DebugPrint("Clicked Edit button" & @LF) Case $e_save _DebugPrint("Clicked Save button" & @LF) Case $e_delete _DebugPrint("Clicked Delete button" & @LF) Case $e_print _DebugPrint("Clicked Print button" & @LF) Case $e_undo _DebugPrint("Clicked Undo button" & @LF) EndSwitch endfunc ;==>_button_Click Func _DebugPrint($s_Text , $sLine = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @CRLF & _ "+======================================================" & @CRLF & _ "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _ "+======================================================" & @CRLF) EndFunc ;==>_DebugPrint #EndRegion functions
  10. I might be doing this wrong but this seems to crash the GUI, what I want is to click the button, select something from the list view with a double click which populates the input box and delete's the GUI? #include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <Misc.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 400, 400) $btn = GUICtrlCreateButton( "", 150, 50, 75, 20 ) $cInput = GUICtrlCreateInput( "", 10, 50, 100, 20 ) GUISetState() GUIRegisterMsg( $WM_NOTIFY, "WM_NOTIFY" ) Global $idListview While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btn listpackers() EndSwitch WEnd Func listPackers() Global $packersGUI = GUICreate( "Packers List", 300, 300, -1, -1, $WS_SYSMENU ) $idListview = GUICtrlCreateListView( "", 2, 2, 294, 268 ) GUISetState( @SW_SHOW ) Local $packerList[2][2] = [[1, "Name1"],[2, "Name2"]] ; Add columns _GUICtrlListView_AddColumn( $idListview, "Packer ID", 75 ) _GUICtrlListView_AddColumn( $idListview, "Packer Name", 150 ) _GUICtrlListView_SetItemCount( $idListview, 3 ) _GUICtrlListView_AddArray( $idListview, $packerList ) _GUICtrlListView_DeleteItem( $idListview, 0 ) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $tBuffer, $tBuffer2 $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $iIDFrom Case $idListview Switch $iCode Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) GUICtrlSetData( $cInput, _GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index")) ) GUIDelete( $packersGUI ) Return 0 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc
  11. Viva, I think the WM_NOTIFY messages to follow a convention, but. Does anyone know what the values ​​represent, -12 and -177, in a ListView notification. Sincerely. Steps to show on console: Click on a item, or after that use up/down movement key. test.au3
×
×
  • Create New...