Ixel Posted February 14, 2008 Posted February 14, 2008 Is there anything in AutoIt that facilitates using treeview navigation within a combobox? I searched for a while and did not find any posts related on this topic. Ixel
ReFran Posted February 21, 2008 Posted February 21, 2008 I saw it in some new software, we search at time for. Attached a startup. Could be improved. HTH, Reinhard expandcollapse popup;; combo with treeview workaround #include <GUIConstants.au3> $mainGUI = GuiCreate("Combo with Treeview WA",300,400,80,80) $inp1 = GuiCtrlCreateInput("General",20,40,162,20) GUISetFont (9, 400, 1,"Webdings") ;,$btn_inp1) $btn_inp1 = GuiCtrlCreateButton("6",179,40,19,19) ;GUISetFont (9, 400, 1,"Webdings",$btn_inp1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btn_inp1 CbTreeView() EndSwitch WEnd func CBTreeView() $aWin = WingetPos($mainGUI) $aInpPos = ControlGetPos("","",$Inp1) ;msgbox(0,"",$aWin[0]&"/"&$aWin[1]&"/"&$aWin[2]&"/"&$aWin[3]&@crlf _ ; &$aInpPos[0]&"/"&$aInpPos[1]&"/"&$aInpPos[2]&"/"&$aInpPos[3]) $xbL= $aWin[0]+$aInpPos[0]+4 $xbT= $aWin[1]+$aInpPos[1]+30+20 $boxGUI = GUICreate("Form1", 180,200,$xbL,$xbT, BitOR($WS_SYSMENU,$WS_POPUP,$WS_CLIPSIBLINGS), 0);180,200,104,170, $treeview = GUICtrlCreateTreeView(0,0,178,198) $generalitem = GUICtrlCreateTreeViewitem("General", $treeview) GUICtrlSetColor(-1, 0x0000C0) $displayitem = GUICtrlCreateTreeViewitem("Display", $treeview) GUICtrlSetColor(-1, 0x0000C0) $aboutitem = GUICtrlCreateTreeViewitem("About", $generalitem) $compitem = GUICtrlCreateTreeViewitem("Computer", $generalitem) $useritem = GUICtrlCreateTreeViewitem("User", $generalitem) $resitem = GUICtrlCreateTreeViewitem("Resolution", $displayitem) $otheritem = GUICtrlCreateTreeViewitem("Other", $displayitem) GUISetState(@SW_SHOW) $aWinSave=$aWin While 1 $nMsg2 = GUIGetMsg() $aWin = WingetPos($mainGUI) if $aWin[0] <> $aWinSave[0] then $nMsg2 = $btn_inp1 Switch $nMsg2 Case $GUI_EVENT_CLOSE Exitloop case $Treeview msgbox(0,"","Hallo") Case $btn_inp1 $tvText = GUICtrlRead(GUICtrlRead($treeview),1) if $tvText <> "0" then GUICTRLSetData($inp1,$tvText) Exitloop EndSwitch $aWinSave=$aWin WEnd GUIDelete($boxGUI) endfunc
ReFran Posted February 22, 2008 Posted February 22, 2008 OK! ... and now a direct usable combo with treeview for small fixed cases. Best regards, Reinhard expandcollapse popup;; combo with treeview workaround #include <GUIConstants.au3> $mainGUI = GuiCreate("Combo with Treeview WA",300,400,80,80) $inp1 = GuiCtrlCreateInput("General",20,40,162,20,$ES_READONLY) GUICtrlSetBkColor(-1,0xFFFFFF) GUISetFont (9, 400, 1,"Webdings") ;,$btn_inp1) $btn_inp1 = GuiCtrlCreateButton("6",179,40,19,19) ;GUISetFont (9, 400, 1,"Webdings",$btn_inp1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btn_inp1 CbTreeView() EndSwitch WEnd func CBTreeView() $aWin = WingetPos($mainGUI) $aInpPos = ControlGetPos("","",$Inp1) ;msgbox(0,"",$aWin[0]&"/"&$aWin[1]&"/"&$aWin[2]&"/"&$aWin[3]&@crlf _ ; &$aInpPos[0]&"/"&$aInpPos[1]&"/"&$aInpPos[2]&"/"&$aInpPos[3]) $xbL= $aWin[0]+$aInpPos[0]+4 $xbT= $aWin[1]+$aInpPos[1]+30+20 $boxGUI = GUICreate("Form1", 180,200,$xbL,$xbT, BitOR($WS_SYSMENU,$WS_POPUP,$WS_CLIPSIBLINGS), 0) $treeview = GUICtrlCreateTreeView(0,0,178,198) $generalitem = GUICtrlCreateTreeViewitem("General", $treeview) GUICtrlSetColor(-1, 0x0000C0) $displayitem = GUICtrlCreateTreeViewitem("Display", $treeview) GUICtrlSetColor(-1, 0x0000C0) $aboutitem = GUICtrlCreateTreeViewitem("About", $generalitem) $compitem = GUICtrlCreateTreeViewitem("Computer", $generalitem) $useritem = GUICtrlCreateTreeViewitem("User", $generalitem) $resitem = GUICtrlCreateTreeViewitem("Resolution", $displayitem) $otheritem = GUICtrlCreateTreeViewitem("Other", $displayitem) GUISetState(@SW_SHOW) $aWinSave=$aWin While 1 $nMsg2 = GUIGetMsg() $aWin = WingetPos($mainGUI) if $aWin[0] <> $aWinSave[0] then exitloop Switch $nMsg2 Case $GUI_EVENT_CLOSE Exitloop case $Generalitem msgBox(0,"Choose", "Blue colored main items not choosable!"&@crlf _ &"Please choose a subitem or call your sevicedesk.") case $displayitem msgBox(0,"Choose", "Blue colored main items not choosable!"&@crlf _ &"Please choose a subitem or call your servicedesk.") case $aboutItem $tvText = GUICtrlRead(GUICtrlRead($treeview),1) GUICTRLSetData($inp1,$tvText) ExitLoop case $compItem $tvText = GUICtrlRead(GUICtrlRead($treeview),1) GUICTRLSetData($inp1,$tvText) ExitLoop case $useritem $tvText = GUICtrlRead(GUICtrlRead($treeview),1) GUICTRLSetData($inp1,$tvText) ExitLoop case $resitem $tvText = GUICtrlRead(GUICtrlRead($treeview),1) GUICTRLSetData($inp1,$tvText) ExitLoop case $otheritem $tvText = GUICtrlRead(GUICtrlRead($treeview),1) GUICTRLSetData($inp1,$tvText) ExitLoop Case $btn_inp1 Exitloop EndSwitch $aWinSave=$aWin WEnd GUIDelete($boxGUI) endfunc
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now