Delphi-PRAXiS
Seite 1 von 3  1 23      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Symbole in MessageBox (https://www.delphipraxis.net/2344-symbole-messagebox.html)

BrainCode 19. Jan 2003 09:43


Symbole in MessageBox
 
Hallo,
ich habe eine Frage zur MessageBox:

Ich bin vor einem halben Jahr von VB auf Delphi umgestiegen, komme damit auch ganz gut zurecht, aber eine Sache wundert mich etwas: Unter VB kann man der Funktion MsgBox auch einen Parameter übergeben, so dass links neben dem Text z.B. ein weißes X in einem roten Kreis (vbCritical) angezeigt wird. Dieses Symbol sieht man auch in der Fehlermeldung, wenn man unter Win98 im Explorer auf ein CD-Rom-Laufwerk klickt, in dem keine CD liegt.
Eben diese Option vermisse ich, wenn ich Application.MessageBox aufrufe. Ich würde gerne wissen, ob es eine einfachere Methode gibt, als die Windows-API zu benutzen.

RomanK 19. Jan 2003 09:56

Hoi und willkommen.
Schau dir mal MessageDlg an!!!

BrainCode 19. Jan 2003 10:06

Danke, ich probier's aus!

Daniel B 19. Jan 2003 10:09

Hallo,

in der Application.MessageBox, ist es der dritte Parameter.
Ich erkläre es mal. Schreiben musst DU dort eine Zahl.

Und zwar ergibt die sich folgenderweise:

Code:
Symbol!!!

NAME              WERT SYMBOL
MB_ICONSTOP       16    Roter Kreis mit weissem X
MB_ICONQUSTION    32    Weisse Sprachblase mit Fragezeichen
MB_ICONWARNING    48    Gelbes Dreieck mit Ausrufezeichen
MB_ICONINFORMATION 64    Weisse Sprachblase mit Ausrufezeichen

Schaltfläche!!!

NAME               WERT  SCHALTFLÄCHE
MB_OK              0      OK
MB_OKCANCEL        1      OK, Abbrechen
MB_ABORTRETRYIGNORE 2      Abbrechen, Wiederholen, Ignorieren
MB_YESNOCANCEL     3      Ja, Nein, Abbrechen
MB_YESNO           4      Ja, Nein
MB_RETRYCANCEL     5      Wiederholen, Abbrechen
MB_HELP            16384  Hilfe

Standardvorgabe!!!

NAME               WERT  Standardvorgabe
MB_DEFBUTTON1       0      erste Schaltfläche
MB_DEFBUTTON2       256    zweite Schaltfläche
MB_DEFBUTTON3       512    dritte Schaltfläche
Du muss nun einen Wert aud Symbol, einen aus Schaltfläche und einen aus Standardvorgabe und das! ist dann Dein dritter Parameter der MessageBox.

Delphi-Quellcode:
Application.MessageBox('Text', 'Titel', 276);
Das wäre also eine MessageBox, mit einem Roter Kreis mit weissem X und den Buttons Ja und Nein, und der zweite Button wäre Fokusiert.

HTH.

Grüsse, Daniel :hi:

BrainCode 19. Jan 2003 10:18

Ja, so funktioniert das unter VB auch. Steht das nicht in der Hilfe, oder bin ich zu blöd, es zu finden???

Daniel B 19. Jan 2003 10:22

Ich finde es in der Hilfe auch nicht. Könnte aber auch daran liegen das ich meine Hilfe zerstört habe.
Fehlende Wörter, falsche Verknüpfungen usw... :oops:

Grüsse, Daniel :hi:

PS: Kann es mir auber durchaus vorstellen das es da drin steht

Daniel B 19. Jan 2003 10:25

Achja, Rückgabewerte gibt es ja auch noch, habs schon fast vergessen. ;)

Code:
Konstante Wert Bedeutung
           0   Fehler(Zu wenig Speicher)
IDOK      1   OK wurde gedrückt
IDCANCEL  2   Abbrechen wurde gedrückt
IDABORT   3   Abbrechen wurde gedrückt
IDRETRY   4   Wiederholen wurde gedrückt
IDIRGNORE 5   Ignorieren wurde gedrückt
IDYES     6   Ja wurde gedrückt
IDNO      7   Nein wurde gdrückt
Grüsse, Daniel :hi:

nailor 19. Jan 2003 11:46

Zitat:

Zitat von Meine Delphi-Hilfe (Keyword: Application.MessageBox)
Displays a specified message to the user.

function MessageBox(const Text, Caption: PChar; Flags: Longint = MB_OK): Integer;

Description

Use MessageBox to display a generic dialog box a message and one or more buttons. Caption is the caption of the dialog box and is optional.

MessageBox is an encapsulation of the Windows API MessageBox function. TApplication’s encapsulation of MessageBox automatically supplies the missing window handle parameter needed for the Windows API function.

The value of the Text parameter is the message, which can be longer than 255 characters if necessary. Long messages are automatically wrapped in the message box.

The value of the Caption parameter is the caption that appears in the title bar of the dialog box. Captions can be longer than 255 characters, but don't wrap. A long caption results in a wide message box.

The Flags parameter specifies what buttons appear on the message box and the behavior (possible return values). The following table lists the possible values. These values can be combined to obtain the desired effect.

Value Meaning

MB_ABORTRETRYIGNORE The message box contains three push buttons: Abort, Retry, and Ignore.
MB_OK The message box contains one push button: OK. This is the default.
MB_OKCANCEL The message box contains two push buttons: OK and Cancel.
MB_RETRYCANCEL The message box contains two push buttons: Retry and Cancel.
MB_YESNO The message box contains two push buttons: Yes and No.
MB_YESNOCANCEL The message box contains three push buttons: Yes, No, and Cancel.

MessageBox returns 0 if there isn’t enough memory to create the message box. Otherwise it returns one of the following values:

Value Numeric value Meaning

IDOK 1 The user chose the OK button.
IDCANCEL 2 The user chose the Cancel button.
IDABORT 3 The user chose the Abort button.
IDRETRY 4 The user chose the Retry button.
IDIGNORE 5 The user chose the Ignore button.
IDYES 6 The user chose the Yes button.
IDNO 7 The user chose the No button.

Es steht was davon drin :shock: . Über
MB_HELP 16384 Hilfe
schweigt zwar auch sie, aber es funktioniert (gibt OK und Hilfe Buttons).

Nur der Vollständigkeit halber: Was für einen Wert kriegt man, wenn der Hilfe-Knopf gedrückt wird.

Daniel B 19. Jan 2003 11:51

Zitat:

Zitat von Nailor
Es steht was davon drin :shock: . Über
MB_HELP 16384 Hilfe
schweigt zwar auch sie, aber es funktioniert (gibt OK und Hilfe Buttons).

Gut das es ein Forum gibt, wo man sowas erfährt. ;)

Zitat:

Nur der Vollständigkeit halber: Was für einen Wert kriegt man, wenn der Hilfe-Knopf gedrückt wird.
Gar nichts. Darf auch nicht.
Wenn Du auf Hilfe Drückst, dann wird Deine Hilfedatei geöffnet. Die Box bleibt erhalten und Du musst dann immernoch auf Ja, Nein oder was auch immer klicken. Hilfe heisst nicht Box weg, so wie bei den anderen Button, somit auf kein Rückgabewert.

Grüsse, Daniel :hi:

CalganX 19. Jan 2003 11:51

Versuche es mal mit IDHELP
Sonst halte mal STRG gedrückt und klicke im Quelltext auf IDNO o.ä. dann einfach mal ein wenig suchen.

Chris

[EDIT]*SHIT*, zu spät und auch noch falsch :cry: [/EDIT]


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:41 Uhr.
Seite 1 von 3  1 23      

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