bonjour mssieurs dames,
voici mon problème, j'ai une listview (GuiCtrlCreateListView) , que je rempli a partir d'un fichier texte( 1 seule colonne )
L'idée generale est tout simple, un clic dans la liste et ca copie en mémoire le texte.
Probleme: je cherche a avoir un texte sur plusieurs lignes.
Mon fichier de 3 lignes ressemble à ca:
je suis sur une seule ligne.
"Moi aussi." & @crlf & "Mais je voudrais bien être sur 2 lignes."
je suis tout seul.
En gros mon truc marche nickel avec 1 ligne. Je clic dans ma liste, ca copie le texte en mémoire.
Si dans mon code je fais clipput("Moi aussi." & @crlf & "Mais je voudrais bien être sur 2 lignes") => ceci est bien copié en mémoire et si je colle ca apparait bien sur 2 lignes, comme ceci:
Moi aussi.
Mais je voudrais bien être sur 2 lignes.
Mais je passe par la fonction
Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam)
Dans laquelle:
Local $sToolTipData = _GUICtrlListView_GetItemText($hListView, $iItem, $subitemNR)
clipput($sToolTipData)
Donc ici le contenu de mon $sToolTipData est: "Moi aussi." & @crlf & "Mais je voudrais bien être sur 2 lignes."
=> Et donc sur un texte a 2 lignes, ca copie mon texte en mémoire mais celui ci n'est pas interprété, il apparait comme si j'affichait ma variable.
► Afficher le textecreation de ma listview
$hListView = GuiCtrlCreateListView("ZeListe", 1, 20, 900, 500,-1, BitOR($LVS_EX_GRIDLINES,$LVS_EX_FULLROWSELECT ))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES,$LVS_EX_FULLROWSELECT ))
_FileReadToArray($sFile, $a_cvs)
; on rempli la liste depuis le csv
For $i = 1 To UBound($a_cvs) - 1
GUICtrlCreateListViewItem($a_cvs[$i], $hListView)
Next
_GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE_USEHEADER)
_GUICtrlListView_SetColumnWidth($hListView, 1, 1) ; <<<<<<<<<<<<<<<<<<<<<<<<<<
GUISetState(@SW_SHOW, $gui2)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
endFunc
Mon code ci dessous provient de
http://www.autoitscript.com/forum/topic ... ext-cells/
Attention il y a plein de trucs qui servent a rien, j'ai pas encore nettoyé le contenu. Je fait mon clipput a la fin..
► Afficher le textele WM_NOTIFY
Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $NM_CLICK ; when clicking on a cell that is multiline, a tooltip will display the content
;Case $LVN_HOTTRACK; Sent by a list-view control when the user moves the mouse over an item
Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam)
Local $iItem = DllStructGetData($tInfo, "Item")
Local $subitemNR = DllStructGetData($tInfo, "SubItem")
$Column_attribute =_GUICtrlListView_GetColumn($hListView, $subitemNR)
; if no cell change return without doing anything
If $iLastItem = $iItem And $iLastsubitemNR = $subitemNR Then Return 0
$iLastItem = $iItem
$iLastsubitemNR = $subitemNR
; ICI DESSOUS JE COPIE EN MEMOIRE
Local $sToolTipData = _GUICtrlListView_GetItemText($hListView, $iItem, $subitemNR)
clipput($sToolTipData)
Donc peut être que je dois simplement revoir la méthode utilisée, ou peut etre avez vous une astuce pour que le 'code' de ma variable: ("Moi aussi." & @crlf & "Mais je voudrais bien être sur 2 lignes.") soit 'interprété comme il l'est lorsque je fait directement clipput("Moi aussi." & @crlf & "Mais je voudrais bien être sur 2 lignes")
Voila tout,
en vous remerciant.
Nicolas.