Voici un code que je viens d'adapter pour un de mes projets il sert à activer ou désactiver le retour à la ligne dans un EditorGadget(). (Il n'y a rien de neuf la dedans)
La procédure est valide à la fois pour Windows et pour Linux (Vive les directives du compilateur). J'espère qu'il pourra être utile à d'autre...
A+
Guimauve
Code : Tout sélectionner
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Nom du projet : EditorGadgetActivateWordWrap()
; Nom du fichier : EditorGadgetActivateWordWrap.pbi
; Version du fichier : 1.0.0
; Programmation : OK
; Programmé par : Guimauve
; Date : 17-01-2010
; Mise à jour : 01-10-2011
; Code PureBasic : 4.40
; Plateforme : Windows, Linux
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Procedure EditorGadgetActivateWordWrap(EditorID.l, State.l)
TextBuffer.s = GetGadgetText(EditorID)
If State = 0
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
SendMessage_(GadgetID(EditorID), #EM_SETTARGETDEVICE, #Null, $FFFFFF)
CompilerCase #PB_OS_Linux
gtk_text_view_set_wrap_mode_(GadgetID(EditorID), #GTK_WRAP_NONE)
CompilerEndSelect
ElseIf State = 1
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
SendMessage_(GadgetID(EditorID), #EM_SETTARGETDEVICE, #Null, 0)
CompilerCase #PB_OS_Linux
gtk_text_view_set_wrap_mode_(GadgetID(EditorID), #GTK_WRAP_WORD)
CompilerEndSelect
EndIf
SetGadgetText(EditorID, TextBuffer)
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< FIN DU FICHIER <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<