Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi TShortCut belegen (https://www.delphipraxis.net/74241-tshortcut-belegen.html)

xZise 31. Jul 2006 10:31


TShortCut belegen
 
Wie kann ich ein TShortCut belegen?

Wenn ich folgendes mache:
Delphi-Quellcode:
type
  TShortCuts = record
    case ShortCutNum : Byte of
      3 : (
        DealSC : TShortCut;
        NoDealSC : TShortCut;
        SonderTaste : array [1..3] of Boolean;
      );
  end;

{...}

procedure TfMain.bSettingsClick(Sender: TObject);
var ShortCut : TShortCuts;
begin
  ShortCut.ShortCutNum := 3;
  ShortCut.DealSC := Alt + D; // hier meckert er rum: [Error] Undeclared identifier: 'Alt'
  ShortCut.NoDealSC := 'Alt + N'; // hier meckert er um: [Error] Incompatible types: 'TShortCut' and 'String'
  ShortCut.SonderTaste[1] := true;
  ShortCut.SonderTaste[2] := false;
  ShortCut.SonderTaste[3] := true;
  {...}
end;
Wie löse ich nun das Problem?

Steve 31. Jul 2006 10:54

Re: TShortCut belegen
 
Hi,

in der Unit Menus gibts ne Funktion Delphi-Referenz durchsuchenShortCut, die dir aus einem Tastencode und evtl. Shift/Alt/Strg-Taste nen TShortCut erzeugt:
Delphi-Quellcode:
function ShortCut(Key: Word; Shift: TShiftState): TShortCut;
Gruß
Stephan :dance:

xZise 31. Jul 2006 10:59

Re: TShortCut belegen
 
Und wie wandle ich ein Char ('D') in ein Word um?

[edit]Ha ^^ Dumm ist xP
*TShortcut markier* und *F1drück* =
Zitat:

Description

TShortCut types are the menu shortcuts that appear on menus and give the user an alternate way to select menu commands using the keyboard. The ShortCut property is of type TShortCut, and the ShortCutToText and ShortCutToKey routines use parameters of type TShortCut. TShortCut is also the return type of the TextToShortCut routine.
^^ Die funktionier auch wunderbar :D

Steve 31. Jul 2006 11:03

Re: TShortCut belegen
 
Hi,

Delphi-Referenz durchsuchenOrd hilft Dir weiter. Weitere Infos in der OH unter Delphi-Referenz durchsuchenVirtuelle Tastencodes
TextToShortcut hilft Dir dann nicht mehr, wenn Du z.B. eine F-Taste, Home, oder End usw. verwenden willst ;)

Gruß
Stephan :dance:

Hawkeye219 31. Jul 2006 11:12

Re: TShortCut belegen
 
Zitat:

Zitat von Steve
TextToShortcut hilft Dir dann nicht mehr, wenn Du z.B. eine F-Taste, Home, oder End usw. verwenden willst

Das glauber ich nicht. Der folgende Code funktioniert unter Delphi 6:

Delphi-Quellcode:
key := TextToShortCut('Ende');
s := ShortCutToText(key);
Gruß Hawkeye

Steve 31. Jul 2006 11:21

Re: TShortCut belegen
 
Klappt das auch, wenns auf einem ...z.B. französischem System läuft?

xZise 31. Jul 2006 11:27

Re: TShortCut belegen
 
Also eigentlcih wollte ich nur
<strg>+
<alt>+
<shift>+

:D

Steve 31. Jul 2006 11:33

Re: TShortCut belegen
 
Joa dann passt's ja sowieso :D :thumb:

Gruß
Stephan :dance:


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:55 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