CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2005
    Posts
    102

    edit field unlimited chars?

    Hello, i've created an edit field, but it can't contain an unlimited amount of chars. The width of the edit field is the max number of chars, how can i make this go away so that it can contain as many chars as i want?

  2. #2
    Join Date
    Jun 2005
    Location
    Chennai , India
    Posts
    1,375

    Thumbs up Re: edit field unlimited chars?

    Quote Originally Posted by vivendi
    Hello, i've created an edit field, but it can't contain an unlimited amount of chars. The width of the edit field is the max number of chars, how can i make this go away so that it can contain as many chars as i want?
    how about using Multiline Edit Control ....
    It takes seconds for rating…that actually compensates the minutes taken for giving answers
    The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
    Regards, Be generous->Rate people
    Jayender!!

  3. #3
    Join Date
    Aug 2004
    Location
    Bucharest, Romania... sometimes
    Posts
    1,039

    Re: edit field unlimited chars?

    In this sample, the bold line makes the edit control to use unlimited memory for the text that can be contained by the control:
    Code:
    	CEdit::Create(
    		WS_CHILD|WS_VISIBLE|WS_TABSTOP
    		|ES_AUTOHSCROLL|ES_AUTOVSCROLL
    		|ES_LEFT
    		|(isMultiline?ES_WANTRETURN|ES_MULTILINE/*|WS_HSCROLL*/|WS_VSCROLL:0)
    		,rcCtl,pParent,IDC_EDIT_BOX + (++count));
    	CEdit::SetLimitText(0);
    Regards,
    Bogdan Apostol
    ESRI Developer Network

    Compilers demystified - Function pointers in Visual Basic 6.0
    Enables the use of function pointers in VB6 and shows how to embed native code in a VB application.

    Customize your R2H
    The unofficial board dedicated to ASUS R2H UMPC owners.

  4. #4
    Join Date
    Nov 2005
    Posts
    102

    Re: edit field unlimited chars?

    Without MFC code please...

  5. #5
    Join Date
    Aug 2004
    Location
    Bucharest, Romania... sometimes
    Posts
    1,039

    Re: edit field unlimited chars?

    Quote Originally Posted by jayender.vs
    how about using Multiline Edit Control ....
    That won't solve his problem... since Multiline Edit control will also limit the buffer size by default.

    @vivendi: Another way of changing the behaviour of the control, using only APIs (no MFC derived class), would be to send EM_SETLIMITTEXT message to the control (using SendMessage API). Give both wParam & lParam as 0 (zero) in order to disable max_characters check.

    Regards,
    Bogdan Apostol
    ESRI Developer Network

    Compilers demystified - Function pointers in Visual Basic 6.0
    Enables the use of function pointers in VB6 and shows how to embed native code in a VB application.

    Customize your R2H
    The unofficial board dedicated to ASUS R2H UMPC owners.

  6. #6
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: edit field unlimited chars?

    [ Moved thread ]

    Well, everything has a limit.
    The max limit that can be set (by passing zero in wParam when sending EM_SETLIMITTEXT/EM_LIMITTEXT message) depends on edit type (single or multiline) and the operating system
    • Windows 95/98
      • 0x7FFE for single line edit control
      • 0xFFFF for multiline edit control
    • Windows NT/2000/XP
      • 0x7FFFFFFE for single line edit control
      • 0xFFFFFFFF for multiline edit control

    If you want to step beyond these limits use rich edit control.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  7. #7
    Join Date
    Sep 2004
    Location
    Italy
    Posts
    389

    Re: edit field unlimited chars?

    Quote Originally Posted by vivendi
    Hello, i've created an edit field, but it can't contain an unlimited amount of chars. The width of the edit field is the max number of chars, how can i make this go away so that it can contain as many chars as i want?
    Just use the ES_AUTOHSCROLL style.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured