Sign in to follow this  
Followers 0
Tam0r

Listview + combobox?

7 posts in this topic

Is it possible into a Listview column to indicate a Combobox? as e.g. with Koda

Posted Image

Share this post


Link to post
Share on other sites



Is it possible into a Listview column to indicate a Combobox? as e.g. with Koda

Posted Image

You could place a combobox over a listview. Here is an example but it doesn't look too good.

#include <GUIConstants.au3>
#include <guilistview.au3>
#include <constants.au3>
Global Const $WM_COMMAND = 0x0111
Global Const  $CBN_DROPDOWN = 7
Global Const $CBN_CLOSEUP = 8

#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Form2", 413, 298, 208, 142)
$LV = GUICtrlCreateListView("title", 8, 24, 160, 150)
GUICtrlSendMsg(-1, 0x101E, 0, 100)
$ListView1_0 = GUICtrlCreateListViewItem("B5:AB :8@8;;8FK", $LV)
$ListView1_1 = GUICtrlCreateListViewItem("bbbbbbbbbbbb", $LV)
$ListView1_2 = GUICtrlCreateListViewItem("B5AB", $LV)
$ListView1_3 = GUICtrlCreateListViewItem("dddddddddd", $LV)
$ListView1_4 = GUICtrlCreateListViewItem("eeeeeeeeeeeeee", $LV)
$ListView1_5 = GUICtrlCreateListViewItem("ffffffffffffff", $LV)
$ListView1_6 = GUICtrlCreateListViewItem("gggggggggggggg", $LV)
$Combo1 = GUICtrlCreateCombo("Combo1", 168, 152, 100, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL,$WS_CLIPSIBLINGS))
GUICtrlSetData(-1,"one|two|three|four")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUICtrlSetState($combo1,$GUI_ONTOP)
GUICtrlSetState($combo1,$GUI_HIDE)

GUIRegisterMsg($WM_COMMAND,"MY_WM_COMMAND")
Global $lvit
$LVItHt = 14
$LVPos = ControlGetPos("Form2","",$LV)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $GUI_EVENT_PRIMARYDOWN
            ;get info on control the mouse is over
            $Info =  GUIGetCursorInfo (WinGetHandle($Form2))
            If $Info[4] = $LV Then ;if over the Listview
                setcombo()            ;get the text of the selected item
            EndIf

    EndSwitch
WEnd


Func setcombo()
    
    $lvit = _GUICtrlListViewGetCurSel($lv)
    ConsoleWrite("row = " & $lvit & @CRLF)
    GUICtrlSetPos($combo1,$LVPos[0] + 4,$LVPos[1] + $lvit*$LVItHt + 20)
    GUICtrlSetState($combo1,BitOR($GUI_ONTOP,$GUI_SHOW))  
    DllCall("user32.dll", "int", "InvalidateRect", "hwnd", GUICtrlGetHandle($Combo1), "int", 0, "int", 1)
        
    
EndFunc
    
    

Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    Local $nNotifyCode = _HiWord($wParam)
    Local $nID = _LoWord($wParam)
    Local $hCtrl = $lParam

    Switch $nID
        Case $combo1
            Switch $nNotifyCode
                
                Case $CBN_CLOSEUP
                    _GUICtrlListViewSetItemText($lv,$lvit,0,GUICtrlRead($combo1))
                    GUICtrlSetState($combo1,$GUI_HIDE)
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;MY_WM_COMMAND    




Func _HiWord($x)
    Return BitShift($x, 16)
EndFunc   ;==>_HiWord

Func _LoWord($x)
    Return BitAND($x, 0xFFFF)
EndFunc   ;==>_LoWord

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Thanks. It does not function however correctly

au3Lib has that with ListBox LBS_COMBOBOX as goes?

Share this post


Link to post
Share on other sites

Thanks. It does not function however correctly

au3Lib has that with ListBox LBS_COMBOBOX as goes?

Quote from MSDN

LBS_COMBOBOX

Notifies a list box that it is part of a combo box. This allows coordination between the two controls so that they present a unified user interface (UI). The combo box itself must set this style. If the style is set by anything but the combo box, the list box will regard itself incorrectly as a child of a combo box and a failure will result.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Quote from MSDN

Thx

I can solve the problem only in such a way. Point someone a possibility over option better to represent?

33 x Edit

Posted Image

Edited by Tam0r

Share this post


Link to post
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
Sign in to follow this  
Followers 0