Ooops
November 28, 2020, 02:23:35 AM

Author Topic: [bmx] Word wrap by col [ 1+ years ago ]  (Read 450 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bmx] Word wrap by col [ 1+ years ago ]
« on: June 29, 2017, 12:28:41 AM »
Title : Word wrap
Author : col
Posted : 1+ years ago

Description : ( MaxGUI - Windows )
You can switch the word wrap feature of a TextArea gadget on and off using this code.

This code is for Windows only.


Code :
Code: BlitzMax
  1. Strict
  2.  
  3. Import MaxGUI.Drivers
  4.  
  5. Global Window:TGadget = CreateWindow("Word wrap",200,0,500,500)
  6. Global Text:TGadget = CreateTextArea(0,0,ClientWidth(Window),ClientHeight(Window)-60,Window)
  7.  
  8. ' Some text
  9. SetGadgetText Text,"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla eget mauris quis dolor "+..
  10. "ullamcorper dapibus. Duis facilisis ullamcorper metus. Pellentesque eget enim. Vivamus auctor hendrerit turpis. " + ..
  11. "Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vivamus tincidunt leo quis urna."
  12.  
  13. Global WordWrapChoice:TGadget = CreateButton("Word wrap",10,GadgetHeight(Text)+10,100,30,Window,BUTTON_CHECKBOX)
  14.  
  15. Repeat
  16.         WaitEvent
  17.        
  18.         Select EventSource()
  19.                 Case Window
  20.                         If EventID() = EVENT_WINDOWCLOSE End
  21.                        
  22.                 Case WordWrapChoice
  23.                         Local hWnd = QueryGadget(Text,QUERY_HWND)
  24.                        
  25.                         Select ButtonState(WordWrapChoice)
  26.                                 Case True
  27.                                         SendMessageW(hWnd,EM_SETTARGETDEVICE,0,0)
  28.                                        
  29.                                 Case False
  30.                                         SendMessageW(hWnd,EM_SETTARGETDEVICE,0,1)
  31.                         EndSelect
  32.         EndSelect
  33. Forever


Comments :


TAS(Posted 1+ years ago)

 CreateTextArea() supports the two styles. TEXTAREA_WORDWRAP Long lines of text 'wrap round' onto the next lines. TEXTAREA_READONLY The text cannot be edited by the user.


MOBii(Posted 1+ years ago)

 SuperStrict:
Code: [Select]
SuperStrict

Import maxgui.Drivers


Global Window:TGadget = CreateWindow("Word wrap",200,0,500,500)
Global Text:TGadget = CreateTextArea(0,0,ClientWidth(Window),ClientHeight(Window)-60,Window)

' Some text
SetGadgetText Text,"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla eget mauris quis dolor "+..
"ullamcorper dapibus. Duis facilisis ullamcorper metus. Pellentesque eget enim. Vivamus auctor hendrerit turpis. " + ..
"Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vivamus tincidunt leo quis urna."

Global WordWrapChoice:TGadget = CreateButton("Word wrap",10,GadgetHeight(Text)+10,100,30,Window,BUTTON_CHECKBOX)

Repeat
WaitEvent()

Select EventSource()
Case Window
If EventID() = EVENT_WINDOWCLOSE End

Case WordWrapChoice
Local hWnd:Int = QueryGadget(Text,QUERY_HWND)

Select ButtonState(WordWrapChoice)
Case True
SendMessageW(hWnd, EM_SETTARGETDEVICE,0,0)

Case False
SendMessageW(hWnd , EM_SETTARGETDEVICE,0,1)
EndSelect
EndSelect
Forever
Thanks for this Example [/i]

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal