Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. restricting to type in CEdit

restricting to type in CEdit

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Ph ntom
    wrote on last edited by
    #1

    Hi all, Can anybody know how to restrict to type fixed number of characters in the CEdit control. Thanks. The Phantom.

    I D 2 Replies Last reply
    0
    • P Ph ntom

      Hi all, Can anybody know how to restrict to type fixed number of characters in the CEdit control. Thanks. The Phantom.

      I Offline
      I Offline
      iceage
      wrote on last edited by
      #2

      open Class Wizard and assign a CString variable for your edit and you will see "Maximum characters" in the lower part of the Class Wizard. Set there how many characters your CString wants to have.(same for int, long...)

      U H 2 Replies Last reply
      0
      • I iceage

        open Class Wizard and assign a CString variable for your edit and you will see "Maximum characters" in the lower part of the Class Wizard. Set there how many characters your CString wants to have.(same for int, long...)

        U Offline
        U Offline
        User 423850
        wrote on last edited by
        #3

        if u want to assign a CEdit ctrl as the data member to the Edit Ctrl then u can call the function-->> EditCtrl.SetLimitText(VALUE_of_memeber_u_want ); i hope this solve ur query Thanx TAKE CARE

        1 Reply Last reply
        0
        • I iceage

          open Class Wizard and assign a CString variable for your edit and you will see "Maximum characters" in the lower part of the Class Wizard. Set there how many characters your CString wants to have.(same for int, long...)

          H Offline
          H Offline
          henchook
          wrote on last edited by
          #4

          Hmmm.... is there an analgous way to restrict what is types? For example, suppose I only want to allow alphanumeric english letters in the editbox.... Or does that require subclassing?

          1 Reply Last reply
          0
          • P Ph ntom

            Hi all, Can anybody know how to restrict to type fixed number of characters in the CEdit control. Thanks. The Phantom.

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            Use the CEdit::SetLimitText(). You can use DDX for this but it's better to restrict the text length as you are typing rather than wait until the OK button has been clicked (i.e., validating in the OnOK() handler is too little too late).

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups