Search the Community
Showing results for tags 'up'.
-
Good day to the autoit community. I am having an issue with the _GUICtrlRichEdit on a pop-up gui box. I have cobbled a short script together that replicates the issue. Simply run the script and click the button for the pop-up gui with the richedit box. If you close the pop-up gui and re-click the button, the richedit box fails to load on subsequent pop-up gui launches. #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $Form1_1 = GUICreate("hubconsole", 655, 697) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1_1Close") $gethubbutton = GUICtrlCreateButton("Get Info", 501, 129, 81, 25) GUICtrlSetOnEvent(-1, "Main") GUISetState(@SW_SHOW) Func Form1_1Close() exit EndFunc While 1 Sleep(100) WEnd Func Main() Local $hGui, $hRichEdit, $iMsg $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1) global $richgui = $hGui GUISetOnEvent($GUI_EVENT_CLOSE, "Form2_1Close") global $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _ BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) _GUICtrlRichEdit_AppendText($hRichEdit, @CR & "This is more text") GUISetState() EndFunc Func Form2_1Close() _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes GUIDelete($richgui) EndFunc Some further information from diagnostic: The first cycle around shows no @error's for the deconstructor Form2_1Close().. so the richedit destroy and guidelete both happen. When I click the button for the second launch, I see the pop-up gui has a new HWnd.. example: 1st click (0x00514B6) 2nd click (0x000614B6) on the line " global $hRichEdit = _GUICtrlRichEdit_Create($hGui... " I see value to @error of 1 which isn't detailed in the helpfile of the function, but if I dig into the include I see error 1 gets set when: If Not _WinAPI_IsClassName($hWnd, $_GRE_sRTFClassName) Then Return SetError(1, 0, 0) ; Invalid Window handle for _GUICtrlRichEdit_Create 1st parameter I'm stuck at this point as I can't figure why "_WinAPI_IsClassName($hWnd, $_GRE_sRTFClassName" comes back with a failure on subsequent launches of the popup.
-
DllStructCreate is so hard for newbies like me. There are many posts here and there that go about treating up/down keys in listviews but nothing does the simple thing I need. I need a variable that is updated with the selected/focused item of the listview every time UP or DOWN key is used to move within the listview. Any easy solutions? My function so far only treats clicked items: Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $ClauseList If Not IsHWnd($ClauseList) Then ;(NEW LINE) $hWndListView = GUICtrlGetHandle($ClauseList) ;(NEW LINE) EndIf ;(NEW LINE) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) $j = _GUICtrlListView_GetSelectedIndices($ClauseList) ;get index of clicked item _ActiveClause(Number($j)) ;this is a function I call EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc
-
I'm have a working program that displays the users in Active Directory. When a user's name is clicked on it displays their details (profile folder, work folder, etc). However, what I'd really like to do is be able to eliminate using the mouse as much as possible, so instead of having to click on each user's name, you can use the UP and DOWN arrows and it will act as though their name has been clicked on (if that makes any sense?). Here's some of the code so far: $ADListView = GUICtrlCreateListView("Login Name|Display Name", 140, 60, 220, 280);A ListView to display the users ; Adjust the ADListView column headers _GUICtrlListView_SetColumnWidth($ADListView, 0, 100) _GUICtrlListView_SetColumnWidth($ADListView, 1, 116) Func UpdateUserList() _AD_Open() $SelectedUserType = GUICtrlRead($UserTypeCombo) ;Get the base OU for the user type $SelectedUserTypeBaseOU = IniRead("iniUsers.ini", $SelectedUserType, "BaseOU", "NotFound") ;Get the filtered results from the AD using base OU $ADData = _AD_GetObjectsInOU($SelectedUserTypeBaseOU, "(&(objectclass=user)(name=*))", 2, "sAMAccountName,distinguishedName,displayname", "displayname") GUICtrlSetData($ADListView, $ADData) _GUICtrlListView_DeleteAllItems($ADListView) GUICtrlSetData($UserPropertiesEditBox, "Properties of Selected User") $SelectedUser = "" ;For each AD user, add an item in in the ListView For $i = 1 To UBound($ADData) - 1 GUICtrlCreateListViewItem($ADData[$i][0] & "|" & $ADData[$i][2], $ADListView) GUICtrlSetOnEvent(-1, "ListClicked") ; For each item, add the required event Next _AD_Close() EndFunc ;==>UpdateUserList Func ListClicked() $ItemString = GUICtrlRead(@GUI_CtrlId) $ItemArray = StringSplit($ItemString, "|") $SelectedUser = $ItemArray[1] _AD_Open() $givenName = _AD_GetObjectAttribute($SelectedUser, "givenName") $SN = _AD_GetObjectAttribute($SelectedUser, "SN") $displayName = _AD_GetObjectAttribute($SelectedUser, "displayName") $profilePath = _AD_GetObjectAttribute($SelectedUser, "profilePath") $homeDirectory = _AD_GetObjectAttribute($SelectedUser, "homeDirectory") $homeDrive = _AD_GetObjectAttribute($SelectedUser, "homeDrive") $GroupArray = _AD_GetUserGroups($SelectedUser) GUICtrlSetData($UserPropertiesEditBox, "") _GUICtrlEdit_AppendText($UserPropertiesEditBox, "Properties of Selected User") _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & @CRLF & "First Name: " & $givenName) _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & @CRLF & "Last Name: " & $SN) _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & @CRLF & "Login Name: " & $SelectedUser) _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & @CRLF & "Profile Directory: " & $profilePath) _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & @CRLF & "Home Directory: " & $homeDirectory & " (" & $homeDrive & ")") _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & @CRLF & "Group Membership:") For $i = 1 To UBound($GroupArray) - 1 _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & _AD_FQDNToDisplayname($GroupArray[$i])) Next _AD_Close() EndFunc ;==>ListClicked Any help would be great, thank you!
- 4 replies
-
- guictrlcreatelistview
- up
-
(and 6 more)
Tagged with: