EditorGadgetActivateWordWrap - Windows + Linux

Share your advanced PureBasic knowledge/code with the community.
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

EditorGadgetActivateWordWrap - Windows + Linux

Post 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 <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<
Last edited by Guimauve on Fri Sep 30, 2011 11:21 pm, edited 1 time in total.
afriend
User
User
Posts: 20
Joined: Thu Aug 09, 2007 5:47 am
Location: Melbourne, Australia

Re: EditorGadgetActivateWordWrap - Windows + Linux

Post by afriend »

Thanks for sharing. :)
User avatar
oryaaaaa
Addict
Addict
Posts: 825
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Re: EditorGadgetActivateWordWrap - Windows + Linux

Post by oryaaaaa »

Thanks :)
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: EditorGadgetActivateWordWrap - Windows + Linux

Post by Kwai chang caine »

Thanks :wink:
ImageThe happiness is a road...
Not a destination
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2139
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: EditorGadgetActivateWordWrap - Windows + Linux

Post by Andre »

Fine. :)

Anyone could add the related MacOS API commands? Thanks!
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: EditorGadgetActivateWordWrap - Windows + Linux

Post 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
Post Reply