Announcement

Collapse
No announcement yet.

Select all text in edit field

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

  • Michael Mattias
    replied
    >Since the PowerBASIC functions doesn't have statements to handle selections

    This would be a really good place for some macros...
    Code:
    MACRO  Edit_SelectAll (hEdit)    = SendMessage(hEdit, %EM_SetSel, -1, 0)
    MACRO  Edit_UnselectAll (hEdit) = SendMessage(hEdit, %EM_SetSel, 0, -1)
    That sure seems a lot easier to remember, no?

    Leave a comment:


  • Gary Beene
    replied
    Brian,

    These two lines do what you ask - select all, unselect all.

    Code:
    SendMessage(hEdit, %EM_SetSel, -1, 0)       '-1,0 unselects all
    SendMessage(hEdit, %EM_SetSel, 0, -1)       '0,-1 selects all
    Since the PowerBASIC functions doesn't have statements to handle selections, you have to use the Windows messages. "SendMessage".

    Or, you can use the PowerBASIC "Control Send" to send the same messages.

    Code:
    Control Send hDlg, %ID_Edit, %EM_SetSel, -1, 0
    Control Send hDlg, %ID_Edit, %EM_SetSel, 0, -1
    The hDlg is the dialog handle, %ID_Edit is the edit control ID, and %EM_SetSel is the message being sent. The -1,0 and 0,-1 pairs are the wParam and lParam arguments to the message you're sending.

    Here's an online, compilable source code example.
    Last edited by Gary Beene; 17 Nov 2009, 11:30 PM.

    Leave a comment:


  • Adam J. Drake
    replied
    Brian,

    Look at the link I posted...EM_SETSEL is the message you send to an edit control to select/unselect text in an edit field.

    Leave a comment:


  • Brian Heibert
    replied
    Clear & Select All

    I didn't see or understand what in those previous messages would help me do Clear and Select All

    Could someone explain, it's been a while since I have used PowerBASIC.

    Leave a comment:


  • Adam J. Drake
    replied
    MSDN: EM_SETSEL Message

    Leave a comment:


  • Dave Biggs
    replied
    Study the ideas in this thread..
    User to user discussions about the PB/Win (formerly PB/DLL) product line. Discussion topics include PowerBASIC Forms, PowerGEN and PowerTree for Windows.

    Leave a comment:


  • Brian Heibert
    started a topic Select all text in edit field

    Select all text in edit field

    How do I select all text in a edit field?

    Brian
Working...
X
😀
🥰
🤢
😎
😡
👍
👎