Page 1 of 1

EditorGadget and Wordwrap and stuff

Posted: Mon Feb 05, 2018 11:11 am
by SniffTheGlove
Hi,

I am looking to add an editorgadget to a window to act as a location for notes, however I can not seem to get the text to correct along with the wordwrap. Is there a special way to solve this?
The attached code is taken from the EditorGadget help file with the addition of some long sentences and also the wordwrap flag on the gadget.

Code: Select all

If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    EditorGadget(0, 8, 8, 306, 133, #PB_Editor_WordWrap)
    For a = 0 To 5
      AddGadgetItem(0, a, "If You Take a Mouse to School by Laura Numeroff and Felicia Bond "+Str(a) +#CRLF$)
    Next
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
This is what I see when running the above code.
If You Take a Mouse to School by Laura Numeroff and Felicia If You Take a Mouse to School by Laura Numeroff and Felicia If You Take a Mouse to School by Laura If You Take a Mouse to School by Laura Numeroff and Felicia If You Take a Mouse to School by Laura Numeroff and If You Take a Mouse to School by Laura Numeroff and Felicia Bond 5

Felicia Bond 4

Bond 3

Numeroff and Felicia Bond 2

Bond 1

Bond 0
This is what I was expecting to see!!
If You Take a Mouse to School by Laura Numeroff and Felicia Bond 0
If You Take a Mouse to School by Laura Numeroff and Felicia Bond 1
If You Take a Mouse to School by Laura Numeroff and Felicia Bond 2
If You Take a Mouse to School by Laura Numeroff and Felicia Bond 3
If You Take a Mouse to School by Laura Numeroff and Felicia Bond 4
If You Take a Mouse to School by Laura Numeroff and Felicia Bond 5

Re: EditorGadget and Wordwrap and stuff

Posted: Mon Feb 05, 2018 11:26 am
by infratec
Remove the CRLF at the end of the line and use -1 instead of a as index.
Because with a linewrap the number of the item is messed up.

Code: Select all

If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    EditorGadget(0, 8, 8, 306, 133, #PB_Editor_WordWrap)
    For a = 0 To 5
      AddGadgetItem(0, -1, "If You Take a Mouse to School by Laura Numeroff and Felicia Bond "+Str(a))
    Next
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
Bernd

Re: EditorGadget and Wordwrap and stuff

Posted: Tue Feb 06, 2018 12:11 pm
by SniffTheGlove
Thank you so much