Seite 2 von 2

Re: Word Wrap nach X Zeichen

Verfasst: 04.04.2010 19:32
von CSHW89
ts-soft hat geschrieben:Eine solche API-Funkton gibt es nicht, dafür mußte Dir schon was selber basteln.
ha es funktioniert doch, habs jetzt mit meiner ursprünglichen idee geschafft. und es hatte was mit 'EM_SETWORDBREAKPROC' zu tun. so falls es jemanden interressiert, hier der code:

Code: Alles auswählen

Procedure EditWordBreakProc(*text, current, length, code)
EndProcedure


Procedure GadgetWordWrap(gadget)
  GID=GadgetID(gadget)
  dc=GetWindowDC_(GID)
  SendMessage_(GID, #EM_SETTARGETDEVICE, dc, -1)
  ReleaseDC_(GID,dc)
  SendMessage_(GadgetID(gadget), #EM_SETWORDBREAKPROC, 0, @EditWordBreakProc())
EndProcedure


If OpenWindow(0, 0, 0, 8*16+34, 160, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  EditorGadget(0, 5, 5, 8*16+24, 150)
  SetGadgetFont(0, LoadFont(0,"Courier",10))
  GadgetWordWrap(0)
  SetGadgetText(0, "Does anybody know how to set this stringgadget to auto-word wrap? When the text is too long, it is cut out and this is my problem. Do you know understand what I mean? I want the gadget to automatically add a line return when the text is too long and continued in the next line. Can anybody help me? Please! Thank you!")
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 
EndIf 
lg kevin