Announcement

Collapse
No announcement yet.

delete in edit menu, select all text

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • delete in edit menu, select all text

    How do I do the delete function in the edit menu?
    Sometimes called Delete other times called Clear?

    Also how do I select all text in my edit field

    Brian
    Brian Heibert
    [email protected]
    http://www.heibertsoftware.com
    http://www.winvocalassist.com
    http://www.heibert.net

  • #2
    Brian,
    In the other example I gave you , with the Select/Unselect text, at:

    http://www.garybeene.com/power/code/..._gbs_00139.htm

    If you want to remove the text in an edit control, then all you need is to use this line for the response code for one of the buttons.

    Code:
    Control Set Text hDlg, %ID_Text, ""

    Comment


    • #3
      I tried to use this
      CONTROL SET TEXT hDlg, %IDM_EDIT_DELETE, ""

      However it isn't working it doesn't delete the text in the edit field
      Brian Heibert
      [email protected]
      http://www.heibertsoftware.com
      http://www.winvocalassist.com
      http://www.heibert.net

      Comment


      • #4
        Really Brian, showing your full code, preferably in compilable form would get you a lot more help that wouldn't leave you asking so many questions. Reading the manual and checking the files in the Examples or Samples folder that came with your compiler would save you time.
        Because some of your questions are to some quite elementary, we aren't sure that you are asking the right question.
        In this latest question of yours, an ID with %IDM_etc is usually a Menu ID and as such "CONTROL SET TEXT" does not apply to it.

        There is a very good Menu example in the Help file, just click on M from the home page of the HELP, select a MENU item and at the bottom of it, it will show "EXAMPLE See Menu Example".
        Rod
        In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

        Comment


        • #5
          The EM_SETSEL message allows you to set the selection text in an edit control; the EM_REPLACESEL message allows you replace that selection with anything, or with nothing (delete it).

          MCM
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            Windows provides messages for easily duplicating functionality in an edit field context menu:

            MSDN: WM_UNDO
            MSDN: WM_CUT
            MSDN: WM_COPY
            MSDN: WM_PASTE
            MSDN: WM_CLEAR (delete)
            MSDN: EM_SETSEL

            EM_SETSEL can be used in this form to duplicate Select All functionality:

            Code:
            SendMessage hWnd, %EM_SETSEL, 0, -1
            or

            Code:
            CONTROL SEND hDlg, CtrlID, %EM_SETSEL, 0, -1
            Adam Drake
            PowerBASIC

            Comment


            • #7
              ....OR (for those of us who cannot remember which parameters are used with which messages.. or how to spell all those messages )......

              Code:
              #IF %DEF(%USING_DDT)
                 MACRO Edit_SelectAll (hWnd, idctrl) = CONTROL SEND hWwd, idctrl, %EM_SETSEL, 0, -1&
              #ELSE
                MACRO Edit_SelectAll (hWnd, idctrl) = SendDlgItemMessage hWnd, idctrl, %EM_SETSEL, 0, -1&
              #ENDIF
              
              
              ....
              CALLBACK FUNCTION ....
                     
                      Edit_Selectall (CB.HNDL, %ID_MY_TEXTBOX)
              MCM
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                delete didn't work

                I tried to do this to do delete

                CASE %IDM_EDIT_DELETE
                ' Control Set Text hDlg, %IDM_EDIT_DELETE, ""
                CONTROL SEND hDlg,%IDC_USERENTRY, %EM_SETSEL, 0, -1

                But nothing happened no deletion

                What next?

                Brian
                Brian Heibert
                [email protected]
                http://www.heibertsoftware.com
                http://www.winvocalassist.com
                http://www.heibert.net

                Comment


                • #9
                  >What next?

                  What's next is learning how much and how to post the code which is giving you trouble.
                  Michael Mattias
                  Tal Systems (retired)
                  Port Washington WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment


                  • #10
                    How about
                    Code:
                    LOCAL Clearit$=""
                    CONTROL SET TEXT hDlg,Control_ID%,Clearit$
                    where hDlg is the dialog handle and Control_ID% is the handle of the control within the dialog.

                    This will work for textbox and Static controls (Label).
                    Client Writeup for the CPA

                    buffs.proboards2.com

                    Links Page

                    Comment


                    • #11
                      Try it this way:
                      Code:
                      CASE %IDM_EDIT_DELETE
                         ' Control Set Text hDlg, %IDM_EDIT_DELETE, ""   
                         CONTROL SET TEXT CB.HNDL, %IDC_USERENTRY, ""
                         CONTROL REDRAW CB.HNDL, %IDC_USERENTRY
                      The REDRAW forces the change now, rather than letting it wait in the queue.
                      Notice the use of the CB.HNDL instead of hDlg in the CALLBACK FUNCTION.
                      Rod
                      In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

                      Comment


                      • #12
                        >What next?

                        What's next is learning how much and how to post the code which is giving you trouble.
                        Reply With Quote
                        He has posted the code in one of the many other forum threads dealing with his issues. An epiphany is in order, though.
                        Rod
                        In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

                        Comment


                        • #13
                          >He has posted the code in one of the many other forum threads dealing with his issues

                          IMO one should not ask others to "search" - and in this case, "guess which one" as the first step in helping you.

                          Besides, if this line is not working, it's not the same code, is it? And I do believe we've all seen one or two times A "problem line" was not THE REAL "problem line."

                          MCM
                          Michael Mattias
                          Tal Systems (retired)
                          Port Washington WI USA
                          [email protected]
                          http://www.talsystems.com

                          Comment


                          • #14
                            Michael, I am not and was not expecting you to experience the epiphany!
                            I concur fully with you.
                            Rod
                            In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

                            Comment

                            Working...
                            X