Page 1 of 1

Editor Gadget character input limit.

Posted: Tue Aug 02, 2011 10:37 pm
by AndyMK
I have an editor gadget with wordwrap enabled. The size of the editor is small and fits 10 lines before the vertical scroll bar appears. I dont want the scroll bars to appear as i need to limit the text to the size of the box. Is there a simple way to do this?

Re: Editor Gadget character input limit.

Posted: Tue Aug 02, 2011 10:51 pm
by netmaestro
SendMessage(GadgetID(<edit>), #EM_LIMITTEXT, <max chars>, 0)

Windows only.

Re: Editor Gadget character input limit.

Posted: Tue Aug 02, 2011 10:53 pm
by AndyMK
Thank you

Re: Editor Gadget character input limit.

Posted: Tue Aug 02, 2011 10:59 pm
by AndyMK
Is there a way to limit lines? I checked the constants on msdn but could see anything related to it.

Re: Editor Gadget character input limit.

Posted: Wed Aug 03, 2011 12:48 am
by PureLeo
Something like this could be used to limit lines....

Code: Select all

  Select WindowEvent()
  	Case #PB_Event_Gadget
  		Select EventGadget()
  			Case #Editor_0
  				Select EventType()
  					Case 1024
  						If CountGadgetItems(#Editor_0)>10
  							RemoveGadgetItem(#Editor_0,11)
  						EndIf
  				EndSelect
  		EndSelect
  EndSelect


Re: Editor Gadget character input limit.

Posted: Wed Aug 03, 2011 1:24 am
by netmaestro
You can try this: SendMessage_(GadgetID(<edit>), #EM_SHOWSCROLLBAR, #SB_VERT, 0) where the vertical scrollbar will not show.

Re: Editor Gadget character input limit.

Posted: Wed Aug 03, 2011 6:35 pm
by AndyMK
Thanks guy's, works a treat.