Page 1 of 1

EditorGadgetActivateWordWrap - Windows + Linux

Posted: Sun Jan 17, 2010 4:03 pm
by Guimauve
Hello everyone,

This is a small procedure to Activate or Deactivate the EditorGadget() wordwrap behaviour. The code work on Windows and Linux.

Have Fun !!

Regards
Guimauve

P.S. Sorry for the French comments in this source.

Code: Select all

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; 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 : 17-01-2010
; 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 <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<

Re: EditorGadgetActivateWordWrap - Windows + Linux

Posted: Wed Jan 20, 2010 1:48 pm
by afriend
Thanks for sharing. :)

Re: EditorGadgetActivateWordWrap - Windows + Linux

Posted: Thu Feb 11, 2010 6:59 am
by oryaaaaa
Thanks :)

Re: EditorGadgetActivateWordWrap - Windows + Linux

Posted: Thu Feb 11, 2010 10:35 am
by Kwai chang caine
Thanks :wink:

Re: EditorGadgetActivateWordWrap - Windows + Linux

Posted: Fri Feb 12, 2010 6:48 pm
by Andre
Fine. :)

Anyone could add the related MacOS API commands? Thanks!

Re: EditorGadgetActivateWordWrap - Windows + Linux

Posted: Fri Feb 12, 2010 7:24 pm
by Progi1984

Re: EditorGadgetActivateWordWrap - Windows + Linux

Posted: Sun Sep 12, 2010 12:08 pm
by Shardik
Andre wrote:Anyone could add the related MacOS API commands? Thanks!
I finally found a solution for MacOS:
http://www.purebasic.fr/english/viewtop ... 38&start=3