Jump to content

Search the Community

Showing results for tags 'WM_NOTIFY treeview'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. hello again this time, I’m trying to use treeviews with the click detection, after a couple of days of search on the help file, the forums and example files, i found the best way is use the WM_NOTIFY function, but i cant make it work how i want Global $abreinci,$abremat,$abrefalta,$etidescipcio #include <GUIConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <GuiTab.au3> incidencia() func incidencia() Local $msg,$rs,$rs1,$li[16],$ci[16],$i,$error,$observacio,$codimat[1000],$codifalta[1000],$codiinci[1000],$fam,$parefalta,$pareinci,$paremat,$of,$material,$temp=0,$codi,$tab[5] Local $clikedfalta,$clikedinci,$clikedmat local $guiinci=GUICreate("incidencies:",500,550,@DesktopWidth/2-250,@DesktopHeight/2-300,bitor($GUI_SS_DEFAULT_GUI,$WS_VISIBLE)) GUISetBkColor(0xffcc99) local $butcancelar=GUICtrlCreateButton("Cancelar",10,485,100,55) Local $butmes =GUICtrlCreateButton("+",250-50-10,485,50,50) GUICtrlSetFont(-1,17) Local $butmenys =GUICtrlCreateButton("-",250+10,485,50,50) GUICtrlSetFont(-1,17) $etidescipcio=GUICtrlCreateInput("",10,450,480,25,0x0001) GUICtrlSetState(-1,$gui_disable) GUICtrlSetFont(-1,15) $tab[0]=GUICtrlCreateTab(10,10,480,430) GUICtrlSetFont(-1,15) $tab[1]=GUICtrlCreateTabItem("Incidencia") GUICtrlSetFont(-1,15) $abreinci=GUICtrlCreateTreeView(20,50,460,380,BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES), $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1,14) $tab[2]=GUICtrlCreateTabItem("Incorrecte") $abremat=GUICtrlCreateTreeView(20,50,460,380,BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES), $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1,14) $tab[3]=GUICtrlCreateTabItem("Falta") $abrefalta=GUICtrlCreateTreeView(20,50,460,380,BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES), $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1,14) $tab[4]=GUICtrlCreateTabItem("Altres") $observacio=GUICtrlCreateInput("",20,50,460,380,0x0004) GUICtrlSetFont(-1,14) GUICtrlCreateTabItem("") _GUICtrlTab_SetCurFocus($tab[0],0) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") $i=0 while $i < 100 $fam=int($i/10) $parefalta=GUICtrlCreateTreeViewItem($fam&": text", $abrefalta) $pareinci =GUICtrlCreateTreeViewItem($fam&": text", $abreinci) $paremat =GUICtrlCreateTreeViewItem($fam&": text", $abremat) While $fam=int($i/10) $codiinci[$i] = GUICtrlCreateTreeViewItem("1x "&$i, $pareinci) $codifalta[$i]= GUICtrlCreateTreeViewItem("1x "&$i, $parefalta) $codimat[$i] = GUICtrlCreateTreeViewItem("1x "&$i, $paremat) $i=$i+5 WEnd WEnd $codifalta[0]=$i $codiinci[0]=$i $codimat[0]=$i While 1 $msg=GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE GUIDelete($guiinci) ExitLoop case $butcancelar GUIDelete($guiinci) ExitLoop EndSwitch WEnd EndFunc Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndabreinci,$hWndabremat,$hWndabrefalta,$temp Local $clikedinci,$codi,$rs $hWndabremat = $abremat $hWndabreinci = $abreinci $hWndabrefalta= $abrefalta If Not IsHWnd($abremat) Then $hWndabremat = GUICtrlGetHandle($abremat) If Not IsHWnd($abreinci) Then $hWndabreinci = GUICtrlGetHandle($abreinci) If Not IsHWnd($abrefalta) Then $hWndabrefalta = GUICtrlGetHandle($abrefalta) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom case $hWndabreinci Switch $iCode Case $NM_CLICK ; The user has clicked the left mouse button within the control if not StringInStr(_GUICtrlTreeView_GetText($abreinci,_GUICtrlTreeView_GetSelection($abreinci)),':') then $clikedinci=_GUICtrlTreeView_GetSelection($abreinci) $codi=_GUICtrlTreeView_GetText($abreinci,$clikedinci) GUICtrlSetData($etidescipcio,"u selected"&$codi) if _GUICtrlTreeView_GetChecked($abreinci, $clikedinci) Then _GUICtrlTreeView_SetChecked($abreinci, $clikedinci,False) Else _GUICtrlTreeView_SetChecked($abreinci, $clikedinci,true) EndIf EndIf Return 0 EndSwitch Case $hWndabremat Switch $iCode Case $NM_CLICK ; The user has clicked the left mouse button within the control Return 0 ; zero to allow the default processing EndSwitch case $hWndabrefalta Switch $iCode Case $NM_CLICK ; The user has clicked the left mouse button within the control Return 0 ; zero to allow the default processing EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc but for what i see this function it's pre-processed before the click, and it mark the last item instead the actual one I had to seek for info because I started to make a similar thing: Global $abreinci,$abremat,$abrefalta,$etidescipcio #include <GUIConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <GuiTab.au3> incidencia() func incidencia() Local $msg,$rs,$rs1,$li[16],$ci[16],$i,$error,$observacio,$codimat[1000],$codifalta[1000],$codiinci[1000],$fam,$parefalta,$pareinci,$paremat,$of,$material,$temp=0,$codi,$tab[5] Local $clikedfalta,$clikedinci,$clikedmat local $guiinci=GUICreate("incidencies:",500,550,@DesktopWidth/2-250,@DesktopHeight/2-300,bitor($GUI_SS_DEFAULT_GUI,$WS_VISIBLE)) GUISetBkColor(0xffcc99) local $butcancelar=GUICtrlCreateButton("Cancelar",10,485,100,55) Local $butmes =GUICtrlCreateButton("+",250-50-10,485,50,50) GUICtrlSetFont(-1,17) Local $butmenys =GUICtrlCreateButton("-",250+10,485,50,50) GUICtrlSetFont(-1,17) $etidescipcio=GUICtrlCreateInput("",10,450,480,25,0x0001) GUICtrlSetState(-1,$gui_disable) GUICtrlSetFont(-1,15) $tab[0]=GUICtrlCreateTab(10,10,480,430) GUICtrlSetFont(-1,15) $tab[1]=GUICtrlCreateTabItem("Incidencia") GUICtrlSetFont(-1,15) $abreinci=GUICtrlCreateTreeView(20,50,460,380,BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES), $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1,14) $tab[2]=GUICtrlCreateTabItem("Incorrecte") $abremat=GUICtrlCreateTreeView(20,50,460,380,BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES), $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1,14) $tab[3]=GUICtrlCreateTabItem("Falta") $abrefalta=GUICtrlCreateTreeView(20,50,460,380,BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES), $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1,14) $tab[4]=GUICtrlCreateTabItem("Altres") $observacio=GUICtrlCreateInput("",20,50,460,380,0x0004) GUICtrlSetFont(-1,14) GUICtrlCreateTabItem("") _GUICtrlTab_SetCurFocus($tab[0],0) $i=0 while $i < 100 $fam=int($i/10) $parefalta=GUICtrlCreateTreeViewItem($fam&": text", $abrefalta) $pareinci =GUICtrlCreateTreeViewItem($fam&": text", $abreinci) $paremat =GUICtrlCreateTreeViewItem($fam&": text", $abremat) While $fam=int($i/10) $codiinci[$i] = GUICtrlCreateTreeViewItem("1x "&$i, $pareinci) $codifalta[$i]= GUICtrlCreateTreeViewItem("1x "&$i, $parefalta) $codimat[$i] = GUICtrlCreateTreeViewItem("1x "&$i, $paremat) $i=$i+5 WEnd WEnd $codifalta[0]=$i $codiinci[0]=$i $codimat[0]=$i While 1 $msg=GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE GUIDelete($guiinci) ExitLoop case $butcancelar GUIDelete($guiinci) ExitLoop case $butmes sleep(10) case $butmenys sleep(10) Case $NM_KILLFOCUS if _GUICtrlTab_GetCurFocus($tab[0])+1 =1 Then if not StringInStr(_GUICtrlTreeView_GetText($abreinci,_GUICtrlTreeView_GetSelection($abreinci)),':') then $clikedinci=_GUICtrlTreeView_GetSelection($abreinci) $codi=_GUICtrlTreeView_GetText($abreinci,$clikedinci) GUICtrlSetData($etidescipcio,"u selected"&$codi) if _GUICtrlTreeView_GetChecked($abreinci, $clikedinci) Then _GUICtrlTreeView_SetChecked($abreinci, $clikedinci,False) Else _GUICtrlTreeView_SetChecked($abreinci, $clikedinci,true) EndIf EndIf EndIf if _GUICtrlTab_GetCurFocus($tab[0])+1 =2 Then if not StringInStr(_GUICtrlTreeView_GetText($abremat,_GUICtrlTreeView_GetSelection($abremat)),':') then $clikedmat=_GUICtrlTreeView_GetSelection($abremat) $codi=_GUICtrlTreeView_GetText($abremat,$clikedmat) GUICtrlSetData($etidescipcio,"u selected"&$codi) if _GUICtrlTreeView_GetChecked($abremat, $clikedmat) Then _GUICtrlTreeView_SetChecked($abremat, $clikedmat,False) Else _GUICtrlTreeView_SetChecked($abremat, $clikedmat,true) EndIf EndIf EndIf if _GUICtrlTab_GetCurFocus($tab[0])+1 =3 Then if not StringInStr(_GUICtrlTreeView_GetText($abrefalta,_GUICtrlTreeView_GetSelection($abrefalta)),':') then $clikedfalta=_GUICtrlTreeView_GetSelection($abrefalta) $codi=_GUICtrlTreeView_GetText($abrefalta,$clikedfalta) GUICtrlSetData($etidescipcio,"u selected"&$codi) if _GUICtrlTreeView_GetChecked($abrefalta, $clikedfalta) Then _GUICtrlTreeView_SetChecked($abrefalta, $clikedfalta,False) Else _GUICtrlTreeView_SetChecked($abrefalta, $clikedfalta,true) EndIf EndIf EndIf EndSwitch WEnd EndFunc but the problem was that when i hit a button they not only do the button “case”, it do both, checking/unchecking the selected item on the tree well i dont have any ideas left so i come here to beg for some help XD
×
×
  • Create New...