Select and delete a text in a string gadget

Just starting out? Need help? Post your questions and find answers here.
Armoured
Enthusiast
Enthusiast
Posts: 365
Joined: Mon Jan 26, 2004 11:39 am
Location: ITALY
Contact:

Select and delete a text in a string gadget

Post by Armoured »

Hi :D
How I can select a small portion of a text in a StringGadget and after delete him? :?

Thanks.
The seperator
User
User
Posts: 17
Joined: Sun Apr 25, 2004 9:12 pm
Location: Europe, Belgium

Post by The seperator »

Have you tried the SendMessage_() function?
You can find more information about it in the win32 api guide
The seperator
User
User
Posts: 17
Joined: Sun Apr 25, 2004 9:12 pm
Location: Europe, Belgium

Post by The seperator »

for example:

SendMessage_(GadgetID(;Your gadget;),#WM_CUT,0,0)

will delete the selected text and copy it to the clipboard.
This works for the rich editor. Haven't tested it yet on a string gadget but
normaly it should work.
Armoured
Enthusiast
Enthusiast
Posts: 365
Joined: Mon Jan 26, 2004 11:39 am
Location: ITALY
Contact:

Post by Armoured »

Hi :D
I have used this:

SendMessage_(GadgetID(#StringGadget),#WM_CLEAR,0,0)

will delete the selected text and nothing is copied to the clipboard 8)

Thanks again "The seperator". :wink:
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

If you want to delete only a little portion of the text you can use this:

Code: Select all

      SendMessage_(GadgetID(#StringGadget), #EM_SETSEL, 2, 5) ; select the chars from 2 to 5
      SendMessage_(GadgetID(#StringGadget), #WM_CUT, 0, 0) ; Cut it and place it in the clipboard
Post Reply