Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Überprüfen ob Text auf Form selektiert ist (https://www.delphipraxis.net/62553-ueberpruefen-ob-text-auf-form-selektiert-ist.html)

s.h.a.r.k 6. Feb 2006 12:28


Überprüfen ob Text auf Form selektiert ist
 
Hallo.

Ich habe grad ein kleineres Problem mit meinem MainMenu: Und zwar hab ich da auch ein Bearbeiten-Item, in dem die Subitems Kopieren, Einfügen und Ausschneiden sind. Nun habe ich schon die Unit clipbrd eingebunden und beim OnPopUp-Ereignis folgendes eingetragen:
Delphi-Quellcode:
...
PasteItem.Enabled := Clipboard.HasFormat(CF_TEXT);
...
Das klappt ja auch so weit ganz gut, nur jetzt will ich auch, dass das entsprechend beim CopyItem und CutItem auch so ist, nur abhängig davon ob ein Text auf meiner Form markiert ist oder nicht (in Edits oder in Memos). Nun habe ich aber recht viele Edits auf meiner Form und somit das Problem, dass ich sie nicht einzeln ansprechen will (zu viel Arbeit)...

Ich habe da auch schon mit den EM-Messages (EM_GETSEL, EM_GETSELTEXTEX...) herumhantiert, nur konnte ich dabei leider auch keinen Erfolg verzeichnen.

Ich hoffe, dass ihr mir weiter helfen könnt!

mfg shark

Lannes 6. Feb 2006 13:04

Re: Überprüfen ob Text auf Form selektiert ist
 
Hallo,

ActiveControl hilft da weiter, etwa so:
Delphi-Quellcode:
If (ActiveControl.InheritsFrom(TCustomEdit)) and
   (TCustomEdit(ActiveControl).SelLength > 0) then
   //alles ok
damit erreichst Du alle Edits, Memos, Richedits ...

s.h.a.r.k 6. Feb 2006 14:59

Re: Überprüfen ob Text auf Form selektiert ist
 
Hab ich ausprobiert und hat sofort funktioniert!

Echt klasse!!! :thumb:


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:56 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz