Jump to content

Listview freeze mouse


roby
 Share

Recommended Posts

Hi to everybody,

why if I click on a line of the listview, created with external method and I drags downward, it appears me a small cross inside a square (sign joins record to a selection) and the mouse it freezes...

How can I resolved this problem?

Help me, please.

Thank you

Roby

This is the code :

#cs --------------------------------------------------------------------------
    
    AutoIt Version: 3.2.10.0
    Author:      R.B.
    
    Script Function:
    Gestione Anagrafica
    
#ce ----------------------------------------------------------------------------
;AutoIt3 v3.2.10.0 or higher
#Include <Anagrafica.au3>
;Global $hListView_Anagrafiche
Global $txtBadge, $txtCognome, $txtNome, $hcmbUfficio, $aUffici
Func _Anagrafiche()
;Opt('MustDeclareVars', 1)
    
    $hGUI_Anagrafiche = GUICreate("Anagrafiche", 480, 270)
;---
    GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")
    $hReBar_Anagrafiche = _GUICtrlReBar_Create($hGUI_Anagrafiche, BitOR($CCS_TOP, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))
    $hToolbar_Anagrafiche = _GUICtrlToolbar_Create($hGUI_Anagrafiche, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN, $BTNS_AUTOSIZE, $BTNS_BUTTON, $BTNS_SHOWTEXT)) ; BitOR($BTNS_AUTOSIZE, $BTNS_BUTTON, $BTNS_SHOWTEXT)
    $aSize = _GUICtrlToolbar_GetMaxSize($hToolbar_Anagrafiche)
; Add standard system bitmaps
    Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar_Anagrafiche)
        Case 0
            _GUICtrlToolbar_AddBitmap($hToolbar_Anagrafiche, 1, -1, $IDB_STD_SMALL_COLOR)
        Case 2
            _GUICtrlToolbar_AddBitmap($hToolbar_Anagrafiche, 1, -1, $IDB_STD_LARGE_COLOR)
    EndSwitch
; Create ToolTip
    $hToolTip_Anagrafiche = _GUIToolTip_Create($hToolbar_Anagrafiche, $TTS_ALWAYSTIP)
    _GUICtrlToolbar_SetToolTips($hToolbar_Anagrafiche, $hToolTip_Anagrafiche)
; Add Icons
    $hToolBarImageListNorm = _GUIImageList_Create(32, 32)
    _GUIImageList_AddBitmap($hToolBarImageListNorm, @ScriptDir & "\Icone\Nuovo.bmp")
    _GUIImageList_AddBitmap($hToolBarImageListNorm, @ScriptDir & "\Icone\Modifica.bmp")
    _GUIImageList_AddBitmap($hToolBarImageListNorm, @ScriptDir & "\Icone\Stampa.bmp")
    _GUIImageList_AddBitmap($hToolBarImageListNorm, @ScriptDir & "\Icone\Elimina.bmp")
    _GUIImageList_AddBitmap($hToolBarImageListNorm, @ScriptDir & "\Icone\Invia.bmp")
    _GUIImageList_AddBitmap($hToolBarImageListNorm, @ScriptDir & "\Icone\Uscita.bmp")
    _GUICtrlToolbar_SetImageList($hToolbar_Anagrafiche, $hToolBarImageListNorm)
; Add buttons
    _GUICtrlToolbar_AddButton($hToolbar_Anagrafiche, $id1, 0, $aStrings[0]); Index 0
    _GUICtrlToolbar_AddButton($hToolbar_Anagrafiche, $id2, 1, $aStrings[1]); Index 1
    _GUICtrlToolbar_AddButton($hToolbar_Anagrafiche, $id3, 2, $aStrings[2]); Index 4
    _GUICtrlToolbar_AddButton($hToolbar_Anagrafiche, $id4, 3, $aStrings[3]); Index 5
    _GUICtrlToolbar_AddButton($hToolbar_Anagrafiche, $id5, 4, $aStrings[4]); Index 6
    _GUICtrlToolbar_AddButton($hToolbar_Anagrafiche, $id6, 5, $aStrings[5]); Index 7
    _GUICtrlReBar_AddToolBarBand($hReBar_Anagrafiche, $hToolbar_Anagrafiche)
    #Region ### START Koda GUI section ### Form=c:\documents and settings\desktop\prova-maschera\frm.kxf
    
    $hListView_Anagrafiche = _GUICtrlListView_Create($hGUI_Anagrafiche, '', 10, 55, 460, 200 )
    _GUICtrlListView_InsertColumn($hListView_Anagrafiche, 0, "Badge", 50)
    _GUICtrlListView_InsertColumn($hListView_Anagrafiche, 1, "Cognome", 150)
    _GUICtrlListView_InsertColumn($hListView_Anagrafiche, 2, "Nome", 150)
    _GUICtrlListView_InsertColumn($hListView_Anagrafiche, 3, "Ufficio", 110)
    _GUICtrlListView_InsertColumn($hListView_Anagrafiche, 4, "Codice", 50)
    _GUICtrlListView_SetExtendedListViewStyle($hListView_Anagrafiche, BitOR( $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB   ))
    GUISetState(@SW_SHOW)
    ControlFocus($hGUI_Anagrafiche, '', $hListView_Anagrafiche)
    _GUICtrlListView_HideColumn($hListView_Anagrafiche, 4)
    #EndRegion ### END Koda GUI section ###
; Populate list and make it wide enough to see
    $anagraficheRS = ObjCreate("ADODB.Recordset")
    $anagraficheRS.CursorType = 0
    $anagraficheRS.LockType = 3
    $anagraficheRS.Open("SELECT Anagrafiche.*, Uffici.Ufficio FROM Anagrafiche, Uffici WHERE " & _
            "Anagrafiche.idUff = Uffici.idUff AND Anagrafiche.Eliminato = FALSE ORDER BY Cognome, Nome", $sqlConACC)
    
;~  _GUICtrlListView_BeginUpdate($hListView_Anagrafiche)
    $j = 0
    While Not $anagraficheRS.Eof
        _GUICtrlListView_AddItem($hListView_Anagrafiche, $anagraficheRS.Fields("idBadge"  ).Value)
        _GUICtrlListView_AddSubItem($hListView_Anagrafiche, $j, $anagraficheRS.Fields("Cognome"  ).Value, 1)
        _GUICtrlListView_AddSubItem($hListView_Anagrafiche, $j, $anagraficheRS.Fields("Nome"  ).Value, 2)
        _GUICtrlListView_AddSubItem($hListView_Anagrafiche, $j, $anagraficheRS.Fields("Ufficio"  ).Value, 3)
        _GUICtrlListView_AddSubItem($hListView_Anagrafiche, $j, $anagraficheRS.Fields("idUff"  ).Value, 4)
        $anagraficheRS.Movenext
        $j += 1
    WEnd
    If $j > 0 Then
        $anagraficheRS.MoveFirst
    EndIf
;~  _GUICtrlListView_EndUpdate($hListView_Anagrafiche)
;Seleziono e do il fuoco al primo elemento della listview
    _GUICtrlListView_SetItemFocused($hListView_Anagrafiche, 0)
    _GuiCtrlListView_SetItemSelected($hListView_Anagrafiche, 0)
    $iItemIndex = _GUICtrlListView_GetSelectedIndices($hListView_Anagrafiche)
EndFunc  ;==>_Anagrafiche
Func _Nuovo_Record_A()
    $valTxtBadge = GUICtrlRead($txtBadge)
    
; controllo se
    $anagraficheRS = ObjCreate("ADODB.Recordset")
    $anagraficheRS.CursorType = 3
    $anagraficheRS.LockType = 3
    $anagraficheRS.Open("SELECT Anagrafiche.*, Uffici.Ufficio FROM Anagrafiche, Uffici WHERE " & _
            "Anagrafiche.idUff = Uffici.idUff AND " & _
            "Anagrafiche.idBadge = '" & $valTxtBadge & "'", $sqlConACC)
    If $anagraficheRS.Eof Then
        $anagraficheRS = ObjCreate("ADODB.Recordset")
        $anagraficheRS.Open("INSERT INTO Anagrafiche (idBadge, Cognome, Nome, idUff) VALUES ('" & $valTxtBadge & "','" & GUICtrlRead($txtCognome) & _
                "','" & GUICtrlRead($txtNome) & "','" & $aUffici[_GUICtrlComboBox_GetCurSel($hcmbUfficio)] & "')", $sqlConACC)
    Else
        MsgBox(0, 'Attenzione', 'Codice Badge già Esistente')
    EndIf
EndFunc  ;==>_Nuovo_Record_A
Func _Modifica_Record_A()
    $valTxtBadge = GUICtrlRead($txtBadge)
    $valOldTxtBadge = _GUICtrlListView_GetItemText($hListView_Anagrafiche, $iItemIndex)
    $anagraficheRS = ObjCreate("ADODB.Recordset")
    $anagraficheRS.CursorType = 0
    $anagraficheRS.LockType = 3
    $anagraficheRS.Open("SELECT Anagrafiche.*, Uffici.Ufficio FROM Anagrafiche, Uffici WHERE " & _
            "Anagrafiche.idUff = Uffici.idUff AND " & _
            "Anagrafiche.idBadge = '" & $valTxtBadge & "'", $sqlConACC)
    If Not $anagraficheRS.Eof Then
        If $valTxtBadge = $valOldTxtBadge Then
            
            $anagraficheRS = ObjCreate("ADODB.Recordset")
            $anagraficheRS.Open("UPDATE Anagrafiche SET idBadge ='" & $valTxtBadge & _
                    "', Cognome = '" & GUICtrlRead($txtCognome) & _
                    "', Nome    = '" & GUICtrlRead($txtNome) & _
                    "', idUff   = '" & $aUffici[_GUICtrlComboBox_GetCurSel($hcmbUfficio)] & _
                    "' WHERE idBadge = '" & $valOldTxtBadge & "'", $sqlConACC)
        Else
            MsgBox(0, 'Attenzione', 'Codice Badge già Esistente')
        EndIf
    Else
        $anagraficheRS = ObjCreate("ADODB.Recordset")
        $anagraficheRS.Open("UPDATE Anagrafiche SET idBadge ='" & $valTxtBadge & _
                "', Cognome = '" & GUICtrlRead($txtCognome) & _
                "', Nome    = '" & GUICtrlRead($txtNome) & _
                "', idUff   = '" & $aUffici[_GUICtrlComboBox_GetCurSel($hcmbUfficio)] & _
                "' WHERE idBadge = '" & $valOldTxtBadge & "'", $sqlConACC)
        
    EndIf
EndFunc  ;==>_Modifica_Record_A
Link to comment
Share on other sites

Ok...

I read all posts...

But, I want disable the drag, not to manage it...

How can I do it?

I must use only _CreateListview instead of _Create_Listview?

If it is, I must rewrite a lot of code..

Is there another soluction?

Thank you

Roby

Link to comment
Share on other sites

Ok...

I read all posts...

But, I want disable the drag, not to manage it...

How can I do it?

I must use only _CreateListview instead of _Create_Listview?

If it is, I must rewrite a lot of code..

Is there another soluction?

Thank you

Roby

Yes use GuiCtrlCreateListView.

Why rewrite alot of code? the UDFs work with the built-in function.

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

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...