Jump to content

GaryFrost

Developers
  • Posts

    7,375
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by GaryFrost

  1. Then you have not looked at the correct functions. Look at the create and destroy functions. The UDFs serves it's purpose.
  2. It's included in the latest release, the include was added in some time ago.
  3. It should be with your version unless you are using a version prior to the UDF *********_Create functions being introduced.
  4. As each function header states for "Internal Use" only. No need to worry about that Include.
  5. It appears that Jon didn't restore our Dev files.
  6. You don't need to use _GUICtrlListView_Create to use icons
  7. The following comment is incorrect about the code, the code is where your problem is: ;// Set the lParam of the struct to the line index - unique within the listview // DllStructSetData($stLvItem, 9, $nIndex)
  8. oMBRa gave you a working example. The following is slightly modified from the help file. Left the other events in so you can see what else can be caught. #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiEdit.au3> #include <WinAPI.au3> ; used for Lo/Hi word #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> Opt('MustDeclareVars', 1) $Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work Global $hEdit _Main() Func _Main() ; Create GUI GUICreate("Edit Create", 400, 300) $hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268) GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") _GUICtrlEdit_SetText($hEdit, "This is a test" & @CRLF & "Another Line") ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndEdit If Not IsHWnd($hEdit) Then $hWndEdit = GUICtrlGetHandle($hEdit) $hWndFrom = $ilParam $iIDFrom = _WinAPI_LoWord($iwParam) $iCode = _WinAPI_HiWord($iwParam) Switch $hWndFrom Case $hEdit, $hWndEdit Switch $iCode Case $EN_ALIGN_LTR_EC ; Sent when the user has changed the edit control direction to left-to-right _DebugPrint("$EN_ALIGN_LTR_EC" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $EN_ALIGN_RTL_EC ; Sent when the user has changed the edit control direction to right-to-left _DebugPrint("$EN_ALIGN_RTL_EC" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $EN_CHANGE ; Sent when the user has taken an action that may have altered text in an edit control _DebugPrint("$EN_CHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $EN_ERRSPACE ; Sent when an edit control cannot allocate enough memory to meet a specific request _DebugPrint("$EN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $EN_HSCROLL ; Sent when the user clicks an edit control's horizontal scroll bar _DebugPrint("$EN_HSCROLL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $EN_KILLFOCUS ; Sent when an edit control loses the keyboard focus _DebugPrint("$EN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $EN_MAXTEXT ; Sent when the current text insertion has exceeded the specified number of characters for the edit control _DebugPrint("$EN_MAXTEXT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; This message is also sent when an edit control does not have the $ES_AUTOHSCROLL style and the number of characters to be ; inserted would exceed the width of the edit control. ; This message is also sent when an edit control does not have the $ES_AUTOVSCROLL style and the total number of lines resulting ; from a text insertion would exceed the height of the edit control ; no return value Case $EN_SETFOCUS ; Sent when an edit control receives the keyboard focus _DebugPrint("$EN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $EN_UPDATE ; Sent when an edit control is about to redraw itself _DebugPrint("$EN_UPDATE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $EN_VSCROLL ; Sent when the user clicks an edit control's vertical scroll bar or when the user scrolls the mouse wheel over the edit control _DebugPrint("$EN_VSCROLL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint
  9. Even tho it was used improperly it should still not crash Autoit. I would think it would throw an error tho.
  10. Try: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) $Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work Global $hTreeView, $fClicked = False, $i_Item _Main() Func _Main() Local $hItem Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES) GUICreate("TreeView Create Item Checked?", 400, 300) $hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") _GUICtrlTreeView_BeginUpdate($hTreeView) For $x = 1 To Random(2, 10, 1) $hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x)) For $y = 1 To Random(2, 10, 1) _GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y)) Next Next _GUICtrlTreeView_EndUpdate($hTreeView) _GUICtrlTreeView_SetFocused($hTreeView, 0) ; Loop until user exits While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case Else If $fClicked Then If _GUICtrlTreeView_GetChecked($hTreeView, $i_Item) Then _DebugPrint(StringFormat("State for Item %d? %s", $i_Item, "Is Checked")) Else _DebugPrint(StringFormat("State for Item %d? %s", $i_Item, "Is NOT Checked")) EndIf $fClicked = False EndIf EndSwitch WEnd GUIDelete() EndFunc ;==>_Main Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview, $i_opt, $i_pos $hWndTreeview = $hTreeView If Not IsHWnd($hTreeView) Then $hWndTreeview = GUICtrlGetHandle($hTreeView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeview Switch $iCode Case $NM_CLICK ; The user has clicked the left mouse button within the control _DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) $i_opt = Opt("MouseCoordMode", 2) $i_pos = MouseGetPos() If _GUICtrlTreeView_HitTest($hWndTreeview, $i_pos[0], $i_pos[1]) = 64 Then $fClicked = True $i_Item = _GUICtrlTreeView_HitTestItem($hWndTreeview, $i_pos[0], $i_pos[1]) EndIf Opt("MouseCoordMode", $i_opt) ;~ Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint
  11. #AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $listview, $hImage Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) GUICreate("ImageList AddIcon", 400, 300) $listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles) GUISetState() ; Load images $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, @WindowsDir & "\explorer.exe", 1) _GUIImageList_AddIcon($hImage, @WindowsDir & "\explorer.exe", 2) _GUIImageList_AddIcon($hImage, @WindowsDir & "\explorer.exe", 3) _GUIImageList_AddIcon($hImage, @WindowsDir & "\explorer.exe", 4) _GUIImageList_AddIcon($hImage, @WindowsDir & "\explorer.exe", 5) _GUIImageList_AddIcon($hImage, @WindowsDir & "\explorer.exe", 6) _GUICtrlListView_SetImageList($listview, $hImage, 1) ; Add columns _GUICtrlListView_AddColumn($listview, "Column 1", 120) _GUICtrlListView_AddColumn($listview, "Column 2", 100) _GUICtrlListView_AddColumn($listview, "Column 3", 100) ; Add items _GUICtrlListView_AddItem($listview, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 2", 1, 1) _GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 3", 2, 2) _GUICtrlListView_AddItem($listview, "Row 2: Col 1", 1) _GUICtrlListView_AddSubItem($listview, 1, "Row 2: Col 2", 1, 2) _GUICtrlListView_AddItem($listview, "Row 3: Col 1", 2) _GUICtrlListView_AddItem($listview, "Row 4: Col 1", 3) _GUICtrlListView_AddItem($listview, "Row 5: Col 1", 4) _GUICtrlListView_AddSubItem($listview, 4, "Row 5: Col 2", 1, 3) _GUICtrlListView_AddItem($listview, "Row 6: Col 1", 5) _GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 2", 1, 4) _GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 3", 2, 3) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main
  12. Don't think I would exit the loop, rather continueloop, might be a lf or cr in between other lines.
  13. Look for GuiStatusBar Management in the help
  14. last param "$fDelFlag Delete after copying" would make a move, although it doesn't move items up/down.
  15. Look in the help for _GUICtrlListView_CopyItems
  16. http://www.autoitscript.com/forum/index.php?showtopic=79600
×
×
  • Create New...