Jump to content

_GUICtrlTreeView_SelectItem


Recommended Posts

Im looking for something basic like this example to organize my favorite websites

i dont quite see how the $iRand = Random(0, 9, 1)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[$iRand])

plays a role in this script.

im sure there is a easy method which im over looking to edit the titles and direct the the selected item

to a webrowser. makes no difference to me if opened in new browser

#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 $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iRand, $iYItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Select Item", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To 3
$hChildItem[$iYItem] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
_GUICtrlTreeView_SelectItem($hTreeView, $hItem[$iRand])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
Link to comment
Share on other sites

I really don't have understand what are you looking for :P Can you give us more explanation of what do you want to do?

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

The role is that it selects a random treeview control item.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Check that:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <WinAPI.au3>

Global $hGUI, $hTV, $idTV, $idEdit, $hItem, $hChild

$hGUI = GUICreate("Test", 300, 400)
$hTV = _GUICtrlTreeView_Create($hGUI, 20, 20, 260, 100)
$idTV = _WinAPI_GetDlgCtrlID($hTV)

For $i = 1 To 5
    $hItem = _GUICtrlTreeView_Add($hTV, 0, "Item " & $i)
    For $c = 1 To 5
        $hChild = _GUICtrlTreeView_AddChild($hTV, $hItem, "Child " & $c)
    Next
Next

$idEdit = GUICtrlCreateEdit("", 20, 140, 260, 240)
ControlSetText($hGUI, "", $idEdit, ControlGetText($hGUI, "", $idEdit) & _
        "Initilize script:  " & @CRLF & _
        "$hGUI = " & $hGUI & @CRLF & _
        "$hTV = " & $hTV & "; $idTV = " & $idTV & @CRLF & _
        "$idEdit = " & $idEdit & @CRLF)

GUIRegisterMsg($WM_LBUTTONDBLCLK, "_WM_LBUTTONDBLCLK")
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")
GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func _WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    Local $tagNMHDR = "int hwndFrom; int idFrom; int code"
    Switch $wParam
        Case $idTV
            Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
            If @error Then Return
            If DllStructGetData($tNMHDR, "code") = $NM_DBLCLK Then
                ControlSetText($hGUI, "", $idEdit, ControlGetText($hGUI, "", $idEdit) & _
                        "Double click on TreeView:  Hwnd = " & DllStructGetData($tNMHDR, "hwndFrom") & _
                        "; ID = " & DllStructGetData($tNMHDR, "idFrom") & @CRLF)
            EndIf
    EndSwitch
    $tNMHDR = 0
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_NOTIFY

Func _WM_LBUTTONDBLCLK($hWnd, $iMsg, $iwParam, $ilParam)
    Local $iX = BitAND($ilParam, 0xFFFF)
    Local $iY = BitShift($ilParam, 16)
    ControlSetText($hGUI, "", $idEdit, ControlGetText($hGUI, "", $idEdit) & _
            "Double click on GUI:  Hwnd = " & $hWnd & "; X = " & $iX & "; Y = " & $iY & @CRLF)
EndFunc   ;==>_WM_LBUTTONDBLCLK

The author of this function is PsaltyDS!

Hi!

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...