Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
4
Erster Beitrag:
vor 10 Monaten, 2 Wochen
Letzter Beitrag:
vor 10 Monaten, 2 Wochen
Beteiligte Autoren:
Robin Lane, Fabrice Harari, DerekT

Select text in an Edit Box

Startbeitrag von Robin Lane am 09.12.2016 14:39

Hello all,

I have an a multiline edit box which is filled by programming. I wish the user to select a part of the text in the edit box and then click on a button which will then "copy" the selected area into a variable.

Once the area has been selected / highlighted in the edit box, as you click on button the edit box loses focus and the selected area is lost. This prevents the code in the button from working as there is nothing selected in the edit box.

Is there a way of preventing the selected text in the edit box being 'lost' as the edit box loses focus?

I am using WD21.

TIA
Robin.

Antworten:

Robin

Have you tried setting the button to 'interrupt' type?

von DerekT - am 09.12.2016 15:01
Hi Robin

check if the ..Cursor and ..endcursor properties of your edit field are still set in your button code. If yes, you have your selection, if not, you can save these values in variables in the exit code of the edit field and use the variable values in your button

Best regards

von Fabrice Harari - am 09.12.2016 18:44
I've now got two different ways to solve this problem:

DerekT: I had never seen the Interrupt button type, works perfectly.

Fabrice: In the 'Exit from' code of the edit box, I was able to access the user highlighted bits by using Myself..SelectedText.


Thank you to you both for your assistance.
Cheers,
Robin.

von Robin Lane - am 10.12.2016 07:40
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.