Seite 1 von 1

StringGadget mehrzeilig mit WordWrap

Verfasst: 21.02.2005 14:19
von Sven
Hi, ich möchte Text in einem String- oder EditorGadget mehrzeilig darstellen. Dabei soll der Text am Ende der Zeile automatisch umgebrochen werden, also kein horizontaler Scrollbalken. Im CodeArchiv habe ich was gefunden, das fast genau das macht:

Code: Alles auswählen

If OpenWindow(0,0,0,640,480,#PB_Window_SystemMenu,"") And CreateGadgetList(WindowID(0))
  StringGadget(0,8,8,626,466,"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!",#ES_MULTILINE | #ESB_DISABLE_LEFT | #ESB_DISABLE_RIGHT | #ES_AUTOVSCROLL | #WS_VSCROLL)
  Repeat
  Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
Aber eben nur fast, der Text ist nämlich konsequent rechtsbündig. :( Wie bekomme ich ihn wieder linksbündig? Ein zusätzliches #ES_LEFT bei den Flags bringt nix.

Sven

Verfasst: 21.02.2005 15:00
von Hroudtwolf
Bei mir ist der Text linksbündig !?!

Verfasst: 21.02.2005 15:28
von bluejoke
Bei mir auch.

Verfasst: 21.02.2005 15:53
von glubschi90
Dito...

Verfasst: 21.02.2005 19:38
von ts-soft
Wenn Du das EditorGadget nimmst, kannste es so machen:

Code: Alles auswählen

If OpenWindow(0,0,0,640,480,#PB_Window_SystemMenu,"") And CreateGadgetList(WindowID(0))
  EditorGadget(0,8,8,626,466)
  SendMessage_(GadgetID(0),#EM_SETTARGETDEVICE, #Null, #False)
  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
Die SendMessage_() Anweisung setzt WordWrap fürs EditorGadget

Verfasst: 22.02.2005 15:53
von Sven
>> Bei mir ist der Text linksbündig !?!

Grrr, bei mir nicht. (Win98)

Aber das Beispiel von ts-soft funktioniert. Danke.

Sven

Verfasst: 22.02.2005 16:08
von ts-soft

Code: Alles auswählen

#ESB_DISABLE_LEFT | #ESB_DISABLE_RIGHT
Ist keine gültige Kombination, funktioniert daher auch nicht unter allen Windows-Versionen