AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

In Edit Feld künstlich einen Teil markieren

Offene Frage von "rainerkunze124"
Ein Thema von rainerkunze124 · begonnen am 14. Mär 2005 · letzter Beitrag vom 15. Mär 2005
 
Benutzerbild von Stevie
Stevie

Registriert seit: 12. Aug 2003
Ort: Soest
4.045 Beiträge
 
Delphi 10.1 Berlin Enterprise
 
#9

Re: In Edit Feld künstlich einen Teil markieren

  Alt 15. Mär 2005, 08:32
Tja, das ist mal kein Delphi-Problem, sondern eins der API.
Die MSDN schrieb zu EM_SETSEL
The start value can be greater than the end value. The lower of the two values specifies the character position of the first character in the selection. The higher value specifies the position of the first character beyond the selection.
The start value is the anchor point of the selection, and the end value is the active end. If the user uses the SHIFT key to adjust the size of the selection, the active end can move but the anchor point remains the same.


P.S.: Ich hab da mal was gebastelt:
Delphi-Quellcode:
procedure SetSel(Edit: TEdit; Start, Stop: Integer);
var
  i: Integer;
  KeyboardState: TKeyboardState;
begin
  Edit.Perform(EM_SETSEL, Start, Start);
  GetKeyboardState(KeyboardState);
  KeyboardState[VK_SHIFT] := $80;
  SetKeyboardState(KeyboardState);
  if Start > Stop then
  for i := Start downto Succ(Stop) do
  begin
    Edit.Perform(WM_KEYDOWN, VK_LEFT, 0);
    Edit.Perform(WM_KEYUP, VK_LEFT, 0);
  end;
  if Start < Stop then
  for i := Start to Pred(Stop) do
  begin
    Edit.Perform(WM_KEYDOWN, VK_RIGHT, 0);
    Edit.Perform(WM_KEYUP, VK_RIGHT, 0);
  end;
  SetKeyboardState(KeyboardState);
end;
Stefan
“Simplicity, carried to the extreme, becomes elegance.” Jon Franklin

Delphi Sorcery - DSharp - Spring4D - TestInsight
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:15 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz